skillfed

cityhash

Python bindings for CityHash and FarmHash

cityhash v0.4.10 406.4K downloads/30d#6,897 on PyPI46
Permissive license MIT AGING released

What it is and what it does

Cityhash is a Python binding to Google's CityHash and FarmHash algorithms—a family of fast, non-cryptographic hash functions designed for speed rather than cryptographic security. It exposes multiple bit-width variants (32, 64, 128) under separate namespaces and supports hardware-independent fingerprints that remain consistent across platforms, making them suitable for distributed systems that need to persist hashed values. The package can hash any object that implements Python's buffer protocol without copying data to memory.

The package is built from compiled C++ bindings and ships pre-built wheels for major platforms and Python versions, reducing installation friction. It explicitly does not support incremental hashing. On x86-64 systems, wheels include SSE4.2 optimizations that significantly accelerate certain hash variants, though the vanilla CityHash functions do not benefit from these instructions.

Use it for:

  • Hash large NumPy arrays efficiently without copying data in machine learning or scientific computing pipelines.
  • Generate hardware-independent fingerprints for distributed caching or load-balancing systems needing consistent hashes across machines.
  • Fast non-cryptographic hashing in high-throughput applications where speed matters more than cryptographic strength.
  • Implement consistent hashing for data partitioning in distributed databases or key-value stores.
  • Hash fixed-size data structures in performance-critical sections where cryptographic guarantees are unnecessary.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Python wrapper for Google's CityHash and FarmHash non-cryptographic hash functions, offering 32-, 64-, and 128-bit implementations with support for hardware-independent fingerprints and fast hashing of buffer-protocol objects like NumPy arrays.

Yes, if you need fast non-cryptographic hashing with buffer-protocol support and don't require incremental hashing. Pre-built wheels and broad platform coverage make installation straightforward. The aging maintenance status (309 days since release) is a minor concern but not a blocker—the package is stable with no known vulnerabilities. Skip it if you need cryptographic hashing or streaming/incremental hashing.

Install

cityhash on PyPI

pip

pip install cityhash

uv

uv add cityhash

poetry

poetry add cityhash

Installing cityhash

Before you install

Medium install friction due to compiled C++ bindings; wheels are pre-built for common platforms (Windows, macOS, Linux x86_64 and ARM64) across Python 3.10–3.13, reducing compilation overhead. Repository shows aging maintenance (309 days since last release) but remains stable.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely in both open-source and proprietary projects with minimal restrictions.

Quickstart

pip install cityhash

from cityhash import CityHash64
result = CityHash64("abc")
print(result)

Requires Python 3.6 or later; buffer-protocol objects like NumPy arrays must be contiguous.

Verify before relying

  • Whether SSE4.2 support on x86-64 platforms is automatically detected and used at runtime.
  • Performance characteristics compared to other non-cryptographic hash libraries in real-world workloads.
  • Whether the aging maintenance status affects bug-fix responsiveness or security patching.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance aging — 309 days since the last release
Last repo commit
First released
Downloads 406,355/month — #6,897 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cityhash-0.4.10-cp310-cp310-macosx_10_9_x86_64.whl; cityhash-0.4.10-cp310-cp310-macosx_11_0_arm64.whl; cityhash-0.4.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cityhash-0.4.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cityhash-0.4.10-cp310-cp310-win32.whl; cityhash-0.4.10-cp310-cp310-win_amd64.whl; cityhash-0.4.10-cp311-cp311-macosx_10_9_x86_64.whl; cityhash-0.4.10-cp311-cp311-macosx_11_0_arm64.whl; cityhash-0.4.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cityhash-0.4.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cityhash-0.4.10-cp311-cp311-win32.whl; cityhash-0.4.10-cp311-cp311-win_amd64.whl; cityhash-0.4.10-cp312-cp312-macosx_10_13_x86_64.whl; cityhash-0.4.10-cp312-cp312-macosx_11_0_arm64.whl; cityhash-0.4.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cityhash-0.4.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cityhash-0.4.10-cp312-cp312-win32.whl; cityhash-0.4.10-cp312-cp312-win_amd64.whl; cityhash-0.4.10-cp313-cp313-macosx_10_13_x86_64.whl; cityhash-0.4.10-cp313-cp313-macosx_11_0_arm64.whl

Keywords: google, hash, hashing, cityhash, farmhash, murmurhash, cython

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: C++Programming Language :: CythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Information AnalysisTopic :: Software Development :: LibrariesTopic :: System :: Distributed Computing

Tags

fast non-cryptographic hashingcityhash python wrappergoogle hash functionsnumpy array hashingbuffer protocol hashinghardware-independent fingerprintsdistributed computing hash
non-cryptographic-hashingnumpy-compatibledistributed-systems

More Libraries packages