A header-only C++ library of fast, memory-friendly hash maps, sets, and B-tree containers that can replace the std unordered and ordered containers.
Cyan4973/xxHash
A C library for extremely fast non-cryptographic hashing, producing identical 32, 64 and 128-bit hashes across platforms.
- Stars
- 11,410
- Forks
- 946
- Open issues
- 25
- Last commit
- 9 days ago
What is it?
xxHash is a non-cryptographic hash algorithm written in C, aimed at workloads where hashing speed matters, such as hash tables, bloom filters, checksums and data deduplication. It is portable and produces identical results on little-endian and big-endian systems, and its outputs stay stable across releases once finalized.
The library provides XXH32, XXH64 and XXH3, with XXH3 offering both 64-bit and 128-bit (XXH128) variants using vectorized arithmetic. XXH3_64bits() is the recommended default for new applications. The project also includes the xxhsum command line tool for generating and verifying checksums, and a header-only mode via XXH_INLINE_ALL.
xxHash is not suitable for signatures, password storage or any security-sensitive purpose. Its build options cover inlining, endianness, memory access methods, and binary size reduction for embedded or constrained targets.
Key features
- 01Non-cryptographic hashes in 32-bit, 64-bit and 128-bit widths.
- 02Identical output on little-endian and big-endian platforms.
- 03Vectorized XXH3 and XXH128 implementations with AVX2 and SSE2 paths.
- 04Streaming API for hashing inputs of unknown size.
- 05Header-only integration through XXH_INLINE_ALL.
- 06Build macros to shrink binary size or disable features for embedded targets.
Use cases
- Keying entries in hash tables or bloom filters where speed on small inputs matters.
- Computing fast checksums for files with the xxhsum command line tool.
- Detecting duplicate data blocks in storage or deduplication pipelines.
- Embedding a fast hash in performance-sensitive C or C++ applications.
Quick start
- 1
Build the library and xxhsum CLI with make
make - 2
Hash this README file with XXH3 using xxhsum
./xxhsum -H3 README.md
Things to know
- xxHash is not a cryptographic hash and must not be used for signatures or password storage.
- The license is listed as NOASSERTION in the metadata, so check the repository license file before use.
Topics
FAQ
- What is xxHash?
- A C library for extremely fast non-cryptographic hashing, producing identical 32, 64 and 128-bit hashes across platforms. xxHash is a non-cryptographic hash algorithm written in C, aimed at workloads where hashing speed matters, such as hash tables, bloom filters, checksums and data deduplication. It is portable and produces identical results on little-endian and big-endian systems, and its outputs stay stable across releases once finalized.
- Is xxHash free to use? What license does it have?
- xxHash is open source under the Other license. Check the license terms before using it in commercial products.
- Is xxHash still maintained?
- Actively maintained. The last commit to xxHash was on Oct 29, 2026.
- What can I use xxHash for?
- Keying entries in hash tables or bloom filters where speed on small inputs matters. Computing fast checksums for files with the xxhsum command line tool. Detecting duplicate data blocks in storage or deduplication pipelines. Embedding a fast hash in performance-sensitive C or C++ applications.
- How do I install xxHash?
- Build the library and xxhsum CLI with make: make Hash this README file with XXH3 using xxhsum: ./xxhsum -H3 README.md
- Where can I get xxHash?
- The source code and installation instructions are on GitHub: https://github.com/Cyan4973/xxHash
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A test suite that measures the speed and statistical quality of hash functions, with a large table of tested implementations.
A PHP library for representing and manipulating collections, with typed collection and map classes inspired by the Java Collections Framework.
A SIMD- and SWAR-accelerated string library for C, C++, Python, Rust, JavaScript, Go and more, covering search, hashing, sorting and edit distances.
Java library of high-performance data structures and utilities such as primitive collections, off-heap buffers, queues and timer wheels.
A collection of single-file, public domain (or MIT) C/C++ libraries for image loading, font rasterizing, data structures and more.