change mode of hashAndMapToG1

update-fork
MITSUNARI Shigeo 4 years ago
parent c7120c8963
commit 258b63c487
  1. 5
      include/mcl/bn.hpp
  2. 5
      test/mapto_wb19_test.cpp

@ -2056,6 +2056,11 @@ inline void mapToG2(G2& P, const Fp2& x, bool fast = false)
#endif
inline void hashAndMapToG1(G1& P, const void *buf, size_t bufSize)
{
int mode = getMapToMode();
if (mode == MCL_MAP_TO_MODE_HASH_TO_CURVE_07) {
BN::param.mapTo.mapTo_WB19_.msgToG1(P, buf, bufSize);
return;
}
Fp t;
t.setHashOf(buf, bufSize);
bool b;

@ -1160,6 +1160,11 @@ void testMsgToG1(const T& mapto)
Q.z = 1;
CYBOZU_TEST_EQUAL(P, Q);
CYBOZU_BENCH_C("msgToG1", 1000, mapto.msgToG1, P, msg, msgSize, dst, dstSize);
if (i == 0) { // correct dst
P.clear();
bn::hashAndMapToG1(P, msg, msgSize);
CYBOZU_TEST_EQUAL(P, Q);
}
}
}

Loading…
Cancel
Save