Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KmuCbukmnH9zJJPoxX3tGo
Codecov Report✅ All modified and coverable lines are covered by tests.
|
Closed
Member
Author
|
Resolves #18 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds BLAKE3 with all three of its modes, following Blake2b's API shape:
Blake3Hash(lib/src/algorithms/blake3.dart) implements the full tree mode: 1024-byte chunks, a chaining-value stack, and root output with an increasing counter for extended output.CHUNK_END, andROOTwhen only one chunk exists)._32bit/_64bittwin. The 64-bit chunk counter is split with division rather than shifts, which keeps it exact on dart2js.lib/src/blake3.dart):blake3(const),Blake3,.of(),.mac/Blake3MAC,.deriveKey()andblake3sum()package:hashliband registered in the (deprecated) registry.ArgumentError.Test vectors (official, nothing invented)
test/fixures/blake3_vectors.dartis generated from the BLAKE3 team's officialtest_vectors/test_vectors.json, with its URL and SHA-256 recorded in the header.vm-only, so the same vectors run on node and dart2wasm.bind()on a stream, checked against an official vectorreset()Verification
dart format --output=none --set-exit-if-changed .makes no changesdart analyze --fatal-infosreports no issuesdart test -p vm: all tests pass (113 new)dart test -p node: all tests passdart test -P wasm: all tests passbash scripts/coverage.shreports 100% oflib/covered (6163/6163 lines)Benchmark (
benchmark/blake3.dart, compiled exe, cloud container, not the reference machine). BLAKE2s and SHA-256 are hashlib's own, for context:This is a scalar implementation with no SIMD or multithreading, so it runs at about BLAKE2s speed. Tiny inputs pay for setting up the chaining-value stack. Not wired into the aggregator;
BENCHMARK.mdis untouched.Notes
HKDFkey derivation function (RFC 5869) #46: this PR and the HKDF PR (AddHKDFkey derivation function (RFC 5869) #46) both edit the same "Batteries included" line in the README. Whichever merges second will need that line resolved, keeping both additions.BLAKE3with hashing, keyed hashing (blake3.mac), key derivation (blake3.deriveKey) and extendable output (blake3.of)".Generated by Claude Code