SeaHash Explained: 5 Facts About the Ocean-Fast Hash

SeaHash explained in plain terms means understanding the four-state hash that raced across the Rust ecosystem, a design from 2016 that mixes data through four independent registers in a pattern that reads like a wave. The central question is why a hash would keep four states instead of one, and the answer is that four states let the processor’s pipelines stay busy while the mixing spreads everywhere, so SeaHash is both very fast and very well mixed, and that balance is the whole point of the design.

SeaHash is a fast non-cryptographic hash function created by the Rust developer Ticki, producing a 64-bit digest. It turns a message into a fingerprint by alternating its words through four state registers and a diffuse function, and it is built on the idea that a hash should be designed for the hardware it runs on, which means the design is meant for modern pipelined processors, and that hardware focus is what makes it unlike the hashes of its era.

This article gives you five facts about SeaHash, explains what it is, how it works, and why it still matters.

Key takeaways

  • SeaHash is a fast hash from 2016, created by Ticki.
  • It produces a 64-bit digest from any input.
  • It keeps four independent state registers, a, b, c and d.
  • Its diffuse step multiplies by a 64-bit prime.
  • It became famous in Rust, though it is not cryptographic.

What SeaHash is

The first fact is that SeaHash keeps four states, which means it holds four 64-bit registers called a, b, c and d. A single-state hash mixes everything through one value, but SeaHash spreads its work across four registers, which means the mixing stays parallel, and because each register only meets its neighbours, the design is easy for the processor to schedule.

The second fact is that it reads the input eight bytes at a time. SeaHash takes each 64-bit word of the message and folds it into one of the four states in turn, which means the data flows through the states like a wave, and because the words are wide, the hash absorbs data quickly.

The third fact is that it diffuses with a prime. After folding in a word, SeaHash multiplies the state by a fixed 64-bit constant, which means the value is scrambled thoroughly, and because the constant was chosen to spread bits widely, a small change in the input spreads across the whole output.

The fourth fact is that it came from the Rust community. SeaHash was written in Rust, by a Rust developer, for Rust programs, which means it was tuned for the language’s hash tables, and because it was open from the start, it spread quickly through the ecosystem.

The fifth fact is that it is not cryptographic, and it never pretends otherwise. SeaHash is built for speed in hash tables, not for secrets, which means it must never guard a password or a signature, and that honesty is the reason it is the first example engineers meet when they learn the line between fast hashes and secure ones.

Our guide to xxHash explains the earlier speed champion it was measured against, and our guide to MetroHash explains the other fast hash of the same generation.

How SeaHash works

Everything starts with the four states, which are loaded with fixed random-looking constants. SeaHash sets a, b, c and d to four 64-bit starting values, which means the starting state is the same for every hash, and because the values were chosen to spread bits widely, the hash starts from a well-mixed position.

Each step begins with a word of the message, which is xored into one of the states. SeaHash takes the next 64-bit word and folds it into a, then b, then c, then d in turn, which means fresh data arrives at every step, and because the states take turns, the processor’s pipelines stay busy.

The diffuse operation is what makes the design work as a whole. After folding in a word, SeaHash multiplies the state by its diffusion prime and xors the halves, which means the value is scrambled thoroughly, and because the multiplication is wide, a small change spreads across the whole state.

The alternating pattern spreads the effect further. The states take turns receiving input, which means each state mixes the data the previous one has already stirred, and because the pattern repeats, the mixing builds up as data flows in.

The finalisation is what turns the state into a digest. After the last word, SeaHash diffuses each state once more and xors all four together, which means the digest depends on the whole message and nothing else, and because the final mix uses the same diffuse step, the design needs no special finishing machinery.

The digest comes from the combined state, read out as a single 64-bit word. SeaHash outputs the xor of its four diffused states directly as the fingerprint, which means the result is a fixed size whatever the input, and that size is exactly what a hash table or a cache needs for its lookup key.

A dark office desk with a laptop showing a glowing green cipher diagram, a brass key and a notebook beside it
A dark office desk with a laptop showing a glowing green cipher diagram, a brass key and a notebook beside it, shows how SeaHash works: four states take turns folding in words, wave after wave, until a hash emerges.

Comparing SeaHash with other fast hashes

SeaHash is one of several fast hashes built for hash tables, and each was built with a different emphasis. xxHash is the earlier champion built on prime multiplication and rotation, MetroHash is the other fast hash of the same generation, and SeaHash is the one built on four parallel states, while each approach trades something for something else.

The table below sets out the main contrasts between the leading approaches.

Aspect SeaHash xxHash MetroHash
State registers Four 64-bit One accumulator Four 64-bit
Digest size 64 bits 32, 64 or 128 bits 64 or 128 bits
Core operation Diffuse multiply Multiply and rotate Multiply and xor
Year 2016 2012 2015
Best for Rust hash tables General hashing Fast large-input hashing

The practical result is that SeaHash is the right choice for Rust hash tables, xxHash suits general hashing, and MetroHash fits fast large-input hashing instead.

Where SeaHash is used

Rust programs use it in hash tables. SeaHash became the default hasher of the hashbrown crate for a time, because it was fast and well tested, and that adoption is the reason it ran in real programs rather than only in benchmarks.

Hash tables use it to spread keys with a wide fingerprint. A table that stores millions of keys wants a hash that is both fast and well distributed, because a slow hash becomes the bottleneck, and that speed is the reason SeaHash earns its keep in language runtimes.

Caches use it to fingerprint keys quickly. A cache that hashes long strings needs a hash that processes big words, because a byte-at-a-time hash becomes the bottleneck, and that width is the reason SeaHash appears in data systems.

Benchmarking uses it as a speed reference. Engineers still quote SeaHash when they discuss how fast a hash can run, because it is the clearest example of four-state mixing paying off, and that number shapes how new hashes are measured.

Teaching uses it as the four-state example. Courses introduce SeaHash when they explain that a hash can keep several states at once, because it is the clearest case of the idea in a real design, and a student who understands SeaHash understands why parallelism matters in hash design.

Strengths and limits

The greatest strength of SeaHash is its speed. A hash that processes data at several gigabytes per second gives programs faster tables for free, and that strength is real, measured in open benchmarks and confirmed by the crates that adopted it as their default.

It is also a strength that the design is simple to explain. Four states, one diffuse step and a final xor is easy to describe, and that simplicity is worth more than cleverness in a field where a hash nobody can audit is a hash nobody trusts.

The limits are real, though, and the biggest is that it is not cryptographic. SeaHash was never designed to resist an adversary, which means it must never guard a secret or a signature, and a system that faces hostile inputs must use a keyed hash with stronger guarantees instead.

SeaHash checklist

  • Use SeaHash for hash tables, never for security or passwords.
  • Remember it keeps four 64-bit states, a, b, c and d.
  • Note the digest is 64 bits and the diffuse step uses a prime.
  • Compare it with MetroHash to see two kinds of four-state design.
  • Study the diffuse operation, which is what mixes so well.
  • Check the language, since it is a Rust community design.
  • Keep real digests behind standard hashes for signatures.
  • Read the 2016 repository to see how it was built.
  • Choose a keyed hash when inputs may be hostile.

Frequently asked questions

What is SeaHash in simple terms?

It is a 2016 fast hash that turns any input into a 64-bit fingerprint by folding words through four states and a diffuse multiplication.

Who created SeaHash?

Ticki, a developer in the Rust community, who built it for Rust’s hash tables and published it as open source.

How is SeaHash different from xxHash?

Both are fast 64-bit hashes, but SeaHash mixes through four states with a diffuse step while xxHash mixes through one accumulator with rotations.

Is SeaHash still secure?

It is fast and well tested, but it is not a cryptographic hash, so it must never guard secrets or signatures.

Where is SeaHash used?

In Rust programs, in hash tables, in caches, in benchmarking, and in teaching about parallel-state hashing.

When should I use SeaHash?

When you need a fast hash for a table, when your inputs are trusted, or when you study four-state hash design.

The bottom line

SeaHash explained in one line is this: the ocean-fast hash, a 2016 design of four states and a diffuse step that raced through the Rust world and taught the field that parallelism can hash.

It is proof that a community design can set the pace, and the reason it still matters is that every fast hash designed since has been judged partly by the lesson SeaHash taught.

This article is general information about how SeaHash works, not advice about choosing encryption for a particular device or system.

Latest articles

Scroll to Top