mirror of
https://github.com/monero-project/monero.git
synced 2024-12-27 20:29:25 -05:00
ringct: avoid unnecessary memcpy
This commit is contained in:
parent
1fe75c1ea7
commit
9ebf7b6dcf
@ -368,15 +368,8 @@ namespace rct {
|
||||
//This takes the outputs and commitments
|
||||
//and hashes them into a 32 byte sized key
|
||||
key cn_fast_hash(const ctkeyV &PC) {
|
||||
key rv = identity();
|
||||
std::size_t l = (std::size_t)PC.size();
|
||||
size_t i = 0, j = 0;
|
||||
vector<char> m(l * 64);
|
||||
for (i = 0 ; i < l ; i++) {
|
||||
memcpy(&m[i * 64], &PC[i].dest, 32);
|
||||
memcpy(&m[i * 64 + 32], &PC[i].mask, 32);
|
||||
}
|
||||
cn_fast_hash(rv, &m[0], 64*l);
|
||||
key rv;
|
||||
cn_fast_hash(rv, &PC[0], 64*PC.size());
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -391,14 +384,8 @@ namespace rct {
|
||||
//put them in the key vector and it concatenates them
|
||||
//and then hashes them
|
||||
key cn_fast_hash(const keyV &keys) {
|
||||
size_t l = keys.size();
|
||||
vector<unsigned char> m(l * 32);
|
||||
size_t i;
|
||||
for (i = 0 ; i < l ; i++) {
|
||||
memcpy(&m[i * 32], keys[i].bytes, 32);
|
||||
}
|
||||
key rv;
|
||||
cn_fast_hash(rv, &m[0], 32 * l);
|
||||
cn_fast_hash(rv, &keys[0], keys.size() * sizeof(keys[0]));
|
||||
//dp(rv);
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user