BN254 - Hash-to-Curve (SVDW method) #190
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds hash-to-curve with BN254 Snarks.
For use in Codex (cc @cskiraly)
Unfortunately there is no isogeny of degree less than 30 that would allow us to use the SSWU method (Simplified Shallue-Van Woestijne-Ulas) and so we use the generic SVDW method (Shallue-Van Woestijne) which is slower due to 2 Legendre symbols+square root+inversion.
The SVDW code path is tested with with the old v7 vectors for BLS12-381.
Note: for BN254-snarks, the usual deployed hash to curve is Fouque-Tibouchi method
FT12: Fouque and Tibouchi,
"Indifferentiable hashing to Barreto-Naehrig curves."
Proc. LATINCRYPT, 2012.
It is in particular the one:
SVDW mapping is used by Constantine, gnark and it might be used by Hubble (cc @ChihChengLiang) as Hubble uses a mix of the IETF hashing_to_curve spec + the Fouque-Tibouchi method from MCL:
FT12 seems to be similar to "encode_to_curve" in the H2C spec due to non-uniformity (NU) rising from modular arithmetic while hashing_to_curve maps to 2 points that are then summed to combat bias.
Compared to SSWU mapping: https://github.com/kwantam/bls12-381_hash#bib