1
$\begingroup$

Why do we have fixed output length in the algorithm SHA1 . is there any explanation about that

$\endgroup$
3
  • $\begingroup$ I believe the answer to your question is here: crypto.stackexchange.com/questions/2144/… $\endgroup$
    – Ching
    Commented Dec 12, 2014 at 17:08
  • $\begingroup$ @Ching: no, this is not that question. That question asked "do the SHA functions generate a fixed length output". This question is "why?" $\endgroup$
    – poncho
    Commented Dec 12, 2014 at 17:20
  • $\begingroup$ SHA1 is a standard hash function. Hash functions are defined to have a fixed size output. $\endgroup$
    – tylo
    Commented Dec 15, 2014 at 12:39

1 Answer 1

1
$\begingroup$

SHA-1 is derived from MD4 and MD5, which are Merkle–Damgård type hash functions with a compression function based on a block cipher.

The initial values to an MD type hash function are essentially the plaintext to the block cipher, with the input to the hash function becoming the key. The maximum length of the hash is determined by the amount of bits of initial value, which is the same size as the block width of the cipher. A block width of five 32-bit words gives SHA-1 a state size and maximum output of 160 bits.

For SHA-1, there is no truncation of the block cipher state prior to output, so we have 160-bits in, and 160-bits out. This provided the required collision resistance of 80-bits as required by the lifespan estimate of how long the hash function was to be in service, which as of about 5 years ago was bumped to 112-bits.

If they so desired, a variable length output could have been implemented like they did with SHA-512/t, but since the maximum output length was the minimum security required, that was neither necessary nor wanted.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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