-
Notifications
You must be signed in to change notification settings - Fork 198
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
hash2curve: why expand_message receives multiple messages? #1309
Comments
It was not meant as an equivalent to an "update" function, but as a way to pass a message that isn't a contiguous slice of bytes, which is only useful if you want to avoid allocations. It's similar to what See more on that topic in the original PR: #876. |
I'd missed that hash2curve exists here, even though I searched, but only several months ago. We've an ugly interface to hash-to-curve in Arkworks. I've submitted a refactoring in arkworks-rs/algebra#643 with the underlying principles being roughly:
|
Going to close this as it's asking a question which has since been answered. I'd suggest opening a new issue with a proposal if you'd like to suggest an alternative design. |
Odd. That is much of what |
I don't think I completely followed what you said here, but I think a sort of Personally the current API does what I need it to, though I would be happy to give some input and review code (I'm not a maintainer here) if somebody wants to make a PR, @armfazh.
A slice of slices can be created ad-hoc if the number of slices isn't dynamic. But I think I mentioned this in the last PR, an |
It's a messy draft so yeah complexity happens. In particular I invoke the security level computation in 3 or 4 places to give the nicer interface, but so what. The draft provides some ciphersuits involving their SHA2 XoF, but also permits using shake128 with those same curves. I'd hope some people do so, or at least new curves hopefully select shake128. It's nice if the interface supports this modularity. We interpret the draft as imply a preference for Elligator, so a curve with a common Edwards form like BLS12-377 should use Elligator, even if it also has an SW form. This should probably use shake128. Afaik the only pressing reason for SHA2 over shake128, beside existing deployments, would be constraint count in zk circuits. I bet anyone who cares about this uses some bespoke zk circuit friendly hash like Poseidon. |
SHA-256 enjoys nearly ubiquitous support in hardware |
This isn't a problem here, the traits in On that note, I've been using OPAQUE with SHA3 and Ristretto255 for the OPRF and X25519 for the AKE with the help of these traits quite successfully. |
why
expand_message
function receives multiple messages and multiple DSTs?This seems counter-intuitive when invoking the top-level hash to curve function.
If the purpose is to provide a way to call "
Update
" many times as in a regular hash function, then I don't think is the right approach, since that case is useful when one doesn't not the full message to be hashed. However, this API requires to passing an array of all the parts of the message.Happy to discuss more about the API design of this function.
The text was updated successfully, but these errors were encountered: