Conversion of frontend.Variable <-> emulated.Element #614
Replies: 4 comments 5 replies
-
I believe there is no hash to curve circuit yet. You would probably need to build it on top of emulated arithmetic for G1 and G2. |
Beta Was this translation helpful? Give feedback.
-
No issues, I think I figured it out. func convertFrontendVariableToEmulatedElement(api frontend.API, v frontend.Variable) emulated.Element[emulated.BN254Fp] {
bits := api.ToBinary(v)
field, err := emulated.NewField[emulated.BN254Fp](api)
HandleError(err)
return *field.FromBits(bits...)
} I hope this helps. |
Beta Was this translation helpful? Give feedback.
-
@ivokub Can I make a PR to add these helper functions? |
Beta Was this translation helpful? Give feedback.
-
Btw, as an alternative for HashToCurve, will using the hash as a scalar and multiplying it with a fixed point on the curve to get a HashToCurve kinda functionality be cryptographically secure? |
Beta Was this translation helpful? Give feedback.
-
Hi! I am using the develop branch to perfom emulated field operations for the bn254 curve and I wanted to know if there is any way to convert
frontend.Variable
toemulated.Element
.I want to compute a MiMC hash inside the circuit and then map the hash to the curve to do a a pairing check. But I cannot do that becuase I don't see a way to convert.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions