I know that this has a disclaimer that isn't to be used in production. But, just know that hash functions are not there to provide randomness. There is no guarantee that a hash will be statistically indistinguishable from random noise.
Show HN: Birdseed – A silly way to get random numbers by hashing tweets
21–24 of 24 posts
Re: Show HN: Birdseed – A silly way to get random numbers by hashing tweets
#22I know that this has a disclaimer that isn't to be used in production. But, just know that hash functions are not there to provide randomness. There is no guarantee that a hash will be statistically indistinguishable from random noise.
There are a bunch of CSPRNGs built out of hash functions. Are they all doing it wrong?
Re: Show HN: Birdseed – A silly way to get random numbers by hashing tweets
#23I know that this has a disclaimer that isn't to be used in production. But, just know that hash functions are not there to provide randomness. There is no guarantee that a hash will be statistically indistinguishable from random noise.
There is no guarantee that any PRNG will be indistinguishable from random noise but a properly designed hash function will be as close as any.
[1] https://en.wikipedia.org/wiki/Cryptographically_secure_pseud...
Re: Show HN: Birdseed – A silly way to get random numbers by hashing tweets
#24Earlier quoted context omitted.
There are a bunch of CSPRNGs built out of hash functions. Are they all doing it wrong?
Of course, I'm sure that it is possible to construct one out of a hash function. I am also pretty confident that they do more than just serve the raw bytes of the hash.
Real-world cryptographic hash functions, however, just try to approximate a random oracle. They attempt to achieve pre-image resistance and collision resistance by making their output look random. Certainly that's the case with SHA-224, which is what this code uses.
Some real-world CSPRNGs do just use hash functions directly. Linux's /dev/random implementation, for example, just returns a SHA-1 hash of its entropy pool contents. Yarrow (used in Mac OS X, iOS, and FreeBSD) does a final pass on its output using a block cipher, but requires that the hash function used in its earlier stages produce random-looking output. Fortuna is similar.
Of course, this code is insecure and should not be used in production, regardless of the internal details, simply because all of the inputs are known to a third party i.e. Twitter.