rename old hashTo function

update-fork
MITSUNARI Shigeo 5 years ago
parent 63cb8d0d24
commit 711ae42072
  1. 2
      include/mcl/bn.hpp
  2. 10
      include/mcl/mapto_wb19.hpp
  3. 6
      test/mapto_wb19_test.cpp

@ -2242,7 +2242,7 @@ inline const Fr& getG2cofactorAdjInv()
inline bool ethMsgToFp2(Fp2& out, const void *msg, size_t msgSize, uint8_t ctr, const void *dst, size_t dstSize)
{
if (!BN::param.isBLS12) return false;
hashToFp2(out, msg, msgSize, ctr, dst, dstSize);
hashToFp2old(out, msg, msgSize, ctr, dst, dstSize);
return true;
}

@ -11,7 +11,7 @@ namespace mcl {
// ctr = 0 or 1 or 2
template<class Fp2>
inline void hashToFp2(Fp2& out, const void *msg, size_t msgSize, uint8_t ctr, const void *dst, size_t dstSize)
inline void hashToFp2old(Fp2& out, const void *msg, size_t msgSize, uint8_t ctr, const void *dst, size_t dstSize)
{
const bool addZeroByte = true; // append zero byte to msg
assert(ctr <= 2);
@ -440,7 +440,7 @@ struct MapToG2_WB19 {
clear_h2(P, P);
}
// hash-to-curve-06
void hashToFp2v6(Fp2 out[2], const void *msg, size_t msgSize, const void *dst, size_t dstSize) const
void hashToFp2(Fp2 out[2], const void *msg, size_t msgSize, const void *dst, size_t dstSize) const
{
uint8_t md[256];
mcl::fp::expand_message_xmd06(md, msg, msgSize, dst, dstSize);
@ -457,10 +457,10 @@ struct MapToG2_WB19 {
{
Fp2 t[2];
if (draftVersion_ == 5) {
hashToFp2(t[0], msg, msgSize, 0, dst, dstSize);
hashToFp2(t[1], msg, msgSize, 1, dst, dstSize);
hashToFp2old(t[0], msg, msgSize, 0, dst, dstSize);
hashToFp2old(t[1], msg, msgSize, 1, dst, dstSize);
} else {
hashToFp2v6(t, msg, msgSize, dst, dstSize);
hashToFp2(t, msg, msgSize, dst, dstSize);
}
opt_swu2_map(out, t[0], &t[1]);
}

@ -234,8 +234,8 @@ void toJacobi(G2& out, const G2& in)
void py_ecc_hash_to_G2(const MapTo& mapto, G2& out, const void *msg, size_t msgSize, const void *dst, size_t dstSize)
{
Fp2 t1, t2;
hashToFp2(t1, msg, msgSize, 0, dst, dstSize);
hashToFp2(t2, msg, msgSize, 1, dst, dstSize);
hashToFp2old(t1, msg, msgSize, 0, dst, dstSize);
hashToFp2old(t2, msg, msgSize, 1, dst, dstSize);
G2 P1, P2;
py_ecc_map_to_curve_G2(mapto, P1, t1);
py_ecc_map_to_curve_G2(mapto, P2, t2);
@ -817,7 +817,7 @@ void testHashToFp2v6(const T& mapto)
const char *dst = tbl[i].dst;
const Fp2Str *expectStr = tbl[i].s;
Fp2 out[2];
mapto.hashToFp2v6(out, msg, strlen(msg), dst, strlen(dst));
mapto.hashToFp2(out, msg, strlen(msg), dst, strlen(dst));
Fp2 expect[2];
for (int j = 0; j < 2; j++) {
set(expect[j], expectStr[j]);

Loading…
Cancel
Save