Skip to content
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

Which MaptoCurve used for BN254 #211

Closed
nelsonijih opened this issue Aug 28, 2024 · 1 comment
Closed

Which MaptoCurve used for BN254 #211

nelsonijih opened this issue Aug 28, 2024 · 1 comment

Comments

@nelsonijih
Copy link

We're planning to use Dirk KMS(which uses this crypto library) for Operator remote BLS signing for BN254 curve.

What is the map to curve algorithm this library support for BN254?

Currently, some AVSs are using the "try and increment" algorithm for mapping to curve as described/written in the code link below
https://github.com/Layr-Labs/eigensdk-go/blob/dev/crypto/bn254/utils.go#L36

If the library does not support it, any guidance on how to quickly add it? if it supports it, how do we enable it?

@herumi
Copy link
Owner

herumi commented Aug 28, 2024

You can use mcl::ec::tryAndIncMapTo.
I don't know the specification of SetBytes in the original code; I expect that setBigEndianMod corresponds to it.

using namespace mcl;
using namespace mcl::bn;
Fp t;
t.setBigEndianMod(digest);
G1 P;
mcl::ec::tryAndIncMapTo(P, t);

But the sign of P.y is not fixed either. Fp::neg(P.y, P.y) would be needed to match the ModSqrt specification in the original code.

@nelsonijih nelsonijih changed the title Which MaptoCurve used for BN245 Which MaptoCurve used for BN254 Aug 28, 2024
@herumi herumi closed this as completed Sep 2, 2024
@github-staff github-staff deleted a comment from ViniciusSCG Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@herumi @nelsonijih and others