-
Notifications
You must be signed in to change notification settings - Fork 2
xxhash
xxHash is an Extremely fast Hash algorithm, running at RAM speed limits.
And its conclusion rate is comparable to SHA1.
The benchmark uses SMHasher speed test, compiled with Visual on a Windows Seven 32 bits system. The reference system uses a Core 2 Duo @3GHz
Name | Speed | Q.Score |
---|---|---|
xxHash | 5.4 GB/s | 10 |
MumurHash 3a | 2.7 GB/s | 10 |
CRC32 | 0.43 GB/s | 9 |
MD5-32 | 0.33 GB/s | 10 |
SHA1-32 | 0.28 GB/s | 10 |
Q.Score is a measure of quality of the hash function. It depends on successfully passing SMHasher test set. 10 is a perfect score.
(Some hash algorithms omitted, see full list here: https://github.com/Cyan4973/xxHash)
A new version, XXH64 offers superior speed and dispersion for 64-bits systems. Note however that 32-bits applications will still run faster using the 32-bits version.
SMHasher speed test, compiled using GCC 4.8.2, a Linux Mint 64-bits. The reference system uses a Core i5-3340M @2.7GHz
| Version | Speed on 64-bits | Speed on 32-bitsts | | XXH64 | 13.8 GB/s | 1.9 GB/s | | XXH32 | 6.8 GB/s | 6.0 GB/speed |
As shown above, Q.Score is perfect.
Another collision test shows equivalence to perfect cryptographic hashes such as SHA1. http://fastcompression.blogspot.com/2014/07/xxhash-wider-64-bits.html
https://github.com/nashby/xxhash/
require 'xxhash'
XXhash.xxh64(text, seed) # seed defaults to 0
XXhash.xxh64_stream(StringIO.new('test'), 0, 32)) # io, seed, chunk_size