|
|
|
@ -80,67 +80,3 @@ template std::string base_blob<256>::GetHex() const;
@@ -80,67 +80,3 @@ template std::string base_blob<256>::GetHex() const;
|
|
|
|
|
template std::string base_blob<256>::ToString() const; |
|
|
|
|
template void base_blob<256>::SetHex(const char*); |
|
|
|
|
template void base_blob<256>::SetHex(const std::string&); |
|
|
|
|
|
|
|
|
|
static void inline HashMix(uint32_t& a, uint32_t& b, uint32_t& c) |
|
|
|
|
{ |
|
|
|
|
// Taken from lookup3, by Bob Jenkins.
|
|
|
|
|
a -= c; |
|
|
|
|
a ^= ((c << 4) | (c >> 28)); |
|
|
|
|
c += b; |
|
|
|
|
b -= a; |
|
|
|
|
b ^= ((a << 6) | (a >> 26)); |
|
|
|
|
a += c; |
|
|
|
|
c -= b; |
|
|
|
|
c ^= ((b << 8) | (b >> 24)); |
|
|
|
|
b += a; |
|
|
|
|
a -= c; |
|
|
|
|
a ^= ((c << 16) | (c >> 16)); |
|
|
|
|
c += b; |
|
|
|
|
b -= a; |
|
|
|
|
b ^= ((a << 19) | (a >> 13)); |
|
|
|
|
a += c; |
|
|
|
|
c -= b; |
|
|
|
|
c ^= ((b << 4) | (b >> 28)); |
|
|
|
|
b += a; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void inline HashFinal(uint32_t& a, uint32_t& b, uint32_t& c) |
|
|
|
|
{ |
|
|
|
|
// Taken from lookup3, by Bob Jenkins.
|
|
|
|
|
c ^= b; |
|
|
|
|
c -= ((b << 14) | (b >> 18)); |
|
|
|
|
a ^= c; |
|
|
|
|
a -= ((c << 11) | (c >> 21)); |
|
|
|
|
b ^= a; |
|
|
|
|
b -= ((a << 25) | (a >> 7)); |
|
|
|
|
c ^= b; |
|
|
|
|
c -= ((b << 16) | (b >> 16)); |
|
|
|
|
a ^= c; |
|
|
|
|
a -= ((c << 4) | (c >> 28)); |
|
|
|
|
b ^= a; |
|
|
|
|
b -= ((a << 14) | (a >> 18)); |
|
|
|
|
c ^= b; |
|
|
|
|
c -= ((b << 24) | (b >> 8)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint64_t uint256::GetHash(const uint256& salt) const |
|
|
|
|
{ |
|
|
|
|
uint32_t a, b, c; |
|
|
|
|
const uint32_t *pn = (const uint32_t*)data; |
|
|
|
|
const uint32_t *salt_pn = (const uint32_t*)salt.data; |
|
|
|
|
a = b = c = 0xdeadbeef + WIDTH; |
|
|
|
|
|
|
|
|
|
a += pn[0] ^ salt_pn[0]; |
|
|
|
|
b += pn[1] ^ salt_pn[1]; |
|
|
|
|
c += pn[2] ^ salt_pn[2]; |
|
|
|
|
HashMix(a, b, c); |
|
|
|
|
a += pn[3] ^ salt_pn[3]; |
|
|
|
|
b += pn[4] ^ salt_pn[4]; |
|
|
|
|
c += pn[5] ^ salt_pn[5]; |
|
|
|
|
HashMix(a, b, c); |
|
|
|
|
a += pn[6] ^ salt_pn[6]; |
|
|
|
|
b += pn[7] ^ salt_pn[7]; |
|
|
|
|
HashFinal(a, b, c); |
|
|
|
|
|
|
|
|
|
return ((((uint64_t)b) << 32) | c); |
|
|
|
|
} |
|
|
|
|