Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SHA impl so that state is encoded as big-endian words #303

Merged
merged 2 commits into from Dec 14, 2022

Conversation

flaub
Copy link
Member

@flaub flaub commented Dec 14, 2022

  • Make downstream uses less confusing

@flaub flaub self-assigned this Dec 14, 2022
@flaub flaub requested a review from tzerrell December 14, 2022 06:01
@intoverflow
Copy link
Member

It looks like the endianness flip is visible from the Digest. Was it not possible to encapsulate the endianness concern within the circuit?

@flaub flaub merged commit 3224c3c into main Dec 14, 2022
@flaub flaub deleted the flaub/fix-sha branch December 14, 2022 17:59
@jbruestle
Copy link
Contributor

jbruestle commented Dec 14, 2022

It looks like the endianness flip is visible from the Digest. Was it not possible to encapsulate the endianness concern within the circuit?

So the main reason to make this change is actually to make hashing of hashes works the way one would expect: According to the SHA spec, the words in the hash are supposed to written to memory in BE order, but we always kept digests in native (LE in our case) order, which meant that if one did a hash of a digest, the results would be different than most other implementations. So this change does impact any and all users of the hashing (including doubtless the lean verifier, and also unfortunately my verifier), but it brings us into alignment with the spec finally.

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.

None yet

3 participants