3 ms·
I included this comment in a response to a child comment, but reproducing it here to make sure you see it: If your output includes the size of the input, then
by chias 7y ago
I included this comment in a response to a child comment, but reproducing it here to make sure you see it:
If your output includes the size of the input, then what you've got is no longer a hash function. A hash function is defined as taking an arbitrary input and returning an n-bit output for some fixed value of n. By including the size of the input in your output, the size of your output grows logarithmically with the size of your input. This may seem pedantic, but fixed-size-output and arbitrary-size-input is extremely important for general usage of a hash function.
- justincormack 7y agoSha1 and sha256 already hash the message length into the hash function and it is limited to 2^64 bits so they do not support arbitrary input size.