From ee370dd5a88f1d1ea406c0b119fe2ed62b58335e Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Wed, 11 Feb 2015 18:58:19 -0500 Subject: [PATCH] Define sha256::hash( sha256 ) --- include/fc/crypto/sha256.hpp | 1 + src/crypto/sha256.cpp | 6 ++++++ 2 files changed, 7 insertions(+) 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); }