Skip to content

Commit

Permalink
Merge pull request #7078
Browse files Browse the repository at this point in the history
c434940 uint256::GetCheapHash bigendian compatibility (daniel)
  • Loading branch information
laanwj committed Nov 27, 2015
2 parents f3d0fdd + c434940 commit 93e0514
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/uint256.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <stdint.h>
#include <string>
#include <vector>
#include "crypto/common.h"

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

/** A more secure, salted hash function.
Expand Down

0 comments on commit 93e0514

Please sign in to comment.