Checksum family

CityHash

Google's fast non-cryptographic string hash, optimised for short strings on x86-64

unverified 1 variant Google CityHash

Overview

CityHash is a family of non-cryptographic hash functions released by Google in 2011, designed for fast hashing of strings on 64-bit processors. It was later succeeded at Google by FarmHash. It provides no security against a deliberate attacker.

CityHash64 uses different code paths depending on input length, with specialised routines for 0–16, 17–32, 33–64 and longer inputs. Each path loads 64-bit words, multiplies them by large constants, rotates, shifts and combines them, and a final mixing step derived from MurmurHash produces the output. Its speed comes from wide loads.

NextSSL includes CityHash64 as an entry wired from source and not yet verified against Google's reference outputs. CityHash versions changed outputs over time, so stored values must be matched with the same version. None of this provides security: the function has no secret key, and anyone can compute or deliberately collide its outputs.

History

2011–2011
  1. CityHash published by Geoff Pike, Jyrki Alakuijala (Google)

Security notes

CityHash is not cryptographic. Seed-independent collisions have been demonstrated, so it is unsuitable for hash tables exposed to adversarial input or for any security purpose.

Typical uses

Hash tables with trusted keysFingerprinting strings for caching

Variants in NextSSL

1
AlgorithmTierSizes (bytes)StandardsAPI
Cityhash
cityhash
unverified out 8 CityHash64 (Google), NON-cryptographic root

Frequently asked questions

Which CityHash variants does NextSSL include?

NextSSL registers 1 CityHash variant: cityhash.