xxhash
Version, currently master branch1 version
- master branchlatestFeb 11, 2018
github.com/repomaa/xxhash-crystal
Crystal bindings for xxHash - an extremely fast non-cryptographic hashing algorithm
Installation
# Add this to your shard.yml
dependencies:
xxhash:
github: repomaa/xxhash-crystal
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Joakim Reinert
- Targets
xxhashfrom src/xxhash.crbenchmarkfrom src/benchmark.cr
Dependencies
This version declares no dependencies.
README
xxhash-crystal
These are the crystal bindings for xxHash
- An extremely fast non-cryptographic hash algorithm
Installation
Add this to your application's shard.yml:
dependencies:
xxhash:
github: jreinert/xxhash-crystal
Usage
This library provides bindings for both the 64 and 32 bit version of xxHash
They are accessed through the modules XXHash32 and XXHash64 respectively.
You should use the one that matches your cpu architecture.
require "xxhash"
# Pass a nn-bit seed
seed = (Random::Secure.random_bytes(8).to_unsafe.as(UInt64*)).value
puts XXHash64.hex_digest("foobar", seed)
# Or use 0 by default
puts XXHash64.hex_digest("foobar")
# Stream data
XXHash64.open(seed) do |digester|
IO.copy(some_io, digester)
puts digester.hex_digest
end
Benchmarks
Run with make bench. Set the DATA_SIZE_GIB environment variable to alter
used data size.
Hashing 16GiB of (semi)random data
user system total real
XXHash32 4.250000 0.000000 4.250000 ( 4.247582)
XXHash64 2.410000 0.000000 2.410000 ( 2.413591)
Contributing
- Fork it ( https://github.com/jreinert/xxhash/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- jreinert Joakim Reinert - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Feb 11, 2018
- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/repomaa/xxhash-crystal
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 1