diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-08-27 15:04:44 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-08-28 21:30:47 +0100 |
commit | 5d38206fcc8a9313d7f8b3c92fbc37c4d2731b85 (patch) | |
tree | 02ea7726c092552167e7c7253c758cc26dfc7c38 /src | |
parent | rct: faster Cryptonote/rct conversions (diff) | |
download | monero-5d38206fcc8a9313d7f8b3c92fbc37c4d2731b85.tar.xz |
ringct: remove spurious copies
Diffstat (limited to 'src')
-rw-r--r-- | src/ringct/rctOps.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp index d54aa667f..91dedc3e4 100644 --- a/src/ringct/rctOps.cpp +++ b/src/ringct/rctOps.cpp @@ -334,12 +334,7 @@ namespace rct { //be careful these are also in crypto namespace //cn_fast_hash for arbitrary multiples of 32 bytes void cn_fast_hash(key &hash, const void * data, const std::size_t l) { - uint8_t md2[32]; - int j = 0; - keccak((uint8_t *)data, l, md2, 32); - for (j = 0; j < 32; j++) { - hash[j] = (unsigned char)md2[j]; - } + keccak((uint8_t *)data, l, hash.bytes, 32); } void hash_to_scalar(key &hash, const void * data, const std::size_t l) { @@ -349,12 +344,7 @@ namespace rct { //cn_fast_hash for a 32 byte key void cn_fast_hash(key & hash, const key & in) { - uint8_t md2[32]; - int j = 0; - keccak((uint8_t *)in.bytes, 32, md2, 32); - for (j = 0; j < 32; j++) { - hash[j] = (unsigned char)md2[j]; - } + keccak((uint8_t *)in.bytes, 32, hash.bytes, 32); } void hash_to_scalar(key & hash, const key & in) { @@ -364,13 +354,8 @@ namespace rct { //cn_fast_hash for a 32 byte key key cn_fast_hash(const key & in) { - uint8_t md2[32]; - int j = 0; key hash; - keccak((uint8_t *)in.bytes, 32, md2, 32); - for (j = 0; j < 32; j++) { - hash[j] = (unsigned char)md2[j]; - } + keccak((uint8_t *)in.bytes, 32, hash.bytes, 32); return hash; } @@ -382,13 +367,8 @@ namespace rct { //cn_fast_hash for a 128 byte unsigned char key cn_fast_hash128(const void * in) { - uint8_t md2[32]; - int j = 0; key hash; - keccak((uint8_t *)in, 128, md2, 32); - for (j = 0; j < 32; j++) { - hash[j] = (unsigned char)md2[j]; - } + keccak((uint8_t *)in, 128, hash.bytes, 32); return hash; } |