Friday, March 1, 2024
HomeHow toHow to Install xxHash for faster hash check in Ubuntu

How to Install xxHash for faster hash check in Ubuntu

This simple tutorial shows how to install the most recent xxHash for faster hash checking in Ubuntu Linux.

xxHash is extremely fast non-cryptographic hash algorithm, working at RAM speed limit. It can be useful to check integrity for large amounts of data, index data, and/or used in cryptographic applications like digital signatures.

The library includes the following algorithms:

  • XXH32 : generates 32-bit hashes.
  • XXH64 : generates 64-bit hashes.
  • XXH3/XXH128 (since v0.8.0): generates 64 or 128-bit hashes, using vectorized arithmetic.

I’m new to hash algorithm, but doing hash check regularly when trying out different Linux distributions. And I use sha256, since the most sites provide sha256sum files for the hash code of their disco images.

It’s OK for me to run sha256sum for file in SSD, which takes around 20 seconds to print hash code for a 4 GB iso image. But after moving to USB stick (to boot via Ventoy), and hashing again it can take up to 2 minutes!

I was feeling stupid, until met xxHash. Hash checking can be so fast!

For advanced users, see the benchmarks (system uses an Intel i7-9700K cpu, and runs Ubuntu x64 20.04).

Hash NameWidthBandwidth (GB/s)Small Data VelocityQualityComment
XXH3 (SSE2)6431.5 GB/s133.110
XXH128 (SSE2)12829.6 GB/s118.110
memcpyN/A28.0 GB/sN/AN/Afor reference
City646422.0 GB/s76.610
T1ha26422.0 GB/s99.09Slightly worse collisions
City12812821.7 GB/s57.710
XXH646419.4 GB/s71.010
SpookyHash6419.3 GB/s53.210
Mum6418.0 GB/s67.09Slightly worse collisions
XXH32329.7 GB/s71.910
City32329.1 GB/s66.010
Murmur3323.9 GB/s56.110
SipHash643.0 GB/s43.210
FNV64641.2 GB/s62.75Poor avalanche properties
Blake22561.1 GB/s5.110Cryptographic
SHA11600.8 GB/s5.610Cryptographic but broken
MD51280.6 GB/s7.810Cryptographic but broken

How to Install xxHash in Ubuntu

xxHash is available in Ubuntu repository, but is (or will be) old since the software keeps moving with newer releases.

To install xxHash from system repository, open terminal (Ctrl+Alt+T) and run command:

sudo apt install xxhash

For the latest version (so far v0.8.2), there are some third-party PPA repositories. And, I use the one from Adam Reviczky, which so far supports Ubuntu 20.04, Ubuntu 22.04, Ubuntu 23.04, and Ubuntu 23.10

  • First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to add the PPA:
    sudo add-apt-repository ppa:reviczky/xxhash

    Type user password when it asks (no asterisk feedback) for sudo authentication. Then, hit Enter to continue.

  • Then, either launch Software Updater to upgrade the tool from version installed from system repository. Or, run command :
    sudo apt install xxhash

    For Linux Mint, run sudo apt update first to refresh system package cache.

After installing the tool, use one of xxh128sum, xxh32sum, xxh64sum, xxhsum commands to do hash checks.

Uninstall xxHash

To uninstall xxHash, open terminal (Ctrl+Alt+T) and run command:

sudo apt remove --autoremove xxhash

Also remove the PPA (if added), by either “Software & Updates” under “Other Software” tab, or running command:

sudo add-apt-repository --remove ppa:reviczky/xxhash

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here


spot_img

Most Popular