RSA is a public-key algorithm built on a mathematically linked key pair. A hash function is a keyless procedure that turns any input into a fixed-length digest. They are different tools. They meet in digital signatures, where a message is hashed and encoded before RSA’s private-key operation is applied.
What RSA is
RSA is named after Rivest, Shamir and Adleman. NIST’s glossary describes it as a public-key algorithm used for digital-signature generation and verification and for key establishment. The PKCS #1 specification (RFC 8017, IETF, November 2016) also defines RSA encryption schemes, so RSA is not only a signature tool.
As an Amazon Associate I earn from qualifying purchases.
“Public-key” means each party has two related keys. The public key can be shared, and the private key must stay secret. What the keys do depends on the scheme. In a signature scheme the private key signs and the public key verifies. In an encryption scheme the public key encrypts and the private key decrypts.
What hashing is
NIST defines a cryptographic hash function as one that takes a bit string of arbitrary length and returns a bit string of fixed length. The output is called a digest. A hash needs no secret key as a primitive, and anyone can compute it.
#1 Best Overall
Hashing is not encryption. A digest is not a ciphertext, and it is not meant to be reversed to recover the input. NIST lists three security properties:
- Collision resistance: it should be infeasible to find two different inputs with the same digest.
- Preimage resistance: given a digest, it should be infeasible to find an input that produces it.
- Second-preimage resistance: given one input, it should be infeasible to find a different input with the same digest.
Which property matters most depends on the use. Signatures rely heavily on collision resistance, because two messages sharing a digest would also share a signature.
RSA versus hashing at a glance
| Aspect | RSA | Hash function |
|---|---|---|
| Type | Public-key algorithm | Digest computation |
| Keys | Public/private key pair | None required |
| Output | Signature or ciphertext, depending on scheme | Fixed-length digest |
| Typical purpose | Signatures, key establishment, encryption schemes | Fingerprinting data; a component inside signatures |
| Provides confidentiality? | Only in an encryption scheme | No |
| Identifies the signer? | Yes, in a signature scheme, through the key pair | No, not on its own |
How RSA signatures use hashing
RSA operates on numbers of a fixed size tied to the key, not on arbitrary-length documents. A signature scheme therefore first processes the message with a hash function. It then applies an encoding method that formats the digest, and only then applies the RSA private-key operation. Verification uses the public key and checks that the result matches the expected encoded value for the received message.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteTwo points follow. First, the hash supplies a compact fingerprint of the message. The RSA key operation is what ties that fingerprint to a particular key holder. A bare hash cannot tell you who created a message, because anyone can compute it. Second, signing is often described as “encrypting a hash with the private key”, but that shortcut hides the encoding step and the scheme-specific rules. Those rules are the part that matters for security and interoperability.
The two RSA signature schemes
RFC 8017 specifies two signature schemes with appendix:
RSASSA-PSS
RFC 8017 recommends PSS for new applications. FIPS 186-5 approves it, and requires an approved hash function or XOF (extendable-output function) for it.
RSASSA-PKCS1-v1_5
RFC 8017 retains this scheme for compatibility with existing systems. FIPS 186-5 also approves it, subject to additional constraints.
Recommended Free Tools
In practice the choice comes down to whether you are building something new or must interoperate with existing deployments. Protocol and policy requirements, such as a standard or certificate profile you must follow, can decide it for you.
Best Value
Which hash goes with RSA?
No single hash fits every context. Use the hash that your protocol or policy specifies. Under FIPS 186-5, PSS needs an approved hash function or XOF, and RFC 8017 defines the scheme-specific details of how the hash is used. If you must comply with a specific standard, check its current text rather than relying on an older default.
Standards status
FIPS 186-5, the Digital Signature Standard, was published by NIST on February 3, 2023. Its abstract says it “specifies a suite of algorithms that can be used to generate a digital signature.” NIST’s publication page carries a May 12, 2025 note saying identified issues are intended for a future revision, and it links an errata spreadsheet. Check that page before relying on it for implementation.
Quick Recap
Common mix-ups
- “Does RSA encrypt or hash?” RSA does neither as a plain hash. It performs public-key operations, used in encryption schemes and signature schemes, and signature schemes call a hash function.
- “A hash proves who sent it.” It does not. Only the signature construction supplies that.
- “A hash hides the data.” A digest is not encryption and gives no confidentiality guarantee.
- “RSA signing and RSA encryption are the same thing.” They use distinct encodings and serve distinct purposes, even though both are defined in PKCS #1.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

