Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
mmalone
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
24 ms
·
211.
▲
by
mmalone
11y ago
Exactly, it's as hard and error prone as generating the randoms yourself. The solution you described requires an analysis of the hash function to determine collision probability, diligence to find a sha-256 implementation (circa a few
212.
▲
by
mmalone
11y ago
That's all fair-ish, and I think I need to learn more about CS alternatives. Necessary cycle length is relative. For crypto it seems like the definition is "big enough that it generates keys that are infeasible to predict," o
213.
▲
by
mmalone
11y ago
For the record, we are not and at no point have we ever used the Node.js PRNG to generate random numbers for our gambling games. That is an entirely separate, audited, and carefully controlled system. This code was unrelated to gamb
214.
▲
by
mmalone
11y ago
If the attacker might gain something by being able to predict the next ID in the sequence then you should be using a CSPRNG. That's not a problem here. There's nothing for them to gain. It absolutely is sensible. Adding node IDs a
215.
▲
by
mmalone
11y ago
Not rude at all. They're actually all good questions. > Why? Why do your identifiers need to be cryptographically secure at all? They don't have to be cryptographically secure. They just need to be unique. Using random identifi
216.
▲
by
mmalone
11y ago
Unpredictability is irrelevant to a use case like shuffling an array. Moreover, your conjectured polynomial-time perfect CSPRNG may actually produce a less useful stream of entropy for this use case than a good non-CS PRNG because its cycle
217.
▲
by
mmalone
11y ago
If, by quality, you mean "indistinguishable from true randomness" then there are many valid metrics. One important metric that many non-CS PRNGs have, but many CSPRNGs do not have, is a provable deterministic cycle length for all
218.
▲
by
mmalone
11y ago
Hahahahaha. I can't believe that either.
219.
▲
by
mmalone
11y ago
Looks like your first question has been answered! Re: submitting a patch, there were several previous issues and discussions about Math.random() being problematic that were closed-wontfix or otherwise dismissed. It seemed like the general p
220.
▲
by
mmalone
11y ago
If you want to do something as trivial as an unbiased Fisher-Yates shuffle of an array, however, Math.random() is broken. And Math.random() doesn't have to be broken for things like UUIDs. Python and Ruby both have PRNGs that are suita
221.
▲
by
mmalone
11y ago
FWIW xorshift1024* would almost certainly be faster than MWC1616 and it has no systematic failures on BigCrush. The only downside is that it uses more memory, but I think we can afford it. If not xorshift64* is also faster than MWC1616 and
222.
▲
by
mmalone
11y ago
It's easier to generate a random identifier and if the generator is good the probability of a collision is lower than the probability that you HDD will fuck up in an uncorrectable way while storing the identifier (as I've pointed
223.
▲
by
mmalone
11y ago
The biggest problem is that they take up a lot of space. Plus you have to find a good library and vet it (there's nothing in the standard library). Or just write 10 lines of straightforward code. If you go and look at node-uuid commit
224.
▲
by
mmalone
11y ago
It is mentioned! Without the `window.` part though ;).
225.
▲
by
mmalone
11y ago
Using node IDs and timestamps is just an additional safety factor. Statistically it's not necessary if you have a good generator. Even without those things our target collision probability is less than the expected uncorrectable error
226.
▲
by
mmalone
11y ago
True of UUID1s, unless you bastardize them and use something other than MAC address. You could do UUID4s without leaking info.
227.
▲
by
mmalone
11y ago
Great point / good question. Here's why we didn't just use UUIDs: * UUID generation still requires a good (CS)PRNG and should be vetted the same way you'd vet a (CS)PRNG. * UUIDs are one-size-fits-all 36 character base-1
228.
▲
by
mmalone
11y ago
It wasn't dependent on exact behavior. It was dependent on a sensible general contract. We rely on sensible implementations of general contracts all over the place in software development. We did make an incorrect assumption that the P
229.
▲
by
mmalone
11y ago
There's a difference between cryptographic security and quality. Cryptographically secure generators typically have (empirically verified) high quality from a statistical perspective, but they're not a general solution for all pur
230.
▲
by
mmalone
11y ago
Calling a PRNG is way easier than any of the alternatives. Coordinating sequences on a bunch of nodes so that nobody overlaps is a pain in the ass, and a point of failure. Incorporating some notion of "machine ID" in the identifie
231.
▲
by
mmalone
11y ago
tl;dr: the algorithm powering V8's Math.random() is very poor quality. For many use cases you can't safely pretend its output is actually random. Don't use it for anything non-trivial that you care about. It should probably b
232.
▲
by
mmalone
11y ago
I was lead architect at SimpleGeo and spent most of the time working on our distributed geospatial database. I haven't looked at the MongoDB implementation in years, but at that time it was really a toy compared to what other people we
233.
▲
by
mmalone
11y ago
Betable | San Francisco | Full Time, ONSITE | https://jobs.lever.co/betable | Gambling platform for developers Betable is transforming one of the most opaque and highest revenue-generating industries in the world - gambling
234.
▲
by
mmalone
12y ago
Not implying anything other than that it's a proper name. Meh.
235.
▲
by
mmalone
12y ago
I have to justify that that's what I mean when I say "god," or I have to justify that God created the universe? It is a common definition, so I figured you'd accept it. The point is I'm not talking about a specific
236.
▲
by
mmalone
12y ago
In a hypothetical world with no privacy and perfect information I'd just make my nuclear launch system (which also has perfect information) only launch when the right people ask them too. You can't pretend to be those people becau
237.
▲
by
mmalone
12y ago
How are you defining God? Have we looked for God in all of the places that people believe God lives / controls? The universe either came from somewhere or has always existed... If I define God as a "the thing that created the univ
238.
▲
by
mmalone
12y ago
The argument is that privacy serves no purpose aside from facilitating lies, and lies are bad. One challenge that has been presented is that there's a difference between "lying" and "not telling the whole truth" but
239.
▲
by
mmalone
12y ago
Eh... I don't get it? Why is privacy required where there is no trust? I see how the two are related but I see it kind of differently... it's hard not to trust someone when you know they're not hiding anything. In a totally u
240.
▲
by
mmalone
12y ago
Comcast is throttling / dropping traffic because they want Netflix to pay for bandwidth. You're right that they'd be getting paid twice for the same traffic, but ISPs already do this -- if Comcast and Netflix are connected vi
More ›