Skip to content

Conversation

@sashass1315
Copy link

This change corrects the loop counter used when deriving b_i in expand_message_xmd for SHA3-256 to match RFC 9380 §5.3.1: b_1 is computed with I2OSP(1, 1) and subsequent blocks must use I2OSP(i, 1) for i in 2..=ell. The previous implementation iterated idx from 1 while computing b_2..b_ell but passed I2OSP(idx, 1), effectively labeling b_2 as 1 and shifting all subsequent block counters by one. Updating the counter to I2OSP(idx + 1, 1) ensures that b_2 is computed with 2, b_3 with 3, and so on, restoring spec compliance and interoperability with other implementations.

@sashass1315 sashass1315 requested a review from a team as a code owner November 18, 2025 17:10
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