From 9482dfd45e72f5c86cd3ed1c3d0859e11bc8234c Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 5 Sep 2018 23:06:04 +0900 Subject: [PATCH] a tool to precompute G2 --- misc/precompute.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 misc/precompute.cpp diff --git a/misc/precompute.cpp b/misc/precompute.cpp new file mode 100644 index 0000000..5661159 --- /dev/null +++ b/misc/precompute.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace mcl::bn; + +int main() +{ + initPairing(mcl::BN254); + G2 Q; + mapToG2(Q, 1); + std::vector Qcoeff; + precomputeG2(Qcoeff, Q); + printf("static const char *tbl[%d] = {\n", (int)Qcoeff.size()); + for (size_t i = 0; i < Qcoeff.size(); i++) { + printf("\"%s\",\n", Qcoeff[i].getStr(16).c_str()); + } + puts("};"); +}