# Are hashes evenly distributed? [duplicate]

This question already has an answer here:

Are all or any hash functions evenly distributed?

For example: if you had every combination of 256 bits and ran that through SHA256, would that produce approximately 1 of each combination, or would there be peaks?

Are distributions of the hashes calculable without going through the permutations in lower bit sizes?

Is evenness of the distribution of a hash function impacted by the length of the input vs the resultant hash length?

Which hashing functions are most evenly distributed? (e.g. as close to 1 of each equal-bit-length combination possible)

Edit: The linked "duplicate" doesn't come close to addressing all these questions.

## marked as duplicate by kelalaka, Maarten Bodewes♦Mar 15 at 0:20

https://crypto.stackexchange.com/a/12511/23115 gives the answer regarding uniformity. If you stick to the 256 bit input however, you will only get $$1-\frac{1} {e}$$ of the possible outputs. This is due to the hash acting as a pseudo random function and collisions occurring. This behaviour can also be called surjective.