diff options
| author | Riccardo Spagni <ric@spagni.net> | 2018-03-04 19:03:41 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2018-03-04 19:03:41 +0200 |
| commit | c7ace5fa3d412410312e21c55c28068dcd625fef (patch) | |
| tree | fba40dea29a948b8a4904b4de189d4adc605ec6e /src/crypto/slow-hash.c | |
| parent | 421ab3119ce8ccbf73ad12d736d3daa897fa0347 (diff) | |
| parent | e745c1e38da8e54032660894bb2db0e9a49cccf2 (diff) | |
| download | monzero-core-c7ace5fa3d412410312e21c55c28068dcd625fef.tar.gz monzero-core-c7ace5fa3d412410312e21c55c28068dcd625fef.tar.xz monzero-core-c7ace5fa3d412410312e21c55c28068dcd625fef.zip | |
Merge pull request #3303
e745c1e3 Code modifications to integrate Ledger HW device into monero-wallet-cli. (cslashm)
Diffstat (limited to 'src/crypto/slow-hash.c')
| -rw-r--r-- | src/crypto/slow-hash.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c index f921b2455..36bfba9fd 100644 --- a/src/crypto/slow-hash.c +++ b/src/crypto/slow-hash.c @@ -515,8 +515,11 @@ void slow_hash_free_state(void) * @param length the length in bytes of the data * @param hash a pointer to a buffer in which the final 256 bit hash will be stored */ +void cn_slow_hash(const void *data, size_t length, char *hash) { + cn_slow_hash_pre(data,length,hash,false); +} -void cn_slow_hash(const void *data, size_t length, char *hash) +void cn_slow_hash_pre(const void *data, size_t length, char *hash, bool prehashed) { RDATA_ALIGN16 uint8_t expandedKey[240]; /* These buffers are aligned to use later with SSE functions */ @@ -543,8 +546,11 @@ void cn_slow_hash(const void *data, size_t length, char *hash) slow_hash_allocate_state(); /* CryptoNight Step 1: Use Keccak1600 to initialize the 'state' (and 'text') buffers from the data. */ - - hash_process(&state.hs, data, length); + if (prehashed) { + memcpy(&state.hs, data, length); + } else { + hash_process(&state.hs, data, length); + } memcpy(text, state.init, INIT_SIZE_BYTE); /* CryptoNight Step 2: Iteratively encrypt the results from Keccak to fill |
