Skip to content

feat(xof): add IXOFStream continuous-squeeze API across all XOFs#79

Merged
Xor-el merged 1 commit into
masterfrom
feature/xof-continuous-squeeze
Jun 18, 2026
Merged

feat(xof): add IXOFStream continuous-squeeze API across all XOFs#79
Xor-el merged 1 commit into
masterfrom
feature/xof-continuous-squeeze

Conversation

@Xor-el

@Xor-el Xor-el commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Core design:

  • New IXOFStream (public) and IXofReader (internal "engine") interfaces.
  • Extract the squeeze core of each algorithm family into a self-contained IXofReader engine (TKeccakXofReader, TBlake2XSXofReader, TBlake2XBXofReader; Blake3's reader renamed to TBlake3XofReader).
  • Each algorithm is now a single class implementing both IXOF and IXOFStream over the shared engine, so DoOutput/Squeeze delegate to one squeeze implementation instead of duplicating it. KMAC fix:
  • Fix a latent bug where RightEncode(0) was re-appended on every DoOutput for KMAC-XOF, corrupting multi-chunk output. RightEncode is now applied exactly once per Initialize via EnsureRightEncodeAppended.
  • Fix bit-alignment check typo in TKMAC*XOF.SetXOFSizeInBitsInternal ((LXofSizeInBytes and $7) -> (AXofSizeInBits and $7)). Blake2X streaming:
  • Unbounded mode is selected via the spec's reserved "unknown length" marker, encapsulated in TBlake2XS.CreateBlake2XSXofStream / TBlake2XB.CreateBlake2XBXofStream so callers never touch the sentinel.

Core design:
- New IXOFStream (public) and IXofReader (internal "engine") interfaces.
- Extract the squeeze core of each algorithm family into a self-contained
  IXofReader engine (TKeccakXofReader, TBlake2XSXofReader,
  TBlake2XBXofReader; Blake3's reader renamed to TBlake3XofReader).
- Each algorithm is now a single class implementing both IXOF and
  IXOFStream over the shared engine, so DoOutput/Squeeze delegate to one
  squeeze implementation instead of duplicating it.
KMAC fix:
- Fix a latent bug where RightEncode(0) was re-appended on every DoOutput
  for KMAC-XOF, corrupting multi-chunk output. RightEncode is now applied
  exactly once per Initialize via EnsureRightEncodeAppended.
- Fix bit-alignment check typo in TKMAC*XOF.SetXOFSizeInBitsInternal
  ((LXofSizeInBytes and $7) -> (AXofSizeInBits and $7)).
Blake2X streaming:
- Unbounded mode is selected via the spec's reserved "unknown length"
  marker, encapsulated in TBlake2XS.CreateBlake2XSXofStream /
  TBlake2XB.CreateBlake2XBXofStream so callers never touch the sentinel.
@Xor-el Xor-el merged commit 42a19f3 into master Jun 18, 2026
24 checks passed
@Xor-el Xor-el deleted the feature/xof-continuous-squeeze branch June 18, 2026 20:42
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