add preset header for bls12-381

dev
MITSUNARI Shigeo 6 years ago
parent fe95b63cc4
commit f3776baa35
  1. 15
      include/mcl/bls12_381.hpp
  2. 5
      test/bls12_test.cpp

@ -0,0 +1,15 @@
#pragma once
/**
@file
@brief preset class for BLS12-381 pairing
@author MITSUNARI Shigeo(@herumi)
@license modified new BSD license
http://opensource.org/licenses/BSD-3-Clause
*/
#define MCL_MAX_FP_BIT_SIZE 384
#define MCL_MAX_FR_BIT_SIZE 256
#include <mcl/bn.hpp>
namespace mcl { namespace bls12 {
using namespace mcl::bn;
} }

@ -3,7 +3,7 @@
#include <cybozu/benchmark.hpp> #include <cybozu/benchmark.hpp>
cybozu::CpuClock clk; cybozu::CpuClock clk;
#include <cybozu/test.hpp> #include <cybozu/test.hpp>
#include <mcl/bn384.hpp> #include <mcl/bls12_381.hpp>
#include <cybozu/option.hpp> #include <cybozu/option.hpp>
#include <cybozu/xorshift.hpp> #include <cybozu/xorshift.hpp>
@ -11,7 +11,7 @@ cybozu::CpuClock clk;
#define MCL_AVOID_EXCEPTION_TEST #define MCL_AVOID_EXCEPTION_TEST
#endif #endif
using namespace mcl::bn384; using namespace mcl::bls12;
mcl::fp::Mode g_mode; mcl::fp::Mode g_mode;
@ -65,6 +65,7 @@ const struct TestSet {
CYBOZU_TEST_AUTO(size) CYBOZU_TEST_AUTO(size)
{ {
CYBOZU_TEST_EQUAL(sizeof(Fp), 48u); CYBOZU_TEST_EQUAL(sizeof(Fp), 48u);
CYBOZU_TEST_EQUAL(sizeof(Fr), 32u);
CYBOZU_TEST_EQUAL(sizeof(Fp2), sizeof(Fp) * 2); CYBOZU_TEST_EQUAL(sizeof(Fp2), sizeof(Fp) * 2);
CYBOZU_TEST_EQUAL(sizeof(Fp6), sizeof(Fp) * 6); CYBOZU_TEST_EQUAL(sizeof(Fp6), sizeof(Fp) * 6);
CYBOZU_TEST_EQUAL(sizeof(Fp12), sizeof(Fp) * 12); CYBOZU_TEST_EQUAL(sizeof(Fp12), sizeof(Fp) * 12);

Loading…
Cancel
Save