This is a pure Elixir implementation of xxHash
Add dependency in your mix.exs file:
def deps do
[{:xxhash, "~> 0.3.1"}]
end
Once this is done, execute mix deps.get to fetch and compile elixir-xxhash.
Run with iex -S mix
iex(4)> XXHash.xxh32("")
0
iex(5)> XXHash.xxh32("0")
1212501170
iex(6)> XXHash.xxh32("abcd")
2741253893
iex(7)> XXHash.xxh32("abcde")
2537091483
iex(8)> XXHash.xxh32("xxhash") == XXHash.xxh32("xxhash")
true
iex(9)> XXHash.xxh32("0123456789abcde")
498989583
iex(10)> XXHash.xxh32("0123456789abcdef")
3267648361
iex(11)> XXHash.xxh32("0123456789abcdefg")
3430527511
- This is still work in progress.
- You should consider creating a NIF of xxHash if you require a high performance version.
- (c) 2015, Mykola Konyk
- Original xxHash (c) 2012-2014, Yann Collet
- Distributed under the MS-RL License.