aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2018-09-05 22:06:04 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2018-09-05 22:06:04 +0800
commit9482dfd45e72f5c86cd3ed1c3d0859e11bc8234c (patch)
treeabb08c02bf692cd7d2cff87d032c97032291266b
parentef892e34c4266421b6f016a4342c91eb057551bc (diff)
downloaddexon-mcl-9482dfd45e72f5c86cd3ed1c3d0859e11bc8234c.tar.gz
dexon-mcl-9482dfd45e72f5c86cd3ed1c3d0859e11bc8234c.tar.zst
dexon-mcl-9482dfd45e72f5c86cd3ed1c3d0859e11bc8234c.zip
a tool to precompute G2
-rw-r--r--misc/precompute.cpp18
1 files changed, 18 insertions, 0 deletions
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 <mcl/bn384.hpp>
+#include <iostream>
+
+using namespace mcl::bn;
+
+int main()
+{
+ initPairing(mcl::BN254);
+ G2 Q;
+ mapToG2(Q, 1);
+ std::vector<Fp6> 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("};");
+}