Why RSA signatures based on the hash of the message rather than the message itself?

  • You mean the digital signature?
    – schroeder
    Commented Jun 17, 2014 at 18:36
  • yeah RSA signatures
    – Zonik
    Commented Jun 17, 2014 at 18:38
  • 1
    Please tell us what you have researched so far. Looks like an exam question. Commented Jun 17, 2014 at 18:46

2 Answers 2


The hash acts as a measure to determine if the message has been changed since it was signed. That way the recipient knows that the message is the same as when it was signed (integrity).

  1. Message is composed

  2. Message is hashed

  3. Hash is encrypted with sender's private key

  4. The resulting signature accompanies the message

The recipient can use the sender's public key to check the hash, thereby confirming the integrity of the message and that the sender was the one who signed it (non-repudiation). A digital signature means that the message is as intended and sent by a confirmed source.

Applying the private key to the hash is more computationally efficient (smaller thing to encrypt), and encrypting the message may not be necessary if confidentiality is not required/desired.


Technically, the signature works over the message; it so happens that the first step of the signature generation algorithm is to hash the message with a hash function, and the hash value is used afterwards.

Using a hash function is necessary because the RSA algorithm relies on integers modulo a given integer (which is part of the public key), so it cannot work with values which do not fit in that limited range. The hash function is also needed to ensure non-malleability (a rather technical internal characteristic). Using a hash function is sufficient because of the properties of cryptographic hash functions; namely, the resistance of hash functions to collisions and preimages really means that signing a hash is "as good" as signing the original message.

Not the answer you're looking for? Browse other questions tagged .