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
| Output | 8 bits (extended versions use multi-byte states) |
|---|---|
| Designer | Peter K. Pearson (1990) |
| Throughput | ~1-2 GiB/s on byte loops |
| Status | Non-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
- Microcontroller firmware , smallest practical hash with reasonable distribution.
- Teaching materials , intro-to-hashing examples.
- Some legacy game engines , string hash for in-engine asset IDs.
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
- Peter K. Pearson, “Fast Hashing of Variable-Length Text Strings,” Communications of the ACM, 1990.
- FNV-1a · Jenkins hash
Quick quiz
Test yourself on pearson
10 multiple-choice questions. Pick an answer for each, then submit to see explanations.
Q1.Who designed Pearson hashing?
Q2.What size is Pearson's lookup table?
Q3.Base output size of Pearson hashing?
Q4.Pearson's per-byte operation:
Q5.Is Pearson cryptographic?
Q6.Strength of Pearson?
Q7.Year Pearson was published:
Q8.Pearson on modern CPUs:
Q9.Multi-byte Pearson:
Q10.What is the lookup table T?