In the questions, Are mouse movement coordinates useful as a seed for a RNG? and Is this a good entropy collector and whitening technique? the posters each talk about collecting mouse and keyboard input as a source of entropy. The replies make the good point about this being dangerous and requiring a large sample to ensure sufficient entropy for cryptographic purposes.
I am wondering if the quality of these inputs as entropy sources would be improved given the following scheme and, if so, by how much?
Imagine a system where X
is some input from the user (e.g. mouse coordinate pair or key code combined with current timestamp) and H
is some latest-generation hashing function and e
is our current entropy pool state after each iteration. After the first input is collected we have:
e = H(X1)
This has low entropy. We collect another sample from the user and this time combine with the previous entropy and and hash it:
e = H( X2 + e )
or:
e = H( X2 + H(X1) )
Then we keep doing the same thing for each new value collected, combining it with the previous entropy and hashing them together:
e = H( Xn + e )
or:
e = H( Xn + H(Xn-1 + H(Xn-2 + H(Xn-3 + ...))) )
Does hashing iteratively like this in any way change the rate of improvement of the quality of the entropy produced, or is it about the same as collecting all of the samples and hashing them once like this:
e = H( X1 + X2 + X3 ... Xn )
Update
This answer to What happens to entropy after hashing? also has a good analysis that I think applies here:
If we have a Hash function
SHA
which doesn't have any collisions, then it has no effect on entropy; that is,H(X) = H(SHA(X));