Skip to content

Add BLAKE2s and BLAKE2sp C# implementation with tests#88

Open
coderb wants to merge 2 commits into
BLAKE2:masterfrom
coderb:master
Open

Add BLAKE2s and BLAKE2sp C# implementation with tests#88
coderb wants to merge 2 commits into
BLAKE2:masterfrom
coderb:master

Conversation

@coderb

@coderb coderb commented Mar 27, 2026

Copy link
Copy Markdown
  • 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
@coderb coderb closed this Mar 27, 2026
- 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
@coderb coderb reopened this Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant