mirror of
https://github.com/monero-project/monero.git
synced 2026-01-20 08:30:51 -08:00
MLSAG speedup and additional checks
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user