From 711ae4207263d52724abc324b44fa1414e3e165e Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 13 May 2020 14:11:50 +0900 Subject: [PATCH] rename old hashTo function --- include/mcl/bn.hpp | 2 +- include/mcl/mapto_wb19.hpp | 10 +++++----- test/mapto_wb19_test.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/mcl/bn.hpp b/include/mcl/bn.hpp index dbea7f6..e408137 100644 --- a/include/mcl/bn.hpp +++ b/include/mcl/bn.hpp @@ -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; } diff --git a/include/mcl/mapto_wb19.hpp b/include/mcl/mapto_wb19.hpp index 306ff68..b53478b 100644 --- a/include/mcl/mapto_wb19.hpp +++ b/include/mcl/mapto_wb19.hpp @@ -11,7 +11,7 @@ namespace mcl { // ctr = 0 or 1 or 2 template -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]); } diff --git a/test/mapto_wb19_test.cpp b/test/mapto_wb19_test.cpp index debdab7..1278a04 100644 --- a/test/mapto_wb19_test.cpp +++ b/test/mapto_wb19_test.cpp @@ -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]);