-
Notifications
You must be signed in to change notification settings - Fork 7
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
Optimize ML-DSA Implementation #232
base: master
Are you sure you want to change the base?
Conversation
…Specification.cry We also edit ML_DSA.cry to point to the optimized file. We avoid importing private functions or properties as these have already been tested. Looking forward, we will optimize some of these functions and will define equivalence properties.
e45267a
to
60b2c83
Compare
In particular, we optimize `IntegerToBits`, `BitsToInteger`, `IntegerToBytes`, `BitsToBytes` and `BytesToBits`. We also add equivalence properties. The updated functions are around 10x faster.
The functions we optimize are: `SimpleBitPack`, `BitPack`, `SimpleBitUnpack` and `BitUnpack`. These functions are now 10x faster than in the specs. We also implement and check equivalence properties.
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, this looks great! I'd be very interested to see what kind of runtime improvement we get on the top-level functions (_internal
). It probably won't be 10x because NTT and other operations are slow right now, but that's the big one we're interested in.
I have a couple docs requests and one bug.
Primitive/Asymmetric/Signature/ML_DSA/OptimizedSpecification.cry
Outdated
Show resolved
Hide resolved
These definitions are copied and pasted directly from the Specification.cry file. Only tiny edits in the some type parameters are made and are explicitly mentioned in the doc comments. The edited functions are: `KeyGen_internal`, `pkEncode`, `pkDecode`, `skEncode`, `skDecode`, `sigEncode`, `sigDecode`, `w1Encode`, `SampleInBall`, `ExpandA`, `ExpandS` and `ExpandMask`
…rove in a reasonable amount of time or if checking is better
5949fb4
to
fd3c350
Compare
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.
Looks good! Thanks for updating.
Closes #205