argumentcomputer / bellpepper-gadgets

A library of gadgets compatible with bellpepper and bellperson (contact: @huitseeker)
Apache License 2.0
17 stars 13 forks source link

WIP: bls12381 hash_to_g2 implementation #25

Closed wwared closed 9 months ago

wwared commented 9 months ago

Still heavily WIP. Logic based mostly from circom-pairing's bls12_381_hash_to_G2.circom with help from bls12_381's map_g2.rs.

What's working so far (with tests):

To finish:

I created an add_or_double() function because the regular add() assumes that p != q (I will add a docstring documenting this properly). This is roughly equivalent to circom-pairing's EllipticCurveAdd, but doing what gnark's AddUnified does instead should be more efficient. This might be left for a future constraint-optimization PR though.

wwared commented 9 months ago

Superseded by #35