explaingit

cyan4973/xxhash

11,011CAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Ultra-fast hashing library in C that turns data into fingerprints at speeds faster than RAM, built for non-security uses like integrity checks, hash tables, and duplicate detection.

Mindmap

mindmap
  root((xxHash))
    What it does
      Hashes data fast
      Produces fingerprints
      Detects changes
    Variants
      XXH32 32-bit
      XXH64 64-bit
      XXH3 128-bit
    Use cases
      Integrity checks
      Hash tables
      Duplicate detection
    Tech stack
      C language
      Single header
      BSD license
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Check whether a file was corrupted during download by comparing its hash before and after transfer.

USE CASE 2

Build a fast key-value lookup table or cache using XXH3 hashes as bucket keys.

USE CASE 3

Detect duplicate files in a large collection by hashing each file and comparing results.

USE CASE 4

Speed up data deduplication in a backup or storage system without cryptographic overhead.

Tech stack

C

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose including commercial products, as long as you keep the copyright and license notice.

In plain English

xxHash is a hashing library written in C. A hash function takes a piece of data, such as a file or a string of text, and produces a short fixed-length number called a hash. That number acts like a fingerprint: if the data changes even slightly, the hash changes too. Hashes are used constantly in software for things like quickly checking whether data has been corrupted, looking things up in tables, or detecting duplicate files. What sets xxHash apart is speed. The README benchmarks show its fastest variant, XXH3, processing data at roughly 31 gigabytes per second on a modern desktop processor, which is faster than the rate at which that machine can read from RAM. Most well-known hash functions like MD5 or SHA1 are designed with security in mind and run far more slowly, xxHash is not a security tool and makes no claim to be, but for non-security uses (integrity checking, hash tables, caching) it is much faster. The library offers several variants. XXH32 produces a 32-bit hash suited to 32-bit processors, XXH64 produces a 64-bit hash for 64-bit systems, and XXH3 (introduced in version 0.8) produces either 64-bit or 128-bit hashes and is optimized for modern processors using a technique called vectorized arithmetic, which processes multiple values at once. All variants pass an independent test suite called SMHasher that evaluates quality properties such as how evenly the output values are distributed. The code is written in plain C, runs identically on processors with different byte orderings, and is available as either a single header file you drop into a project or a compiled library. It is free to use under a BSD-style license. The README is fairly technical, covering benchmark numbers, build configuration options, and integration instructions. The core use case is simple: any software that needs to hash data quickly and does not need cryptographic security.

Copy-paste prompts

Prompt 1
Show me how to hash a string with xxHash's XXH3 64-bit function in C and print the result as a hex number.
Prompt 2
Write a C program that uses xxhash to check whether two files are identical without reading them byte by byte.
Prompt 3
How do I add xxhash as a single-header dependency in my CMake project and hash an arbitrary byte buffer?
Prompt 4
Compare the throughput of XXH32, XXH64, and XXH3 on a 10 MB buffer in C and print the timings side by side.
Prompt 5
Show me how to use xxhash to build a simple open-addressing hash map in C that maps string keys to integers.
Open on GitHub → Explain another repo

← cyan4973 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.