Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
A rainbow table is a precomputed structure that trades storage against computation to reverse password hashes quickly—and the reason every password hash needs a unique salt.

What Is a Rainbow Table?
A rainbow table is a precomputed data structure used to recover plaintext passwords from their hashes. It occupies the middle ground between two extremes: storing every possible password and its hash, which needs impossible amounts of storage, and brute forcing each hash from scratch, which needs impossible amounts of time. Philippe Oechslin formalised the technique in 2003, building on a time-memory trade-off described by Martin Hellman in 1980.
The insight is to store only the ends of long computed chains rather than every value in them.
Start with a candidate password and hash it. Apply a reduction function—not an inverse, simply a deterministic rule that maps a hash back into the password space—to produce another candidate. Hash that. Repeat a few thousand times. Store only the first and last entries of the chain, then discard everything between them.
To crack a hash, apply the reduction function to it, hash the result, and continue until you reach a value matching a stored chain end. Regenerate that chain from its recorded start, and the password immediately preceding your target hash is the answer.
Reduction functions cause collisions, which merge chains and waste coverage. Oechslin’s contribution was to use a different reduction function at each position in the chain, so two chains that collide at different positions do not merge. The varying functions were pictured as different colours along the chain, which is where the name comes from—there is nothing rainbow-like about the data itself.
A rainbow table is built for one hash algorithm and one password space. Add a unique random salt to each password before hashing, and the attacker would need a separate table per salt, which destroys the entire economic premise. This is why salting is non-negotiable and has been standard advice for decades.
Hashes without salts remain the problem. Windows NTLM hashes are unsalted, so a rainbow table for NTLM works against every Windows account that ever used a given password. The 2012 LinkedIn breach exposed around 6.5 million unsalted SHA-1 hashes, and the great majority were recovered. MD5 and SHA-1 without salt appear regularly in legacy applications and in the databases of acquired companies.
Rainbow tables made sense when storage was cheaper than computation. That ratio has reversed for fast hash functions. A modern GPU computes NTLM hashes at well over a hundred billion per second, and a multi-card rig exhausts the entire eight-character printable ASCII space in hours. Downloading and searching a multi-terabyte table is often slower than simply computing the answer.
So the practical threat has shifted. Attackers now use GPU brute forcing with rule-based mutations, enormous wordlists built from breach corpora, and lookup services that index known hash-password pairs from previous leaks. Rainbow tables survive mainly for specific legacy formats and in prebuilt services that cover them.
The underlying lesson is unchanged, and if anything stronger: a fast hash function is the wrong tool for storing passwords, whether or not it is salted.
Password storage should use a deliberately slow, memory-hard algorithm with a per-password salt:
All four incorporate salting automatically and allow the cost to be raised as hardware improves. A pepper—a secret value stored separately from the database, in a key vault or HSM—adds a further layer, because a stolen database alone is then insufficient.
Alongside this, follow the NCSC’s guidance on password policy: encourage long passphrases rather than enforced complexity rules and frequent expiry, both of which push users towards predictable patterns that crack easily. Pair that with multi-factor authentication, and a recovered hash loses most of its value.
You cannot change how NTLM hashes are stored, so defence focuses on preventing theft: Credential Guard, LSASS protection, tiered administration, and long machine-generated passwords for service accounts, which defeat cracking regardless of the method. Our Penetration Test Services include password audits against a domain’s own hashes, which usually tells an organisation more about its credential hygiene than any policy document.
No. Salting defeats precomputation, so an attacker cannot reuse one table across many accounts and must attack each hash individually. If the hash function is fast, such as MD5 or SHA-256, individual attacks remain very quick on modern hardware. Salting must be combined with a deliberately slow, memory-hard algorithm such as Argon2id or bcrypt to be meaningful.
Less often than GPU brute forcing, which has become faster than searching large tables for most fast hash algorithms. They persist for specific legacy formats, notably unsalted NTLM and LM hashes, and through online lookup services that index hash-password pairs from previous breaches. The defensive conclusion is the same either way: never store passwords with an unsalted fast hash.
A salt is a unique random value stored alongside each password hash, which prevents precomputation and ensures identical passwords produce different hashes. A pepper is a single secret value applied to all passwords and stored separately from the database, usually in a key management service. A stolen database containing salts is still attackable; one whose pepper remains secret is not.
Argon2id for new systems, following current OWASP guidance, with parameters tuned so hashing takes a noticeable fraction of a second on your hardware. bcrypt with a suitable work factor is a sound choice where library support is better, and PBKDF2 with a high iteration count where a standards requirement demands it. Avoid any unsalted or general-purpose fast hash.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.