A C++17 port of the extremely fast xxHash non-cryptographic hash algorithm.
xxhash_cpp is a C++17 port of the xxHash library, an extremely fast non-cryptographic hash algorithm designed for high-performance computing scenarios. It provides both 32-bit and 64-bit hash functions that operate at RAM speed limits, solving the need for rapid data hashing in applications like checksums, hash tables, and data deduplication. The library maintains perfect compatibility with the original C implementation while offering a modern, type-safe C++ interface.
C++ developers working on performance-critical applications that require fast hashing, such as game engines, database systems, network protocols, and data processing pipelines. System programmers who need consistent cross-platform hash results will particularly benefit.
Developers choose xxhash_cpp for its exceptional speed (benchmarked as the fastest in its class), simple single-header integration, and guaranteed platform consistency. Unlike other hash libraries, it provides both streaming and one-shot interfaces with comprehensive STL support while maintaining perfect SMHasher quality scores.
Port of the xxhash library to C++17.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks at 5.4 GB/s for 32-bit and 13.8 GB/s for 64-bit hashes, making it significantly faster than alternatives like MurmurHash3 or CRC32, as per the SMHasher test results.
Produces identical hash values across all platforms (little/big endian) by default, ensuring reliable results in distributed or cross-platform applications without extra handling.
Offers a type-safe interface with support for STL containers, iterators, and streaming via hash_state_t, simplifying integration into C++17 codebases with flexible overloads.
Provided as a standalone header file (xxhash.hpp) for static linking, eliminating the need for complex build systems or external dependencies.
Requires modern compilers like MSVC 2017.3 or gcc 7, excluding projects with older toolchains that cannot upgrade, as noted in the compatibility table.
Only supports 32-bit and 64-bit hash outputs via templates, with no built-in options for 128-bit or custom hash lengths, which may restrict advanced use cases.
Performance optimizations rely on non-standard macros like XXH_FORCE_MEMORY_ACCESS for unaligned reads, which can introduce portability issues and require careful tuning.