SHA-512 vs SHA-256 in a quantum world: is SHA-256 still enough?
Quantum computers break RSA and ECDSA outright, but they only dent hash functions. The dent is why the NSA asks for SHA-384 or SHA-512 and why we fingerprint every document with SHA-512.
What a hash function has to resist
A cryptographic hash turns any file into a short fixed-length fingerprint: 256 bits for SHA-256, 512 bits for SHA-512 (both from NIST FIPS 180-4). For a document fingerprint to be trustworthy, three things must be infeasible:
- Preimage: given a fingerprint, find any file that produces it.
- Second preimage: given a specific file, find a different file with the same fingerprint. This is what an attacker needs to swap your signed contract for another.
- Collision: find any two files with the same fingerprint. This is what someone needs if they prepare a document, get it signed, and later show a different one with the same hash. MD5 and SHA-1 fell to exactly this kind of attack.
Why quantum computers barely touch hashes
Shor's algorithm destroys RSA and elliptic curves because they rest on structured math problems (factoring, discrete logarithms). Hash functions have no such structure to exploit. The only general quantum tool against them is search.
Grover's algorithm (1996) searches an unstructured space of N possibilities in about the square root of N steps. Against a 256-bit preimage problem, that is roughly 2^128 quantum operations instead of 2^256 classical ones: still far beyond any foreseeable machine.
Even that overstates the threat. Grover's steps must run one after another, and splitting the work across many machines loses most of the gain. NIST's post-quantum FAQ makes the same point for AES: under realistic assumptions Grover gives "little or no advantage". For collisions, quantum algorithms exist on paper, but they need enormous quantum memory, and NIST's FAQ notes that, under some realistic cost assumptions, finding a SHA-256 collision should be harder than an AES-192 key search.
How NIST rates SHA-256, SHA-384 and SHA-512
NIST groups post-quantum strength into five categories. Category 1 is as hard as breaking AES-128 by key search, category 5 as hard as AES-256. NIST IR 8547 (Table 8) rates the SHA-2 family this way:
| Hash | Collision category / preimage category |
|---|---|
| SHA-256 | Category 2 (128-bit classical) / category 5 |
| SHA-384 | Category 4 (192-bit classical) / category 5 |
| SHA-512 | Category 5 (256-bit classical) / category 5 |
So why does CNSA 2.0 drop SHA-256?
Not because SHA-256 is broken. It is about matching levels. CNSA 2.0 sets everything at the top: ML-DSA-87 and ML-KEM-1024 are category 5, AES-256 is category 5. A signature system is only as strong as the hash it signs, because the signature covers the fingerprint, not the file. Pair ML-DSA-87 with SHA-256 and collision resistance becomes the weakest link at category 2.
So the NSA lists SHA-384 or SHA-512 for general use. SHA-256 appears only inside the approved parameters of LMS and XMSS, hash-based signature schemes whose security analysis is different and where SHA-256 is the standard building block.
Collision vs preimage: which one matters for contracts
For a document that already exists and was signed, an attacker who wants to replace it needs a second preimage. SHA-256 is category 5 there, so the risk is negligible.
Collisions matter when the attacker controls the document before signing: a counterparty drafts two versions with the same fingerprint, gets one signed and later produces the other. That is the scenario that hurt MD5 in practice, and it is the one where SHA-256 has less margin than SHA-512. For contracts that must hold for decades, the extra margin costs almost nothing.
What about SHA-3? NIST IR 8547 rates SHA3-256 the same as SHA-256 (category 2 for collisions, 5 for preimages), and the larger SHA-3 variants the same as their SHA-2 counterparts. CNSA 2.0 lists the SHA-2 versions, which have the widest support.
Why margins matter: what happened to MD5 and SHA-1
Hash functions rarely fail overnight. They erode. MD5 was widely used for certificates and file checks in the 1990s; practical collisions were published in 2004, and by 2008 researchers used them to create a rogue certificate authority certificate. SHA-1 followed: theoretical weaknesses in 2005, the first public collision in 2017. NIST IR 8547 says SHA-1 will be disallowed in FIPS-validated modules after 2030.
In both cases, systems that had chosen the larger, stronger option early (SHA-256 instead of SHA-1, for example) were unaffected. Nobody expects SHA-256 to follow the same path, and quantum computers do not change that much. But a signed contract is a bet on decades, and the cheapest insurance against the unknown is the larger margin: SHA-512 is category 5 on both collision and preimage resistance.
Practical differences
- Size: a SHA-512 fingerprint is 64 bytes (128 hex characters) against 32 bytes for SHA-256. Irrelevant for documents.
- Speed: SHA-512 works on 64-bit words and is often faster than SHA-256 on 64-bit processors without SHA-256 hardware instructions; with those instructions, SHA-256 is usually faster. Both hash a PDF in milliseconds.
- Compatibility: SHA-256 is everywhere (PDF signatures, TLS, Bitcoin). SHA-512 is just as standard (FIPS 180-4) and available in every major library and command line, for example shasum -a 512 on macOS or sha512sum on Linux.
How signdocumentsonchain.com uses SHA-512
SHA-512 is the only hash function we choose. It fingerprints every signed document and each file in a bundle, forms the commitment (the SHA-512 of the canonical signing record), builds the Merkle tree whose root we anchor on the Base blockchain every 10 minutes, and protects stored secrets: we keep only the SHA-512 of sign-in links, sessions and API keys, never the secret itself.
You can check a fingerprint yourself: hash your copy of the signed PDF with any SHA-512 tool and compare it with the certificate, or upload it at /verify. A few places use SHA-256 because an outside protocol demands it (Google sign-in, for example); they are listed on /security/cryptography and none of them is used to make or check a proof.
Frequently asked questions
Is SHA-256 quantum safe?
Yes, in the sense that no known quantum attack breaks it. NIST rates its preimage resistance at the top category and its collision resistance at category 2 of 5. SHA-384 and SHA-512 offer more margin, which is why NSA CNSA 2.0 asks for them.
Does Grover's algorithm halve hash security?
In theory it halves the exponent of a brute-force search (2^256 becomes about 2^128). In practice the gain is smaller because Grover does not parallelize well. 2^128 operations is still far out of reach.
Why does CNSA 2.0 require SHA-384 or SHA-512?
To keep the hash at the same high security level as ML-DSA-87, ML-KEM-1024 and AES-256. A signature is only as strong as the fingerprint it signs.
Is SHA-512 slower than SHA-256?
Not necessarily. On many 64-bit processors without SHA-256 hardware acceleration SHA-512 is faster. With acceleration SHA-256 usually wins. For documents the difference is milliseconds.
How do I compute the SHA-512 of a PDF?
On macOS run shasum -a 512 file.pdf, on Linux sha512sum file.pdf, on Windows PowerShell Get-FileHash file.pdf -Algorithm SHA512.
Sources
- NIST FIPS 180-4: Secure Hash Standard (SHS) https://csrc.nist.gov/pubs/fips/180-4/upd1/final
- NIST IR 8547: Transition to Post-Quantum Cryptography Standards https://csrc.nist.gov/pubs/ir/8547/final
- NIST Post-Quantum Cryptography FAQs https://csrc.nist.gov/Projects/post-quantum-cryptography/faqs
- Grover (1996): A fast quantum mechanical algorithm for database search https://arxiv.org/abs/quant-ph/9605043
- NSA: CNSA 2.0 FAQ https://media.defense.gov/2022/Sep/07/2003071836/-1/-1/0/CSI_CNSA_2.0_FAQ_.PDF
- NIST SP 800-208: Stateful Hash-Based Signature Schemes (LMS, XMSS) https://csrc.nist.gov/pubs/sp/800/208/final
Keep reading
CNSA 2.0 is the list of algorithms the NSA requires for US national security systems, with a migration calendar that ends in 2035. Even if you never sell to the government, it is the clearest public benchmark for "quantum-safe enough".
ML-DSA and FIPS 204, explained without the mathML-DSA is the signature algorithm NIST chose to replace RSA and ECDSA in a world with quantum computers. Here is what it is, how big its keys are and what it costs you in practice.
Quantum-safe electronic signatures: what they are and why your contracts need oneMost signed contracts today are protected by RSA or elliptic-curve cryptography, which a large quantum computer could break. A quantum-safe signature uses algorithms built to survive that day.
How to verify a post-quantum signed document yourself, step by stepA proof is only worth something if you can check it without asking the company that made it. Here is how to check one of our certificates in your browser, on the command line, offline, or against your own blockchain node.
The NIST post-quantum standards, and the dates that retire RSA and ECCNIST has published three post-quantum standards, has two more in progress, and in October 2026 finalized the plan that phases out RSA, ECDSA and elliptic-curve key exchange. Here is what each one does and what the timeline means for signed documents.