aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-09-18 19:13:02 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-09-18 19:13:02 +0800
commit7b35b6605ed6ff7f5444802aadaacb4f5e066a10 (patch)
tree31a85725cf9137971fe1b0d8e7dc3f8b7dc784eb
parent73ed13ed682cdd919c2d11138ff2dc1e041f0cae (diff)
downloadtangerine-mcl-7b35b6605ed6ff7f5444802aadaacb4f5e066a10.tar.gz
tangerine-mcl-7b35b6605ed6ff7f5444802aadaacb4f5e066a10.tar.zst
tangerine-mcl-7b35b6605ed6ff7f5444802aadaacb4f5e066a10.zip
add bn512.hpp
-rw-r--r--include/mcl/bn512.hpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/mcl/bn512.hpp b/include/mcl/bn512.hpp
new file mode 100644
index 0000000..6979606
--- /dev/null
+++ b/include/mcl/bn512.hpp
@@ -0,0 +1,39 @@
+#pragma once
+/**
+ @file
+ @brief preset class for 512-bit optimal ate pairing over BN curves
+ @author MITSUNARI Shigeo(@herumi)
+ @license modified new BSD license
+ http://opensource.org/licenses/BSD-3-Clause
+*/
+#include <mcl/bn.hpp>
+
+namespace mcl { namespace bn512 {
+
+namespace local {
+struct FpTag;
+struct FrTag;
+}
+
+typedef mcl::FpT<local::FpTag, 512> Fp;
+typedef mcl::bn::BNT<Fp> BN;
+typedef BN::Fp2 Fp2;
+typedef BN::Fp6 Fp6;
+typedef BN::Fp12 Fp12;
+typedef BN::G1 G1;
+typedef BN::G2 G2;
+typedef BN::Fp12 GT;
+
+/* the order of G1 is r */
+typedef mcl::FpT<local::FrTag, 512> Fr;
+
+static inline void initPairing(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
+{
+ BN::init(cp, mode);
+ G1::setCompressedExpression();
+ G2::setCompressedExpression();
+ Fr::init(BN::param.r);
+}
+
+} } // mcl::bn512
+