1
$\begingroup$

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.

$\endgroup$
  • $\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 Mar 31 at 20:25
1
$\begingroup$

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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.