I'm just reviewing a program someone wrote to provide high quality random data using an entropy collector and a hash based whitening technique. I'll try summarize the process:
Collect entropy from sources into separate arrays e.g.
- milliseconds between key presses
- milliseconds between mouse clicks
- mouse movements x + y concatenated together
All the separate numbers are joined into a single array of values (a + b + c).
The array is mixed using a Knuth shuffle using random numbers from the programming language's psuedo random source. I believe a Knuth shuffle works its way through an array in reverse order swapping the current item in the array into a random position in the array.
The items in the mixed array are concatenated together and converted to a single string.
Each 512 bits of the string is iteratively run through SHA2 to give a uniformly distributed 256 bits of output per 512 bits of input. For example if a total of 8192 bits of entropy was collected, the total output would be 4096 bits.
The quality of randomness probably depends on how random the input is, e.g. how randomly the user moved their mouse. It would seem difficult for a person to repeat the same mouse movement path in the same way twice. Let's assume for now the user moved it very randomly and not in a repeatable fashion.
- Does this give high quality random data compared a PRNG?
- What problems are there with this design?
- Would "Von Neumann"-whitening work better than hash based?
- How could it be improved?