diff --git a/include/fc/crypto/sha256.hpp b/include/fc/crypto/sha256.hpp index f17e34e..96194e0 100644 --- a/include/fc/crypto/sha256.hpp +++ b/include/fc/crypto/sha256.hpp @@ -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 { diff --git a/src/crypto/elliptic.cpp b/src/crypto/elliptic.cpp index dda84f2..a3cf114 100644 --- a/src/crypto/elliptic.cpp +++ b/src/crypto/elliptic.cpp @@ -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 data; memcpy(data.data, key.begin(), key.size()); diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index e197a9d..1c06108 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -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