--- id: cityhash version: "0.4.10" license: MIT license_treatment: permissive maintenance: aging --- # cityhash — Python bindings for CityHash and FarmHash License: permissive · Maintenance: aging · Downloads: 406.4K/mo ## 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 above — 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 pip install cityhash uv add cityhash 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_current - Install friction: medium - Maintenance: aging - Downloads: 406.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags fast non-cryptographic hashing, cityhash python wrapper, google hash functions, numpy array hashing, buffer protocol hashing, hardware-independent fingerprints, distributed computing hash, non-cryptographic-hashing, numpy-compatible, distributed-systems [View on SkillFed](https://skillfed.io/packages/cityhash) · [View on PyPI](https://pypi.org/project/cityhash/)