Skip to content

Commit 93e0514

Browse files
committed
Merge pull request #7078
c434940 uint256::GetCheapHash bigendian compatibility (daniel)
2 parents f3d0fdd + c434940 commit 93e0514

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/uint256.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <stdint.h>
1313
#include <string>
1414
#include <vector>
15+
#include "crypto/common.h"
1516

1617
/** Template base class for fixed-sized opaque blobs. */
1718
template<unsigned int BITS>
@@ -119,13 +120,10 @@ class uint256 : public base_blob<256> {
119120
* used when the contents are considered uniformly random. It is not appropriate
120121
* when the value can easily be influenced from outside as e.g. a network adversary could
121122
* provide values to trigger worst-case behavior.
122-
* @note The result of this function is not stable between little and big endian.
123123
*/
124124
uint64_t GetCheapHash() const
125125
{
126-
uint64_t result;
127-
memcpy((void*)&result, (void*)data, 8);
128-
return result;
126+
return ReadLE64(data);
129127
}
130128

131129
/** A more secure, salted hash function.

0 commit comments

Comments
 (0)