Blake3 using the official BLAKE3 c implementation.
- Fast. ~2x faster than Sodium::Digest::Blake2b.
- Uses Crystal's Digest API.
- Keyed digests.
- Key derivation.
- Configurable final size.
- Streaming final output.
- Tested against official test vectors.
- Builds a blake3 c static library.
examples/blake3_hash.cr is approximately the same speed as b3sum with 1 thread or mmap disabled.
-
Add the dependency to your
shard.yml
:dependencies: blake3: github: didactic-drunk/blake3.cr
-
Run
shards install
require "blake3"
digest = Digest::Blake3.new
digest.update data
p digest.final.hexstring
output_size = 1024
digest = Digest::Blake3.new(output_size)
digest.update data
p digest.final.hexstring => ...a.very.long.string...
digest = Digest::Blake3.new(key: "super secret exactly 32 byte key")
digest.update data
p digest.final.hexstring
For further API documentation see Crystal's Digest API
- Fork it (https://github.com/didactic-drunk/blake3/fork)
- Install a formatting check git hook (ln -sf ../../scripts/git/pre-commit .git/hooks)
- 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
- Didactic Drunk - creator and maintainer