mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
uint256::GetCheapHash bigendian compatibility
This commit is contained in:
parent
0b0fc179ab
commit
c434940e83
1 changed files with 2 additions and 4 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "crypto/common.h"
|
||||||
|
|
||||||
/** Template base class for fixed-sized opaque blobs. */
|
/** Template base class for fixed-sized opaque blobs. */
|
||||||
template<unsigned int BITS>
|
template<unsigned int BITS>
|
||||||
|
@ -119,13 +120,10 @@ public:
|
||||||
* used when the contents are considered uniformly random. It is not appropriate
|
* 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
|
* when the value can easily be influenced from outside as e.g. a network adversary could
|
||||||
* provide values to trigger worst-case behavior.
|
* 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 GetCheapHash() const
|
||||||
{
|
{
|
||||||
uint64_t result;
|
return ReadLE64(data);
|
||||||
memcpy((void*)&result, (void*)data, 8);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A more secure, salted hash function.
|
/** A more secure, salted hash function.
|
||||||
|
|
Loading…
Reference in a new issue