FarmHash explained in plain terms means understanding the family of fast hashes that Google built to fingerprint data at scale, a set of functions from 2014 that replaced the older CityHash in the company’s own systems. The central question is why a company that already had a fast hash would build another one, and the answer is that FarmHash squeezes more speed out of modern processors by using the AES instructions built into them, so it hashes strings faster than anything before it, and that speed is the whole point of the design.
FarmHash is a family of non-cryptographic hash functions designed by Geoff Pike at Google and released in 2014, producing 32, 64 or 128-bit digests. It turns a message of any length into a fixed fingerprint with a set of variants tuned for different machines, and it is built on the idea that one hash family can cover every size of input, which means the design has a variant for short strings, long strings and everything between, and that coverage is what makes it unlike a single fixed hash.
This article makes the case for FarmHash, explains what it is, how it works, and where its ideas still earn their keep.
Key takeaways
- FarmHash is a hash family from Google, released in 2014.
- It was designed by Geoff Pike as the successor to CityHash.
- It produces 32, 64 or 128-bit digests.
- It uses AES instructions on modern processors for speed.
- It is used in hash tables and data systems today.
What FarmHash is
FarmHash is a hash that turns data into fingerprints at the speed of the machine it runs on, and that tuning is what makes it unusual among fast hashes. A programmer picks the variant that matches the processor, and the hash runs at full speed, which means the same family serves old machines and new ones alike, and that flexibility is what let Google deploy it everywhere.
Its signature feature is the variant set. Most hashes are one fixed recipe, but FarmHash offers several, with names like farmhashna for machines with AES instructions and farmhashnt for machines without, which means the design adapts to the hardware, and because the right variant is always available, no machine pays for instructions it lacks.
The design was a reaction to the limits of CityHash. CityHash was fast in its day, but processors gained AES instructions that a hash could exploit, so Pike built a successor that used them, because a hash that ignores the newest instructions leaves speed on the table, and that practicality is what made FarmHash worth writing.
It became one of the best-known fast hashes in the world, and it is named in every discussion of hashing at scale. FarmHash fingerprints the data inside Google’s systems, it is copied into hash libraries everywhere, and it is still the first example engineers meet when they learn that a hash family can beat a single hash, which means the design survives as infrastructure even though it never became a standard.
Its most famous property is its short-string speed. FarmHash has special fast paths for tiny inputs, which means a hash table key of a few bytes is fingerprinted in a handful of operations, and because short keys dominate real programs, that care for the small case is the reason it feels fast in practice.
Our guide to MurmurHash explains the earlier fast hash FarmHash had to beat, and our guide to xxHash explains the rival that wins on raw speed today.
How FarmHash works
Everything starts with the length, because FarmHash chooses its path by how much data there is. A short input takes a fast path with a few multiplications, a long input takes a loop that processes many bytes at once, which means the hash never wastes work on a tiny key, and because the choice is made up front, the design is fast at every size.
Each word begins with mixing, which spreads the input across the state. FarmHash takes 64-bit words from the message and multiplies them by large odd constants, which means every word is scrambled thoroughly, and because multiplication spreads bits from low to high, the mixing reaches the whole word in one step.
The AES instructions are what make the design work as a whole. On modern processors, the farmhashna variant runs the input through AES rounds, which means the hash borrows the cipher’s excellent mixing for free, and because AES instructions run in a single cycle, the mixing costs almost nothing.
The short paths spread the effect further. For inputs under sixteen bytes, FarmHash reads the whole message in one or two loads and mixes it directly, which means a tiny key is hashed without any loop at all, and because most hash table keys are short, that path is the one that matters most in practice.
The finalisation is what turns the state into a digest. After the last word, FarmHash runs the state through extra mixing steps with no new input, which means the digest depends on the whole message and nothing else, and because the final steps are the same as the mixing steps, the design needs no special finishing step.
The digest comes from the final state, read out as 32, 64 or 128 bits. FarmHash outputs part of its wide state as the fingerprint, which means the result fits whatever field needs it, and that size is exactly what a hash table or a database index needs for its lookup key.

Comparing FarmHash with other fast hashes
FarmHash is one of several fast hashes built for real programs, and each was built with a different emphasis. MurmurHash is the older general-purpose fast hash, xxHash is the newer one that wins on raw speed, and FarmHash is the one that tunes itself to the processor with a family of variants, while each approach trades something for something else.
The table below sets out the main contrasts between the leading approaches.
| Aspect | FarmHash | MurmurHash | xxHash |
|---|---|---|---|
| Variants | Family, per processor | Two main versions | One main design |
| AES use | Yes, in farmhashna | No | No |
| Digest size | 32, 64 or 128 bits | 32 or 128 bits | 32, 64 or 128 bits |
| Year | 2014 | 2008 | 2012 |
| Best for | Google-scale data | General hashing | Raw speed |
The practical result is that FarmHash is the right choice for Google-scale data, MurmurHash suits general hashing, and xxHash fits raw speed instead.
Where FarmHash is used
Data systems use it to fingerprint records at scale. A database that hashes billions of keys needs a hash that never becomes the bottleneck, because a slow hash slows every lookup, and that pressure is the reason FarmHash earns its keep in storage engines.
Hash tables use it for fast lookups. A program that stores short string keys wants a hash with a fast path for tiny inputs, because most keys are only a few bytes long, and that care for the small case is the reason FarmHash feels quick in everyday code.
Networking uses it to fingerprint packets and flows. A proxy that tracks connections hashes addresses and ports millions of times a second, because each packet needs a lookup, and that volume is the reason a tuned hash matters in network code.
Research uses it as a case study in hardware-aware design. Engineers still cite FarmHash when they discuss how AES instructions can serve hashing, because it is the clearest example of the idea in a real design, and that lesson shapes how new hashes are judged today.
Teaching uses it as the family example. Courses introduce FarmHash when they explain that one hash cannot fit every machine, because it is the clearest case of a family beating a single design, and a student who understands FarmHash understands why variants exist.
Strengths and limits
The greatest strength of FarmHash is its tuning. A family of variants means every processor gets a hash built for it, and that strength is real, measured in benchmarks across old and new machines and confirmed by the systems that adopted it.
It is also a strength that the design is simple to use. A caller picks a variant and a digest size and gets a fingerprint, and that simplicity is worth more than cleverness in a field where a hash nobody can call correctly is a hash nobody adopts.
The limits are real, though, and the biggest is that it is not cryptographic. FarmHash is built for speed, not for resisting a determined attacker, which means it must never guard secrets or signatures, and a system that needs real security must use a cryptographic hash instead.
FarmHash checklist
- Use FarmHash for fingerprinting, never for security or passwords.
- Remember it is a family, so pick the variant for your processor.
- Note farmhashna needs AES instructions to run at full speed.
- Compare it with MurmurHash to see the tuning trade-off.
- Study the short-input paths, which matter most in practice.
- Check the digest size your table or index actually needs.
- Keep real digests behind standard hashes for signatures.
- Read the 2014 design notes to see why it replaced CityHash.
- Choose xxHash when raw speed matters more than tuning.
Frequently asked questions
What is FarmHash in simple terms?
It is a 2014 family of fast hashes from Google, with variants tuned for different processors, built to fingerprint data at scale.
Who designed FarmHash?
Geoff Pike at Google, who released it in 2014 as the successor to CityHash.
How is FarmHash different from CityHash?
Both are Google hashes, but FarmHash adds variants that use AES instructions and fast paths for short inputs, so it runs faster on modern processors.
Is FarmHash still secure?
It is fast and well distributed, but it is not a cryptographic hash, so it must never guard secrets, signatures or passwords.
Where is FarmHash used?
In data systems, in hash tables, in network code, and in research on fast hashing.
When should I use FarmHash?
When you fingerprint large volumes of data, when your keys are short, or when you want a hash tuned to your processor.
The bottom line
FarmHash explained in one line is this: the tuned hash family, a 2014 design that matched itself to the processor and showed a family of hashes can beat any single one.
It is proof that knowing the hardware pays off, and the reason it still matters is that every fast hash designed since has been judged partly by the lesson FarmHash taught.
This article is general information about how FarmHash works, not advice about choosing encryption for a particular device or system.







