MLSAG speedup and additional checks

This commit is contained in:
Sarang Noether
2019-08-27 16:22:44 -04:00
parent 6335509727
commit 3a0451a8be
7 changed files with 75 additions and 101 deletions

View File

@@ -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);