Skip to main content
← SproulTech

Hash algorithm migration for small software teams

SproulTech moves a small team's codebase from one hash algorithm to another without signing people out or orphaning stored rows. One engineer, Nate Sproul, lists every place the old algorithm is used, marks which uses are safe to change, routes them through one helper, and keeps old and new values verifying side by side until the switch is done.

By Nate Sproul, software engineer · Updated November 30, 2026

Do I need to move off SHA-256?

No. NIST (the US National Institute of Standards and Technology) says on its hash function policy page: "Currently there is no need to transition applications from SHA-2 to SHA-3." SHA-256 is one of the SHA-2 functions, and the same page says federal agencies may use them "for all applications that employ secure hash algorithms."

That sentence is in the policy statement dated August 5, 2015, which is still the standing text. The newest entry on the page, dated December 15, 2022, is about SHA-1: "After 12/31/2030, any FIPS 140 validated cryptographic module that has SHA-1 as an approved algorithm will be moved to the historical list." If your code still signs or verifies anything with SHA-1, that is the migration to schedule.

So why do this work at all? Swapping the algorithm is the small part of any hash change. The slow part is the list: every place the old one is used, and which of those can change without breaking something. A team that already has the list can treat a new algorithm as a planned change, while a team without it builds the list during the emergency.

  • Source for both quotes, read November 30, 2026: https://csrc.nist.gov/projects/hash-functions/nist-policy-on-hash-functions

What does a hash migration involve?

A hash migration is four jobs in order: find every place the code hashes or signs something, sort each one by what breaks if its output changes, put them behind one helper, then switch the ones that are safe to switch. The sorting is most of the work, because the same function call can be a throwaway signature in one file and a database key in the next.

These are the categories the uses fall into, with what a change does to each.

  • Short-lived signatures (session cookies, sign-in state, tags on a phone call): safe to change. If the code accepts old and new for a while, nobody is signed out.
  • Long-lived signed links, such as an unsubscribe link in an email sent last year: the old signature has to keep verifying for as long as someone can click it. If another program signs these, that program changes first.
  • Values stored as database keys (a hashed email used as an opt-out key, an idempotency key, a row id): changing the algorithm orphans the rows. The lookup misses, so the unsubscribed person gets emailed again or the duplicate gets sent.
  • Integrity records for signed documents: these must stay verifiable forever under the algorithm they were made with. They stay where they are, and each record gets a field naming its algorithm.
  • Algorithms dictated by a vendor: these change when the vendor says so. Stripe describes its v1 webhook signature as "a hash-based message authentication code (HMAC) with SHA-256", and RFC 7518 defines the JWT algorithm HS256 as "HMAC using SHA-256".
  • Local fingerprints (cache file names, build hashes): free to change. The cost is a cache miss.
  • Password hashing: a password hash that stores its algorithm and parameters next to the digest is already self-describing, so old and new formats can share a column and each is checked the way it was made.

Why not find and replace the algorithm name?

Because a find and replace treats a throwaway cookie signature and a stored database key the same way, and only one of them survives the change.

It also fails quietly. A SHA-256 digest and a SHA3-256 digest are both 64 hex characters, so a length check, a column constraint or a regular expression passes either one. Nothing throws; the lookup just comes back empty, and you learn about it from a customer who was emailed after unsubscribing.

A text search misses things too. In the codebase this was first run on, one shared helper produced both a stored key and a document hash, some digests were cut to as few as 10 characters before being stored, and one signer lived outside the repository in another language.

How do old and new hashes work side by side?

Each use gets a name and a rule: one algorithm to sign with, and a list of algorithms to accept. Before the switch the list has one entry. To switch, new values are made with the new algorithm while the verifier accepts both, so a cookie or a link made yesterday keeps working.

The old algorithm comes off the list only when nothing made with it can still arrive. For a ten-minute sign-in token that is ten minutes; for a cookie that lasts a year it is a year. An unsubscribe link with no expiry keeps the old algorithm on its list for good.

Stored keys and document records get no window. They are pinned to the algorithm they were written with, and the reason is written down next to the pin.

Deploy order matters. The code that accepts both goes out first, to every server, and only then does anything start signing with the new algorithm. Do it the other way round and the servers still on the old build reject values that the new build just signed.

What does it cost and how long does it take?

Price: quoted per project after the inventory. Elapsed time on SproulTech's own site: 3 hours 13 minutes of wall-clock time, from the first helper commit to the last live commit, by one person working with AI coding agents. The same method covers signatures and encryption, which is the subject of crypto agility.

The count of stored values and outside signers moves the size of the job far more than lines of code do. A hundred cookie signatures behind one function are quick. One hashed column with no copy of the original input is slow, because those rows cannot be recomputed and every lookup has to check both hashes from then on.

What you have at the end:

  • The inventory: every hashing call site, its category, how long its output lives, and what depends on it.
  • One helper with a named rule per use: the algorithm it signs with and the list it accepts.
  • Tests that pin the exact bytes of every stored key and document hash, so a wrong edit fails in the test run before it reaches a database row.
  • A written plan for each pinned value: what data depends on it and what a change would need.

What have you done this on?

On sproultech.com itself, and so far nowhere else. The site's code had 41 hashing call sites across seven categories, the same seven listed above. Signatures, stored keys and document hashes now go through one helper with a named rule each; the vendor-dictated ones, the password hashes and the build-script cache names were left alone on purpose.

Result: 14 free purposes now sign new values with SHA3-256 and still accept SHA-256. The 12 stored-key and document-hash purposes, plus the two whose signer is an outside script, stay on SHA-256 unchanged. Elapsed time: 3 hours 13 minutes of wall-clock time, from the first helper commit (2026-11-30 14:14) to the last live commit (17:27), by one person with AI coding agents.

Two things turned up that a text search would not have flagged. A signer for one kind of emailed link lived outside the repository, written in another language, so that link stays on SHA-256 until the other program changes. And the signed-document records had no field saying which algorithm made them, which is the first thing to add before any switch.

What if a hash or another primitive is actually broken?

Then the order is the same and the inventory sets the pace. Short-lived signatures switch first: sign with the replacement at once, and shorten the acceptance window to whatever the break allows. If a forged signature is a real risk the window is zero, which signs everyone out.

Stored keys are slower. Each one needs a lookup that checks the old value and the new one, or a rewrite of the rows where the original input still exists. Document records cannot be made again, so they keep their old hash, get an algorithm label, and gain a second hash of the stored copy under the replacement.

Vendor-dictated signatures wait for the vendor. Stripe's webhook documentation says: "Currently, the only valid live signature scheme is v1." A new scheme would come from Stripe, and your part would be accepting it.

NIST's SHA-1 notice shows the slow version of this: the entry is dated 2022 and the date in it is the end of 2030. Whether the warning is eight years or a week, the work starts from the same list of where the algorithm is used.

Questions

Is SHA-256 broken?
No. NIST's hash function policy page says "Currently there is no need to transition applications from SHA-2 to SHA-3", and SHA-256 is part of SHA-2 (https://csrc.nist.gov/projects/hash-functions/nist-policy-on-hash-functions). This service is for teams that want to be ready for a change, and for teams still using SHA-1 for something that matters.
How do I migrate from SHA-256 to SHA-3?
List every call, sort each by what breaks if its output changes, and put them behind one helper that signs with one algorithm and accepts a list. Deploy the code that accepts both, then switch signing. Leave stored keys and document hashes on SHA-256 unless you have also planned the data change. SHA-256 and SHA3-256 both produce 64 hex characters, so tell them apart with a stored label and never by length.
Does changing the hash algorithm break existing sessions?
Only if the verifier stops accepting the old one. If the code accepts both for as long as the longest-lived cookie, nobody is signed out. Switch in one step and every session signed the old way fails, so people sign in again.
Do we need new dependencies for SHA-3 in Node?
On the server, usually not. Node's crypto module accepts the digest names its OpenSSL build supports, and on Node 22 with OpenSSL 3.5 both createHash('sha3-256') and createHmac('sha3-256', key) ran with nothing installed (openssl list -digest-algorithms shows what your build has). Web Crypto is the catch. In Node 22, crypto.subtle.digest lists only SHA-1, SHA-256, SHA-384 and SHA-512, and MDN lists the same four for browsers. Node added SHA-3 to Web Crypto in 24.7.0. Code limited to Web Crypto needs a library or stays on SHA-256 for now.
What about password hashes?
They are a separate job, and often the easy one. If each stored hash carries its algorithm and parameters, a new format can sit beside the old one and each password is re-hashed the next time its owner signs in, the only moment the server holds the password. If yours are bare digests with no parameters, that is a different and more urgent job than anything on this page.
Does this cover HMAC, JWTs and Stripe webhooks?
HMAC, yes: an HMAC is built on a hash, and its call sites are inventoried and switched like the rest. JWTs and Stripe webhooks are listed and then left alone. HS256 is HMAC using SHA-256 by definition (RFC 7518), so a JWT changes only when both ends agree on a different token algorithm, and Stripe's signature scheme is Stripe's to change.

Send a few lines about the codebase and where it hashes, signs or encrypts things. The reply comes from the engineer who would do the work.

nate@sproultech.com