Add BLAKE2s and BLAKE2sp C# implementation with tests#88
Open
coderb wants to merge 2 commits into
Open
Conversation
coderb
commented
Mar 27, 2026
- Migrate all .csproj files to SDK-style targeting net10.0
- Add Blake2SCore, Blake2SHasher, Blake2S (sequential BLAKE2s)
- Add Blake2SpHasher, Blake2Sp (parallel BLAKE2s, 8 leaves)
- Add Blake2SConfig, Blake2STreeConfig
- Add ConfigS/ConfigSSetNode to Blake2IvBuilder
- Add KAT-based tests for Blake2S and Blake2Sp (256 unkeyed + 256 keyed each)
- Add Blake2SpHash console app (file hasher, matches C reference output)
- Add csharp/.gitignore for bin/obj build output
- Migrate all .csproj files to SDK-style targeting net10.0 - Add Blake2SCore, Blake2SHasher, Blake2S (sequential BLAKE2s) - Add Blake2SpHasher, Blake2Sp (parallel BLAKE2s, 8 leaves) - Add Blake2SConfig, Blake2STreeConfig - Add ConfigS/ConfigSSetNode to Blake2IvBuilder - Add KAT-based tests for Blake2S and Blake2Sp (256 unkeyed + 256 keyed each) - Add Blake2SpHash console app (file hasher, matches C reference output) - Add csharp/.gitignore for bin/obj build output
- Add ReadOnlySpan<byte> overloads throughout the input path: Blake2SCore.HashCore, Blake2SHasher.Update, Blake2SpHasher.Update, Blake2S.ComputeHash, Blake2Sp.ComputeHash, Hasher.Update (virtual) - byte[] overloads retained for compatibility; delegate to span versions - Blake2SCore-Compress: use MemoryMarshal.Cast on little-endian instead of Buffer.BlockCopy; span indexing on big-endian - Blake2SCore.HashFinal: add Span<byte> output overload as primary; LE fast path uses MemoryMarshal.Cast for output; padding uses AsSpan().Clear() - Blake2SpHasher.Finish: stackalloc leaf hash buffers (eliminates 8 x 32B heap allocations per BLAKE2sp call) - Blake2SHasher.Finish: stackalloc intermediate buffer for truncated output
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.