aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-03-14 19:22:34 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-03-14 19:22:34 +0800
commit50a0ed560f3e10db55c8e52ebd335586f76473a6 (patch)
treeae27db75cf08921e92194d2a8a47503d51489662 /include
parent4bb4df62bf6f2dc3dbf71e75664be52a733c1940 (diff)
downloadtangerine-mcl-50a0ed560f3e10db55c8e52ebd335586f76473a6.tar.gz
tangerine-mcl-50a0ed560f3e10db55c8e52ebd335586f76473a6.tar.zst
tangerine-mcl-50a0ed560f3e10db55c8e52ebd335586f76473a6.zip
add bn384.hpp
Diffstat (limited to 'include')
-rw-r--r--include/mcl/bn384.hpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/mcl/bn384.hpp b/include/mcl/bn384.hpp
new file mode 100644
index 0000000..d5c3e81
--- /dev/null
+++ b/include/mcl/bn384.hpp
@@ -0,0 +1,39 @@
+#pragma once
+/**
+ @file
+ @brief preset class for 384-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 bn384 {
+
+namespace local {
+struct FpTag;
+struct FrTag;
+}
+
+typedef mcl::FpT<local::FpTag, 384> 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, 384> Fr;
+
+static inline void bn384init(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp382_2, fp::Mode mode = fp::FP_AUTO)
+{
+ BN::init(cp, mode);
+ G1::setCompressedExpression();
+ G2::setCompressedExpression();
+ Fr::init(BN::param.r);
+}
+
+} } // mcl::bn384
+