Hash Lab

Non-cryptographic

Pearson hashing

Peter K. Pearson’s 1990 design. A single 256-byte permutation table and an XOR-and-lookup byte loop. The whole hash is six lines of C. Fast, tiny, and the cleanest pedagogical example of a non-trivial hash function. Not for adversarial use.

The whole algorithm

uint8_t pearson(const uint8_t *m, size_t n) {
    uint8_t h = 0;
    for (size_t i = 0; i < n; i++) {
        h = T[h ^ m[i]];   // T is a 256-byte permutation
    }
    return h;
}

The lookup table Tis any permutation of 0..255 , Pearson’s original paper provides a recommended one chosen for avalanche.

At a glance

Output8 bits (extended versions use multi-byte states)
DesignerPeter K. Pearson (1990)
Throughput~1-2 GiB/s on byte loops
StatusNon-cryptographic; mostly pedagogical today

Multi-byte extensions

The basic 8-bit Pearson hash is too small for any modern use. The standard trick is to run several independent Pearson hashes in parallel (each with a different starting state or table rotation) and concatenate them , producing 32, 64, or 128-bit outputs while keeping the lookup-table simplicity.

Where it still shows up

Why it’s no longer the default

Pearson is fully reversible by an attacker who knows the table (which is published). Modern non-crypto code uses xxHash, MurmurHash, or FNV; for hash-flooding-safe code, SipHash. Pearson’s niche is now genuinely small environments where every byte of code size matters.

References

Quick quiz

Test yourself on pearson

10 multiple-choice questions. Pick an answer for each, then submit to see explanations.

  1. Q1.Who designed Pearson hashing?

  2. Q2.What size is Pearson's lookup table?

  3. Q3.Base output size of Pearson hashing?

  4. Q4.Pearson's per-byte operation:

  5. Q5.Is Pearson cryptographic?

  6. Q6.Strength of Pearson?

  7. Q7.Year Pearson was published:

  8. Q8.Pearson on modern CPUs:

  9. Q9.Multi-byte Pearson:

  10. Q10.What is the lookup table T?

0 of 10 answered