Centralize block-size bounds and improve trait documentation#424
Open
0xxreacher wants to merge 1 commit into
Open
Centralize block-size bounds and improve trait documentation#4240xxreacher wants to merge 1 commit into
0xxreacher wants to merge 1 commit into
Conversation
Introduce an internal `ValidBlockSize` marker trait to centralize the block-size bounds used by `ProxyHash` and `Hash`. This refactor removes duplicated typenum constraints, improves readability, and provides a single source of truth for block-size requirements. Also clarify documentation by explicitly distinguishing hash block size from digest output size. No functional or public API changes.
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.
Summary
This PR introduces an internal
ValidBlockSizemarker trait and uses it to centralize the block-size constraints required byProxyHashandHash.It also clarifies documentation by explicitly distinguishing a hash function's internal block size from its digest output size.
Changes
pub(crate) trait ValidBlockSizeProxyHashandHashOutputSizeMotivation
The same typenum constraints were repeated across multiple trait definitions and implementations:
Centralizing these constraints:
The documentation updates also make it explicit that the constraint applies to a hash function's internal block size (
BlockSizeUser::BlockSize) rather than its digest output size.Compatibility
This change is purely a refactor and documentation improvement. There are no functional, behavioral, or public API changes.