Browse Source

src/hash.cpp: endian compatibility

pull/145/head
Wladimir J. van der Laan 10 years ago
parent
commit
3ca5852dc2
  1. 6
      src/hash.cpp

6
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);

Loading…
Cancel
Save