{"id":45068,"date":"2024-01-01T15:06:33","date_gmt":"2024-01-01T15:06:33","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=45068"},"modified":"2024-01-01T15:06:33","modified_gmt":"2024-01-01T15:06:33","slug":"install-xxhash-ubuntu","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2024\/01\/install-xxhash-ubuntu\/","title":{"rendered":"How to Install xxHash for faster hash check in Ubuntu"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/hashbrown-icon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-34980\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/hashbrown-icon-250x250.png\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/hashbrown-icon-250x250.png 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/hashbrown-icon-300x300.png 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/hashbrown-icon-600x600.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/hashbrown-icon-768x768.png 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/hashbrown-icon.png 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>This simple tutorial shows how to install the most recent xxHash for faster hash checking in Ubuntu Linux.<\/p>\n<p>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.<\/p>\n<p>The library includes the following algorithms:<\/p>\n<ul>\n<li><b>XXH32<\/b> : generates 32-bit hashes.<\/li>\n<li><b>XXH64<\/b> : generates 64-bit hashes.<\/li>\n<li><b>XXH3<\/b>\/<b>XXH128<\/b> (since v0.8.0): generates 64 or 128-bit hashes, using vectorized arithmetic.<\/li>\n<\/ul>\n<p>I&#8217;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.<\/p>\n<p><!--more--><\/p>\n<p>It&#8217;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 (<i>to boot via Ventoy<\/i>), and hashing again it can take up to 2 minutes!<\/p>\n<p>I was feeling stupid, until met xxHash. Hash checking can be so fast!<\/p>\n<div style=\"width: 610px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-45068-1\" width=\"610\" height=\"353\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/webm\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-noble.webm?_=1\" \/><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-noble.webm\">https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-noble.webm<\/a><\/video><\/div>\n<p>For advanced users, see the benchmarks (system uses an Intel i7-9700K cpu, and runs Ubuntu x64 20.04).<\/p>\n<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th>Hash Name<\/th>\n<th>Width<\/th>\n<th>Bandwidth (GB\/s)<\/th>\n<th>Small Data Velocity<\/th>\n<th>Quality<\/th>\n<th>Comment<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>XXH3<\/strong>\u00a0(SSE2)<\/td>\n<td>64<\/td>\n<td>31.5 GB\/s<\/td>\n<td>133.1<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td><strong>XXH128<\/strong>\u00a0(SSE2)<\/td>\n<td>128<\/td>\n<td>29.6 GB\/s<\/td>\n<td>118.1<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td><em>memcpy<\/em><\/td>\n<td>N\/A<\/td>\n<td>28.0 GB\/s<\/td>\n<td>N\/A<\/td>\n<td>N\/A<\/td>\n<td><em>for reference<\/em><\/td>\n<\/tr>\n<tr>\n<td>City64<\/td>\n<td>64<\/td>\n<td>22.0 GB\/s<\/td>\n<td>76.6<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>T1ha2<\/td>\n<td>64<\/td>\n<td>22.0 GB\/s<\/td>\n<td>99.0<\/td>\n<td>9<\/td>\n<td>Slightly worse\u00a0<a href=\"https:\/\/github.com\/Cyan4973\/xxHash\/wiki\/Collision-ratio-comparison#collision-study\">collisions<\/a><\/td>\n<\/tr>\n<tr>\n<td>City128<\/td>\n<td>128<\/td>\n<td>21.7 GB\/s<\/td>\n<td>57.7<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td><strong>XXH64<\/strong><\/td>\n<td>64<\/td>\n<td>19.4 GB\/s<\/td>\n<td>71.0<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>SpookyHash<\/td>\n<td>64<\/td>\n<td>19.3 GB\/s<\/td>\n<td>53.2<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>Mum<\/td>\n<td>64<\/td>\n<td>18.0 GB\/s<\/td>\n<td>67.0<\/td>\n<td>9<\/td>\n<td>Slightly worse\u00a0<a href=\"https:\/\/github.com\/Cyan4973\/xxHash\/wiki\/Collision-ratio-comparison#collision-study\">collisions<\/a><\/td>\n<\/tr>\n<tr>\n<td><strong>XXH32<\/strong><\/td>\n<td>32<\/td>\n<td>9.7 GB\/s<\/td>\n<td>71.9<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>City32<\/td>\n<td>32<\/td>\n<td>9.1 GB\/s<\/td>\n<td>66.0<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>Murmur3<\/td>\n<td>32<\/td>\n<td>3.9 GB\/s<\/td>\n<td>56.1<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>SipHash<\/td>\n<td>64<\/td>\n<td>3.0 GB\/s<\/td>\n<td>43.2<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>FNV64<\/td>\n<td>64<\/td>\n<td>1.2 GB\/s<\/td>\n<td>62.7<\/td>\n<td>5<\/td>\n<td>Poor avalanche properties<\/td>\n<\/tr>\n<tr>\n<td>Blake2<\/td>\n<td>256<\/td>\n<td>1.1 GB\/s<\/td>\n<td>5.1<\/td>\n<td>10<\/td>\n<td>Cryptographic<\/td>\n<\/tr>\n<tr>\n<td>SHA1<\/td>\n<td>160<\/td>\n<td>0.8 GB\/s<\/td>\n<td>5.6<\/td>\n<td>10<\/td>\n<td>Cryptographic but broken<\/td>\n<\/tr>\n<tr>\n<td>MD5<\/td>\n<td>128<\/td>\n<td>0.6 GB\/s<\/td>\n<td>7.8<\/td>\n<td>10<\/td>\n<td>Cryptographic but broken<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>How to Install xxHash in Ubuntu<\/h3>\n<p><a href=\"https:\/\/github.com\/Cyan4973\/xxHash\" target=\"_blank\" rel=\"noopener\">xxHash<\/a> is available in Ubuntu repository, but is (or will be) old since the software keeps moving with newer releases.<\/p>\n<p><b>To install xxHash from system repository<\/b>, open terminal (<code>Ctrl+Alt+T<\/code>) and run command:<\/p>\n<pre>sudo apt install xxhash<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-xxhash.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45070\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-xxhash-700x447.webp\" alt=\"\" width=\"610\" height=\"390\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-xxhash-700x447.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-xxhash-300x192.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-xxhash.webp 750w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>For the latest version<\/b> (so far v0.8.2), there are some third-party PPA repositories. And, I use the one from <a href=\"https:\/\/launchpad.net\/~reviczky\" target=\"_blank\" rel=\"noopener\">Adam Reviczky<\/a>, which so far supports <b>Ubuntu 20.04<\/b>, <b>Ubuntu 22.04<\/b>, <b>Ubuntu 23.04<\/b>, and <b>Ubuntu 23.10<\/b><\/p>\n<ul>\n<li>First, press <code>Ctrl+Alt+T<\/code> on keyboard to open terminal. When it opens, run command to add the PPA:\n<pre>sudo add-apt-repository ppa:reviczky\/xxhash<\/pre>\n<p><i>Type user password when it asks (no asterisk feedback) for sudo authentication. Then, hit Enter to continue.<\/i><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-ppa.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45071\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-ppa-700x439.webp\" alt=\"\" width=\"610\" height=\"383\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-ppa-700x439.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-ppa-300x188.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-ppa-768x481.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/xxhash-ppa.webp 822w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/li>\n<li>Then, either launch <b>Software Updater<\/b> to upgrade the tool from version installed from system repository. Or, run command :\n<pre>sudo apt install xxhash<\/pre>\n<p><i>For Linux Mint, run <code>sudo apt update<\/code> first to refresh system package cache.<\/i><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-xxhash.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45072\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-xxhash-700x427.webp\" alt=\"\" width=\"610\" height=\"372\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-xxhash-700x427.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-xxhash-300x183.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-xxhash-768x468.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-xxhash.webp 786w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/li>\n<\/ul>\n<p>After installing the tool, use one of <code>xxh128sum<\/code>, <code>xxh32sum<\/code>, <code>xxh64sum<\/code>, <code>xxhsum<\/code> commands  to do hash checks.<\/p>\n<h3>Uninstall xxHash<\/h3>\n<p>To uninstall xxHash, open terminal (Ctrl+Alt+T) and run command:<\/p>\n<pre>sudo apt remove --autoremove xxhash<\/pre>\n<p>Also remove the PPA (if added), by either &#8220;Software &#038; Updates&#8221; under &#8220;Other Software&#8221; tab, or running command:<\/p>\n<pre>sudo add-apt-repository --remove ppa:reviczky\/xxhash<\/pre>","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":34980,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2120],"class_list":["post-45068","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-hash"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/45068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=45068"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/45068\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/34980"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=45068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=45068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=45068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}