0
$\begingroup$

I am a newbie to cryptography and SHA-1.

Currently I am configuring a SHA-1 hash function which takes default length as 128 bits. Is it okay to configure it this way, since I see in most cases SHA-1 uses 160 bits? So what is the most common length used for SHA-1 hashes?

I read in many places that RSASSA-PSS is used for signature verification? I assume message digest or hashed value or signature all refer to output hashed value of SHA-1.

How do I use the RSASSA-PSS function to verify the signature? Should I pass it the message digest value and expect that the plain text should match the initial input given to the SHA-1 function?

$\endgroup$
2
  • 2
    $\begingroup$ Just to be sure you know : SHA-1 is breaking down (meaning: there exists at least one practical break). Due to that, SHA-1 is being abandoned. Therefore, I'ld recommend to not use SHA-1 for cryptographic purposes anymore. Attacks only get better. Never catch a falling knife. $\endgroup$
    – e-sushi
    Commented May 23, 2017 at 7:48
  • 1
    $\begingroup$ it is just for my understanding and test it in my sample prject $\endgroup$
    – danny
    Commented May 23, 2017 at 8:20

1 Answer 1

4
$\begingroup$

Currently iIam configuring SHA1 hash function which takes default length as 128 bit. Is it OK to configure with this, since I see in most of the SHA1 uses 160 bit? So what is the most common length used for SHA1 Hash?

Assuming that you mean output size: the output size of SHA-1 is 160 bits (20 bytes) and cannot be configured. In some cases protocols however use only the leftmost bits of the hash.

Although using only the leftmost bits is generally considered secure SHA-1 already has a security strength of about 80 bits (half of 160 bits output size) - about the bare minimum. Removing bits from the output size will also decrease the security, so that is not recommended.

Sometimes protection against pre-images is not an issue and cutting down the SHA-1 size is not a problem (HMAC-SHA1 for instance could use fewer bits).

I read in many places that RsaSsaPss is used for verification of signature? I assume Message Digest or Hashed Value or Signature -> all these terms refers to output Hashed value of SHA1.

Only Message Digest or Hashed Value refer to the output of the hash value. The signature is generated using a combination of the hash function, the padding function (e.g. PSS) and of course the RSA modular exponentiation. More details in PKCS#1 v2.1 or v2.2.

How to use Rsa Ssa Pss function to verify the signature? should i pass the Message Digest value and expect that the plain text should match with initial input given to SHA1 function?

Depending on the implementation you need either to pass the data and the signature into the signature verification function or you need to pass the hash function or hash value and the signature to the signature verification function.

The signature implementation must have been configured for the right algorithm and initialized for verification with the correct public key, of course.

For signature generation / verification it is generally required to use a secure hash function such as SHA-2.


Beware that the MGF1 function that is used for PSS may also use a hash function. You may have to configure that one separately - it should default to SHA-1 - which in the case of MGF1 would be secure.

$\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.