Skip to content

sha3: move SHAKE into separate shake crate#869

Merged
newpavlov merged 4 commits into
masterfrom
sha3/mv_Shake
May 15, 2026
Merged

sha3: move SHAKE into separate shake crate#869
newpavlov merged 4 commits into
masterfrom
sha3/mv_Shake

Conversation

@newpavlov
Copy link
Copy Markdown
Member

No description provided.

@newpavlov newpavlov requested a review from tarcieri May 13, 2026 15:19
@tarcieri
Copy link
Copy Markdown
Member

I understand moving turboshake into its own crate as it's not standardized, and cshake seems fine as it's not technically part of FIPS 202 (though it is in NIST SP 800-185), but SHAKE128 and SHAKE256 are formally part of the SHA-3 family as defined in FIPS 202, so I'm not sure I understand the value of splitting them out like this. It feels like more crates for the sake of more crates, when we already have an excessive number of crates.

@newpavlov
Copy link
Copy Markdown
Member Author

newpavlov commented May 14, 2026

Most users probably use only the fixed size types and the SHAKE implementation does not share much with them, so it allows to make sha3 crate smaller (both LoC and public API wise) and re-export only the Digest trait similarly to the most other hash crates. In other words, I think it makes sense to keep XOF and non-XOF algorithms in separate crates.

To keep the number of crates the same I considered merging cshake into shake in a later PR, similarly to how ascon-xof128 and k12 contain both customized and non-customized variants.

SHAKE128 and SHAKE256 are formally part of the SHA-3 family as defined in FIPS 202

Well, considering that we have the Keccak variants, the sha3 crate is not strictly "implementation of FIPS 202".

@tarcieri
Copy link
Copy Markdown
Member

I would guess the opposite: SHAKE is likely to be the main thing people consume from this crate, owing to its use in various standards. But I guess we can do a survey.

The actual SHA-3 hash functions have generally received poor adoption owing to their poor speed.

Well, considering that we have the Keccak variants, the sha3 crate is not strictly "implementation of FIPS 202".

If we're removing things from sha3, I would prioritize things which aren't defined in FIPS 202 and therefore technically part of the SHA-3 family.

@newpavlov
Copy link
Copy Markdown
Member Author

newpavlov commented May 14, 2026

But I guess we can do a survey.

I clicked through a number of most downloaded non-RustCrypto dependents and on the first glance most use fixed size types (with a surprising popularity of the Keccak variants owning to the cryptocoin stuff). I will try to do a proper survey later.

If we're removing things from sha3, I would prioritize things which aren't defined in FIPS 202 and therefore technically part of the SHA-3 family.

I understand this position, but in practice it would result in pure code duplication. Granted, it's not much thanks to keccak and sponge-cursor crates, but still.

@tarcieri
Copy link
Copy Markdown
Member

tarcieri commented May 14, 2026

Aah right, even as a user thereof I forgot about that. I guess I should probably say I would expect SHAKEs are the most used of the actually FIPS 202 constructions.

@newpavlov
Copy link
Copy Markdown
Member Author

newpavlov commented May 14, 2026

I would expect SHAKEs are the most used of the actually FIPS 202 constructions.

They use only SHAKEs without the fixed size variants, no? IMO it's another argument for splitting XOF and non-XOF constructions since they are unlikely to be mixed.

@tarcieri
Copy link
Copy Markdown
Member

If XOFs were actually in a separate repo, I think that'd be a good argument for splitting it out

@newpavlov
Copy link
Copy Markdown
Member Author

newpavlov commented May 14, 2026

I am fine with the repo split, if you prefer to handle it such way.

@tarcieri
Copy link
Copy Markdown
Member

I think it might make SHAKE harder to find, but it would at least be a justification for splitting them

@newpavlov
Copy link
Copy Markdown
Member Author

I will merge this PR and will do the repo split then. To improve discoverability I will mention the XOFs repo in the hashes root README.

@newpavlov newpavlov merged commit 7b4cced into master May 15, 2026
285 checks passed
@newpavlov newpavlov deleted the sha3/mv_Shake branch May 15, 2026 13:23
@newpavlov newpavlov mentioned this pull request May 15, 2026
newpavlov added a commit that referenced this pull request May 15, 2026
### Changed
- Internal implementation by removing unnecessary buffering ([#849])
- Serialization format used by `SerializableState` trait implementations
([#849])

### Removed
- `Shake`, `Shake128`, and `Shake256` types (moved to the `shake` crate)
([#869])

[#849]: #849
[#869]: #869
tarcieri added a commit to RustCrypto/signatures that referenced this pull request May 16, 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.

2 participants