From 4e76cc6a94dcc8b5de913eed5a9a944ce74da647 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 10 Aug 2016 16:09:27 +0900 Subject: merge mapToG1 and hash --- src/bls.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/bls.cpp b/src/bls.cpp index 091ce6f..c85ce61 100644 --- a/src/bls.cpp +++ b/src/bls.cpp @@ -52,25 +52,15 @@ static const G2& getQ() return Q; } -static void hash(Fp& t, const std::string& m) +static void HashAndMapToG1(G1& P, const std::string& m) { + static mcl::bn::MapTo mapTo; std::string digest = cybozu::crypto::Hash::digest(cybozu::crypto::Hash::N_SHA256, m); + Fp t; t.setArrayMask(digest.c_str(), digest.size()); -} - -static void mapToG1(G1& P, const Fp& t) -{ - static mcl::bn::MapTo mapTo; mapTo.calcG1(P, t); } -static void HashAndMapToG1(G1& P, const std::string& m) -{ - Fp t; - hash(t, m); - mapToG1(P, t); -} - struct Polynomial { FrVec c; // f[x] = sum_{i=0}^{k-1} c[i] x^i void init(const Fr& s, int k) -- cgit v1.2.3