A simple hashing library that implements Blake3 hash function in pure Java. Based on reference implementation with critical part inspired by Scala library.
./gradlew build
final var hasher = new Hasher();
hasher.update(inputBytes);
final var hash = hasher.finalizeHash();
final var key = new byte[] {...};
final var hasher = new Hasher(key);
hasher.update(inputBytes);
final var hash = hasher.finalizeHash();
final var content = "...";
final var hasher = new Hasher(content);
hasher.update(inputBytes);
final var hash = hasher.finalizeHash(expected.length);
Install Blake3 JCA provider:
import cz.aprar.oss.blake3.jca.Blake3Provider;
Security.addProvider(new Blake3Provider());
and then use Blake3 like any other message digests:
final var digest = MessageDigest.getInstance("Blake3");
digest.update(inputBytes);
final var hash = digest.digest();
Alternatively, there is Blake3ExtendedHashSize
digest with hash size 131 bytes instead of standard 32 bytes.
JCA provider- SIMD vectorized implementation
- Benchmarks
This library is licensed under the Apache 2.0 License.