diff --git a/include/fc/crypto/sha256.hpp b/include/fc/crypto/sha256.hpp index 4d2d606..c40c83a 100644 --- a/include/fc/crypto/sha256.hpp +++ b/include/fc/crypto/sha256.hpp @@ -21,6 +21,7 @@ class sha256 static sha256 hash( const char* d, uint32_t dlen ); static sha256 hash( const string& ); + static sha256 hash( const sha256& ); template static sha256 hash( const T& t ) diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index 1c06108..ae1d6af 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -40,10 +40,16 @@ namespace fc { e.write(d,dlen); return e.result(); } + sha256 sha256::hash( const string& s ) { return hash( s.c_str(), s.size() ); } + sha256 sha256::hash( const sha256& s ) + { + return hash( s.data(), sizeof( s._hash ) ); + } + void sha256::encoder::write( const char* d, uint32_t dlen ) { SHA256_Update( &my->ctx, d, dlen); }