diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2016-08-10 15:09:27 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2016-08-10 15:09:27 +0800 |
commit | 4e76cc6a94dcc8b5de913eed5a9a944ce74da647 (patch) | |
tree | 5a22cc2f6c5f1ae8bab8fa0de82a23a347dd3dae | |
parent | 192e842e8c7a5f312f3b389cbb23bac358c55fb3 (diff) | |
download | dexon-bls-4e76cc6a94dcc8b5de913eed5a9a944ce74da647.tar dexon-bls-4e76cc6a94dcc8b5de913eed5a9a944ce74da647.tar.gz dexon-bls-4e76cc6a94dcc8b5de913eed5a9a944ce74da647.tar.bz2 dexon-bls-4e76cc6a94dcc8b5de913eed5a9a944ce74da647.tar.lz dexon-bls-4e76cc6a94dcc8b5de913eed5a9a944ce74da647.tar.xz dexon-bls-4e76cc6a94dcc8b5de913eed5a9a944ce74da647.tar.zst dexon-bls-4e76cc6a94dcc8b5de913eed5a9a944ce74da647.zip |
merge mapToG1 and hash
-rw-r--r-- | src/bls.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
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<Fp> 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<Fp> 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) |