aboutsummaryrefslogtreecommitdiff
path: root/src/uint256.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-05-18 10:59:00 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-05-18 11:01:42 +0200
commit5e374f73060d32c7c3700cb521095ee2dc425d9c (patch)
tree815afcedd6e2b38979aefd7e3c230a5f4f5938c3 /src/uint256.h
parent5c3f8ddcaa1164079105c452429fccf8127b01b6 (diff)
parenta68ec21f7ed2978d8945a0f4cfd7e80bfa5fd917 (diff)
downloadbitcoin-5e374f73060d32c7c3700cb521095ee2dc425d9c.tar.xz
Merge #8020: Use SipHash-2-4 for various non-cryptographic hashes
a68ec21 Use SipHash-2-4 for address relay selection (Pieter Wuille) 8cc9cfe Switch CTxMempool::mapTx to use a hash index for txids (Pieter Wuille) 382c871 Use SipHash-2-4 for CCoinsCache index (Pieter Wuille) 0b1295b Add SipHash-2-4 primitives to hash (Pieter Wuille)
Diffstat (limited to 'src/uint256.h')
-rw-r--r--src/uint256.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/uint256.h b/src/uint256.h
index bcdb6dd7c2..dd8432d74c 100644
--- a/src/uint256.h
+++ b/src/uint256.h
@@ -83,6 +83,19 @@ public:
return sizeof(data);
}
+ uint64_t GetUint64(int pos) const
+ {
+ const uint8_t* ptr = data + pos * 8;
+ return ((uint64_t)ptr[0]) | \
+ ((uint64_t)ptr[1]) << 8 | \
+ ((uint64_t)ptr[2]) << 16 | \
+ ((uint64_t)ptr[3]) << 24 | \
+ ((uint64_t)ptr[4]) << 32 | \
+ ((uint64_t)ptr[5]) << 40 | \
+ ((uint64_t)ptr[6]) << 48 | \
+ ((uint64_t)ptr[7]) << 56;
+ }
+
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const
{
@@ -127,11 +140,6 @@ public:
{
return ReadLE64(data);
}
-
- /** A more secure, salted hash function.
- * @note This hash is not stable between little and big endian.
- */
- uint64_t GetHash(const uint256& salt) const;
};
/* uint256 from const char *.