herumi / mcl

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

Order of G2 group #35

Closed StefanosChaliasos closed 5 years ago

StefanosChaliasos commented 5 years ago

How can I get the order of G2 group of CurveSNARK1?

herumi commented 5 years ago

If you use C++, then the value is mcl::bn::BN::param.p . If you use C api, then use mclBn_getFieldOrder.

StefanosChaliasos commented 5 years ago

I want to get the value declared here in libff as an Fr element.

herumi commented 5 years ago

How about this?

#include <mcl/bn256.hpp>
#include <iostream>

int main()
{
    mcl::bn::initPairing(mcl::BN_SNARK1);
    std::cout << "r=" << mcl::bn::BN::param.r << std::endl;
}

r = 21888242871839275222246405745257275088548364400416034343698204186575808495617
StefanosChaliasos commented 5 years ago

Thanks a lot @herumi !