LinuxCommandLibrary

xxhsum

Calculate and verify XXH64 checksums

TLDR

Calculate the checksum for a file using a specific algorithm

$ xxhsum -H[0|32|64|128] [path/to/file]
copy

Run benchmark
$ xxhsum -b
copy

SYNOPSIS

xxhsum [OPTION]... [FILE]...
xxhsum -c [FILE]

PARAMETERS

-b, --binary
    Read files in binary mode. This is the default on most systems.

-c, --check
    Read XXH sums from the specified FILEs (or standard input if no file is given) and verify them.

-q, --quiet
    Do not print OK for each successfully verified file when checking.

-s, --size=
    Specify the output hash size in bits. Common values are 32, 64 (often default), or 128.

--xxh32
    Force the use of the XXH32 algorithm, producing a 32-bit hash.

--xxh64
    Force the use of the XXH64 algorithm, producing a 64-bit hash.

--xxh3
    Force the use of the XXH3 algorithm, which is even faster than XXH64 and can produce 64-bit or 128-bit hashes depending on --size.

--xxh128
    Force the use of the XXH128 algorithm, producing a 128-bit hash (internally uses XXH3 with 128-bit output).

-V, --version
    Output version information and exit.

-h, --help
    Display a help message and exit.

DESCRIPTION

xxhsum is a command-line utility used to compute and verify Extremely Fast Hash (XXH) checksums for files or standard input. Developed as part of the xxhash library by Yann Collet, its primary advantage is its exceptional speed, significantly outperforming cryptographic hash functions like MD5 or SHA-256, while still offering excellent collision resistance for non-cryptographic applications. It's ideal for tasks requiring quick data integrity checks, such as verifying large file transfers, ensuring file consistency after a copy, or rapidly comparing files.

Unlike cryptographic hashes, xxhsum is not designed to be cryptographically secure and should not be used for security-sensitive applications where malicious tampering is a concern. It supports various XXH algorithms, including XXH32, XXH64, XXH3 (typically 64-bit or 128-bit), and XXH128, allowing users to choose the desired hash size and performance characteristics. The output format is similar to other *sum utilities, displaying the hash value followed by the filename. It also includes a robust checking mode to verify previously generated checksums.

CAVEATS

xxhsum is explicitly designed for speed, not cryptographic security. While it offers excellent collision resistance for general data integrity checks, it is significantly easier to find collisions for XXH hashes than for cryptographic hashes like SHA-256. Therefore, it should never be used in security-critical applications where protection against malicious tampering or deliberate hash collisions is required.

PERFORMANCE CHARACTERISTICS

The primary design goal of the XXH algorithms is extreme speed. They leverage modern CPU architectures and instruction sets to process data at very high throughputs, often exceeding gigabytes per second. This makes xxhsum particularly suitable for environments where large volumes of data need quick integrity checks without the overhead of cryptographic hashing.

COMMON USE CASES

xxhsum excels in scenarios such as:

  • Verifying large file transfers or backups.
  • Rapidly comparing file contents to detect accidental corruption or changes.
  • Checksumming data in high-performance computing (HPC) environments.
  • Use in caching systems or hash tables where quick and reliable key generation is needed.
It provides a strong guarantee of accidental data corruption detection.

HISTORY

The xxhsum utility is part of the xxhash library, an extremely fast hash algorithm developed by Yann Collet. Introduced to address the need for very high-speed, non-cryptographic hashing, xxhash (and by extension xxhsum) gained popularity in areas like game development, data processing, and large-scale file synchronization where performance is paramount and cryptographic guarantees are not required. Its development aimed to provide a faster alternative to traditional checksum utilities for data integrity verification.

SEE ALSO

md5sum(1), sha1sum(1), sha256sum(1), cksum(1)

Copied to clipboard