Hash Lab

Non-cryptographic

CityHash & FarmHash

Two generations of Google’s fast string-hash families. CityHash(Geoff Pike & Jyrki Alakuijala, 2011) was designed as a faster, better-distributed Murmur with platform-specific paths. FarmHash (2014) refined the architecture, exposed cleaner APIs (Hash64, Hash128), and added CPU-feature-dispatch wrappers.

At a glance

Output32, 64, 128, or 256 bits depending on call
Throughput~7–15 GiB/s on modern CPUs
Year2011 (CityHash), 2014 (FarmHash)
StandardNone; reference impl on GitHub (google/cityhash, google/farmhash)
StatusNon-cryptographic; superseded for raw speed by xxHash3

Where they are used

Differences vs MurmurHash

And vs xxHash3?

xxHash3 (2019) is faster on most modern CPUs and has cleaner SIMD scalability. CityHash / FarmHash remain in production for legacy reasons and for inter-product reproducibility with Google’s ecosystem.

References

Quick quiz

Test yourself on cityhash-farmhash

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

  1. Q1.Who designed CityHash and FarmHash?

  2. Q2.Are CityHash and FarmHash cryptographic?

  3. Q3.Which CPU instruction did CityHash exploit on x86?

  4. Q4.Which is the typical FarmHash output size?

  5. Q5.Which database exposes CityHash as a SQL function?

  6. Q6.FarmHash vs CityHash main improvement:

  7. Q7.Why use CityHash/FarmHash today over xxHash3?

  8. Q8.Are CityHash outputs stable across CPU instructions?

  9. Q9.FarmHash's documented API includes which method?

  10. Q10.Is FarmHash/CityHash safe against hash flooding?

0 of 10 answered