added hash64 function that uses sha256 to replace city_hash in blockchain and message protocol-related hashing
This commit is contained in:
parent
bdeefb48bf
commit
f09c91f878
3 changed files with 11 additions and 2 deletions
|
|
@ -81,6 +81,8 @@ class sha256
|
|||
void to_variant( const sha256& bi, variant& v );
|
||||
void from_variant( const variant& v, sha256& bi );
|
||||
|
||||
uint64_t hash64(const char* buf, size_t len);
|
||||
|
||||
} // fc
|
||||
namespace std
|
||||
{
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ namespace fc { namespace ecc {
|
|||
std::string public_key::to_base58() const
|
||||
{
|
||||
public_key_data key = serialize();
|
||||
uint32_t check = uint32_t(city_hash64(key.data, sizeof(key)));
|
||||
uint32_t check = uint32_t(fc::hash64(key.data, sizeof(key)));
|
||||
assert(key.size() + sizeof(check) == 37);
|
||||
array<char, 37> data;
|
||||
memcpy(data.data, key.begin(), key.size());
|
||||
|
|
|
|||
|
|
@ -103,4 +103,11 @@ namespace fc {
|
|||
else
|
||||
memset( &bi, char(0), sizeof(bi) );
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t hash64(const char* buf, size_t len)
|
||||
{
|
||||
sha256 sha_value = sha256::hash(buf,len);
|
||||
return sha_value._hash[0];
|
||||
}
|
||||
|
||||
} //end namespace fc
|
||||
|
|
|
|||
Loading…
Reference in a new issue