-
Notifications
You must be signed in to change notification settings - Fork 504
Feat/marshal g1 scalar #891
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
Conversation
|
📦 |
ivokub
left a comment
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.
Right now the MarshalScalar and MarshalG1 methods seem to be returning bits. In the short-mimc the fieldhasher interfaces is taking in field elements.
I'll try if it would be possible to here instead return compatible fr.Elements (by recomposing bits such that the high byte is 0). Then we can also have compatibility when hashing the bits (not only bitwise compatibility with native marshaling)
|
Yes my plan was to return bits in the exact same layout as in gnark-crypto and let the user reconstruct the variable according to gnark-crypto. But it makes sense to return frontendVariables now that there is the short hash. |
|
📦 |
ivokub
left a comment
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.
I changed a bit not to include the number of bits for marshalling and are now deducing from the parameters. Also added bitmode to short hash so that we can have compatible hash values.
I'll implement custom FS transcript binding (with BindBits separately).
From my side good to go. Have a look yourself and you can merge if seems good.
Description
Adds method
MarshalG1(G1El, int) []frontend.Variable,MarshalScalar(S, int) []frontend.Variableon theCurveinterface, following gnark-crypto's Marshal (the result a slice of bits while it is a []byte in gnark-crypto but the layout is the same, same endianness).Type of change
How has this been tested?
For both emulated and native curves, see:
Checklist:
golangci-lintdoes not output errors locally