Checksums and non-cryptographic hashes

Cityhash

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

unverified Root API only Not cryptographic
Unverified tier.

Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.

About Cityhash

Cityhash is a checksum / non-cryptographic hash. It produces an 8-byte (64-bit) output. Its registry entry cites CityHash64 (Google), NON-cryptographic. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).

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

Sizes

FieldBytesMeaning
out8Output

Use it

from nextssl_demo import NextSSL

root = NextSSL(root=True)   # tier 'unverified' is reachable from the root API only
value = root.call("checksum", "cityhash", None, b"123456789")[0]

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Frequently asked questions

What is Cityhash?

Cityhash is a checksum in the CityHash family. CityHash is a family of non-cryptographic hash functions released by Google in 2011, designed for fast hashing of strings on 64-bit processors.

What are the Cityhash sizes?

In NextSSL, Cityhash uses: output 8 bytes.

Who designed Cityhash and when?

Cityhash belongs to the CityHash family, first published in 2011 by Geoff Pike, Jyrki Alakuijala (Google). Its origin: Google CityHash.

Which standards define Cityhash?

Cityhash is referenced by CityHash64 (Google), NON-cryptographic.

Is Cityhash safe to use?

Cityhash is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).