Skip to content

ensure valid cSHAKE length#46

Closed
panva wants to merge 1 commit into
WICG:mainfrom
panva:cshake-length
Closed

ensure valid cSHAKE length#46
panva wants to merge 1 commit into
WICG:mainfrom
panva:cshake-length

Conversation

@panva

@panva panva commented Dec 9, 2025

Copy link
Copy Markdown
Collaborator

Ensure's valid cSHAKE length in our op steps.

Originally posted by @panva in #41 (comment)


Preview | Diff

@twiss

twiss commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator

Section 3 of NIST-SP800-185 says:

When the requested output length is zero, i.e., L=0, cSHAKE, KMAC, TupleHash, and ParallelHash return the
empty string as the output.

So, I would prefer to just follow that rather than forbidding it here.

Additionally, the output length parameter is defined as a number of bits, and the output is well-defined in that case. However, we don't clearly define what to do here, since we return a byte sequence rather than a bit sequence. But, we already have a convenient helper for that, namely a byte sequence containing a bit sequence. So, we can just use that instead of forbidding this as well, IMHO. I'll write a patch for that.

@panva

panva commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator Author

cc @Frosne as this was originally your request for turboshake

@Frosne

Frosne commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Ok!

@twiss

twiss commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator

(Closing in favor of #51, but let me know if there are any objections to the text there ofc 😊)

@twiss twiss closed this Feb 12, 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.

3 participants