Skip to main content

Rainbow tables

A rainbow table is a precomputed table containing the hash values of a large set of possible plaintexts, usually passwords, for specific hash functions. The purpose of a rainbow table is to accelerate password cracking by enabling attackers to look up hashed values and find corresponding plaintext passwords quickly.

Here's how rainbow tables work:

  1. Hash Functions: When passwords are stored in databases, they are typically hashed using cryptographic hash functions. Hashing converts the plaintext password into a fixed-length string of characters, making it difficult to reverse the process and obtain the original password.

  2. Pre-computation: Rainbow tables are precomputed offline by hashing a vast number of possible passwords and storing the resulting hash values along with their corresponding plaintexts in a table. This process is time-consuming but only needs to be done once.

  3. Attack: When an attacker gains access to a hashed password in a database, instead of brute-forcing by trying various plaintext passwords and hashing them, they can consult the rainbow table. If the hash value matches one in the table, the corresponding plaintext password is retrieved.

To counteract rainbow table attacks, various techniques are employed, such as salting. Salting involves adding random data to each password before hashing, making precomputed tables ineffective because each password has a unique salt.

In summary, rainbow tables are a type of attack strategy that uses precomputed tables of hash values to quickly crack hashed passwords, emphasizing the importance of using additional security measures like salting to enhance password protection.