跳到主要内容
uencoder

Understanding Rainbow Tables

Learn 如何 rainbow tables 攻击 unsalted hashes 和为什么 salting defeats 它们.

问题

你 want 到理解如何 rainbow tables enable 快 password cracking 和如何defend 针对它们.

前置条件

  • Understanding 的 hash 函数
  • Knowledge 的 password storage

步骤

  1. 1. Understand the precomputation attack

    A rainbow table is a precomputed table of hash-to-password mappings. An attacker computes hashes for many possible passwords once, storing them in a time-memory trade-off table. To crack a stolen hash, they look it up in the table instead of brute-forcing.

    输入
    stolen hash: 5f4dcc3b...
    输出
    lookup in table → 'password'
  2. 2. Understand the role of chains

    Rainbow tables use hash chains to compress the storage. Each chain starts from a password, alternates hashing and reduction functions, and stores only the start and end. This reduces storage at the cost of some recomputation during lookup, trading time for space.

    输入
    chain: pw1 → hash → reduce → pw2 → ...
    输出
    store only start + end
  3. 3. Defend with salting

    A per-password random salt makes precomputation useless: the attacker would need a separate rainbow table for each salt, which requires more storage than brute-forcing. This is why all modern password hashing (bcrypt, PBKDF2, scrypt) uses salts. Always use a unique salt per password.

    输入
    hash = H(password + salt)
    输出
    rainbow table defeated

预期结果

Understanding 的如何 rainbow tables 工作和 为什么 salting 是必要为 password 安全.

常见错误

Storing unsalted password hashes
Always use a per-password random salt. bcrypt, PBKDF2, and scrypt handle this automatically.
Using a shared salt for all passwords
A shared salt still allows a single rainbow table to crack all passwords. Each password needs its own random salt.

排障指引

  • If you discover unsalted hashes in a legacy system, migrate to bcrypt or scrypt immediately.
  • Rainbow tables are effective against MD5 and SHA-1; they are less practical against slow KDFs like bcrypt.

安全限制

  • Rainbow tables are a real threat for unsalted hashes. Salting is the standard defense.
  • This is an educational explanation; no cracking is performed.

相关工具

相关词条

参考链接