I am trying to understand the RSA algorithm for digital signatures . Follow this scheme:
Signature :
- Take plaintext m
- Digitally sign s with your private key [d, n] :
- Send a pair [m, s] , consisting of a message and a signature.
Verification / verification :
- Take a pair [m, s]
- Take the public key [e, n]
Calculate the preimage of the message from the signature:
- Verify the authenticity of the signature (and the immutability of the message) by comparing m and m '
Source: Digital Signature with RSA
But I also wanted to use hashing . I'm going to sign not the message, but its “hash image”:
. The signature algorithm may change this way:
Signature :
- Take plaintext m
- Generate message hash:

- Digitally sign s with your private key [d, n] :

- Send a pair [m, s] , consisting of a message and a signature.
Verification / verification :
- Take a pair [m, s]
- Take the public key [e, n]
- Calculate the preimage of the message from the signature:

- Verify the authenticity of the signature (and the immutability of the message) by comparing m and m ' ???
Before using hashing, we could verify the authenticity of the signature (and the immutability of the message) by comparing m and m ' . But now after the 3rd step we get m ' in a hashed form (not the original text). After all, it is impossible to compare the original message m and the hashed version of m ' (considering that the hashing is irreversible and it is impossible to recover the message from the hash). What to do in this situation?
My question is: What is the correct RSA algorithm with a digital signature with hashing?
