diff options
| author | Sarang Noether <32460187+SarangNoether@users.noreply.github.com> | 2019-08-27 16:22:44 -0400 |
|---|---|---|
| committer | Sarang Noether <32460187+SarangNoether@users.noreply.github.com> | 2019-08-27 16:22:44 -0400 |
| commit | 3a0451a8be43154f0da06dd9c693ed6f0c657042 (patch) | |
| tree | 298545ee6661a331d615de049359e74e5a9e5ca2 /src/ringct/rctOps.cpp | |
| parent | 6335509727661349e50c54c4e0eafd692f0d6907 (diff) | |
| download | monzero-core-3a0451a8be43154f0da06dd9c693ed6f0c657042.tar.gz monzero-core-3a0451a8be43154f0da06dd9c693ed6f0c657042.tar.xz monzero-core-3a0451a8be43154f0da06dd9c693ed6f0c657042.zip | |
MLSAG speedup and additional checks
Diffstat (limited to 'src/ringct/rctOps.cpp')
| -rw-r--r-- | src/ringct/rctOps.cpp | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp index b5499262f..6e4d063df 100644 --- a/src/ringct/rctOps.cpp +++ b/src/ringct/rctOps.cpp @@ -620,45 +620,17 @@ namespace rct { sc_reduce32(rv.bytes); return rv; } - - key hashToPointSimple(const key & hh) { - key pointk; - ge_p1p1 point2; - ge_p2 point; - ge_p3 res; - key h = cn_fast_hash(hh); - CHECK_AND_ASSERT_THROW_MES_L1(ge_frombytes_vartime(&res, h.bytes) == 0, "ge_frombytes_vartime failed at "+boost::lexical_cast<std::string>(__LINE__)); - ge_p3_to_p2(&point, &res); - ge_mul8(&point2, &point); - ge_p1p1_to_p3(&res, &point2); - ge_p3_tobytes(pointk.bytes, &res); - return pointk; - } - key hashToPoint(const key & hh) { - key pointk; - ge_p2 point; - ge_p1p1 point2; - ge_p3 res; - key h = cn_fast_hash(hh); - ge_fromfe_frombytes_vartime(&point, h.bytes); - ge_mul8(&point2, &point); - ge_p1p1_to_p3(&res, &point2); - ge_p3_tobytes(pointk.bytes, &res); - return pointk; + // Hash a key to p3 representation + void hash_to_p3(ge_p3 &hash8_p3, const key &k) { + key hash_key = cn_fast_hash(k); + ge_p2 hash_p2; + ge_fromfe_frombytes_vartime(&hash_p2, hash_key.bytes); + ge_p1p1 hash8_p1p1; + ge_mul8(&hash8_p1p1, &hash_p2); + ge_p1p1_to_p3(&hash8_p3, &hash8_p1p1); } - void hashToPoint(key & pointk, const key & hh) { - ge_p2 point; - ge_p1p1 point2; - ge_p3 res; - key h = cn_fast_hash(hh); - ge_fromfe_frombytes_vartime(&point, h.bytes); - ge_mul8(&point2, &point); - ge_p1p1_to_p3(&res, &point2); - ge_p3_tobytes(pointk.bytes, &res); - } - //sums a vector of curve points (for scalars use sc_add) void sumKeys(key & Csum, const keyV & Cis) { identity(Csum); |
