As far as I understand a hash transforms data into a fixed length representation. For example, a random function returns 8-byte numbers and a hash function has a block size of 32-bytes. If I now generate the hash of each random number, would the resulting hashes be an evenly distributed set of random numbers with a length of 32-bytes? I know one could simply multiply the random number by 4, but this would result in the same random entropy as before.
$\begingroup$ $\endgroup$
1 - $\begingroup$ It depends what you mean by "evenly distributed". It should be clear that not all values are possible, so if that's what you mean the answer is "no". A deterministic hash function can't introduce entropy. $\endgroup$bmm6o– bmm6o2020-03-31 20:25:58 +00:00Commented Mar 31, 2020 at 20:25
Add a comment |
1 Answer
$\begingroup$ $\endgroup$
No, actually your 32-bytes would only be a representation of the 8-bytes random (or pseudorandom) number. In this case if I want to attack you system (eg. by brute force) I need only to perform 2^8 attempts instead of 2^32 as someone could expect. This occurs because the 32 hash is only a deterministic representation of a very small 2^8 number.