diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-12-19 11:38:03 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-06 15:54:53 +0100 |
commit | 3ca5852dc27cec926e4e7b09ec3ccc369a2a0781 (patch) | |
tree | dd6a31fac844b268137b7b0dcfbaa68756903156 /src | |
parent | 4414f5ffe130f46becdc75c8e59ee74604e978aa (diff) |
src/hash.cpp: endian compatibility
Diffstat (limited to 'src')
-rw-r--r-- | src/hash.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hash.cpp b/src/hash.cpp index a7eb5a2a0b..20d5d21777 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -3,8 +3,10 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "hash.h" +#include "crypto/common.h" #include "crypto/hmac_sha512.h" + inline uint32_t ROTL32(uint32_t x, int8_t r) { return (x << r) | (x >> (32 - r)); @@ -23,10 +25,10 @@ unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char //---------- // body - const uint32_t* blocks = (const uint32_t*)(&vDataToHash[0] + nblocks * 4); + const uint8_t* blocks = &vDataToHash[0] + nblocks * 4; for (int i = -nblocks; i; i++) { - uint32_t k1 = blocks[i]; + uint32_t k1 = ReadLE32(blocks + i*4); k1 *= c1; k1 = ROTL32(k1, 15); |