4 ms·
There is no better solution for the client-side web. getRandomValues() generates cryptographically secure random bytes in all current popular browsers.
by dchest 5y ago
There is no better solution for the client-side web. getRandomValues() generates cryptographically secure random bytes in all current popular browsers.
- omegalulw 5y agoSide question: what are cryptographically secure random bytes? I assume that with random bytes all we care about is that they are random. And since it's impossible to tell if any finite sized output is random or not, I suppose we simply show randomness with statistical significance tests. But how, precisely?
- marshray 5y agoPassing statistical tests is the lowest, most basic, requirement for cryptographic RNGs. Beyond that, you need to prove that no other party (i.e., the 'attacker') can predict the output any better than random chance, even if they've seen all the output leading up to it. Beyond even that, many CSRNGs attempt to recover from 'state compromise': even if a snapshot of all the contents of the secret state get leaked somehow the system will soon return to producing secure output.