-
Notifications
You must be signed in to change notification settings - Fork 152
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
Keccak256 in Miden Assembly #154
Keccak256 in Miden Assembly #154
Conversation
…sembly implementation
fb2168f
to
5df06a8
Compare
VM cycle count when applying keccak-p[1600, 24]: 134,355 |
…d representation See section 2.1 of https://keccak.team/files/Keccak-implementation-3.2.pdf for understanding bit interleaving in context of **keccak256**
…2 -bytes output digest
VM cycle count for computing keccak256 2-to-1 hash: 149,370 |
For understanding bit interleaving technique, which is leveraged in this implementation so that using only 32 -bit bitwise operations keccak256 hash can be computed, I suggest you read section 2.1 of https://keccak.team/files/Keccak-implementation-3.2.pdf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks great! One small thing:
I'm assuming testing this would take quite a bit of time. Could we add the ignore
attribute for the test so that it is run only when we want to run it explicitly? We can remove this attribute later once we improve script compilation times.
Also, some optimization thoughts for the future:
- Once we have
u64
module fully implemented instdlib
we might simplify the code a bit. - I noticed that pattern of
popw
followed bypushw
is used quite frequently. We could reduce the number of cycles by usingstorew
followed byloadw
instead. - In some cases, it might make sense to use
load
andstore
(for single elements) rather the variants for full words followed by stack manipulations.
Thanks for reviewing !
Fixed here 4bf82a9
Noted down, I'll apply them when I revisit the problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good! thank you!
Progress
θ
; see hereρ
; see hereπ
; see hereχ
; see hereι
; see here