Skip to content

Commit c434940

Browse files
arowserdanielsocials
authored andcommitted
uint256::GetCheapHash bigendian compatibility
1 parent 0b0fc17 commit c434940

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)