There is a lot of confusion between "entropy" and "security" of a cryptographic function.
I like to visualize it as the entropy being the water, and the crypto function being a glass.
So for instance, the maximum security a hash function offers, is only as much as much entropy we add into it.
For example:
If we have an n
bits of entropy input and a SHA-512 hash function. The SHA-512 is like a glass that is 512 size but we pour into it n
bits of water, it will only have n
bits of security.
- If n>512 then the glass is full, and the excess water drips out, meaning that every bit of entropy above that is useless, since the attacker will just brute force the glass itself
- If n=512, then the same is true
- If n<512, then it's easier for the attacker to go through the 2^n permunations insteand of trying 2^512 permutations
And this is easy to understand with a small example, think of a dice roll
- It has 2.5849625007 bits of entropy
- The entropy is a uniform random number between 1-6
If we hash the random number we won't get 512 bits of security, because if we have 2 attackers:
- one will try to brute force the 512 bit hash of the random number
- while the other attacker will just go through the 2^512 combinations of the input, which he will find after 2^2.58 ones
So it's obvious that we only have 2.5849625007 bits of security, even though we poured our water into a 512 bit glass.
So the size of the hash function is only a maximum security, provided if the input has minimum that amount of entropy. Otherwise the output has only as much security as the input.
Is this a correct way of interpreting cryptographic security?