herumi / mcl

a portable and fast pairing-based cryptography library
BSD 3-Clause "New" or "Revised" License
450 stars 151 forks source link

Curve question #184

Closed darcys22 closed 11 months ago

darcys22 commented 11 months ago

is MCL_BN_SNARK1 the same as alt_bn128 used in ethereum precompiles?

https://gurukamath.github.io/execution-specs/autoapi/ethereum/crypto/alt_bn128/index.html

herumi commented 11 months ago

The pairing is the same. cat t.cpp

#include <mcl/bn.hpp>

int main()
{
    using namespace mcl::bn;
    initPairing(mcl::BN_SNARK1);
    printf("p=%s\n", Fp::getOp().mp.getStr().c_str());
}
g++ t.cpp -I include/ lib/libmcl.a && ./a.out
p=21888242871839275222246405745257275088696311157297823662689037894645226208583
darcys22 commented 11 months ago

Thank you!