Define sha256::hash( sha256 )

This commit is contained in:
Vikram Rajkumar 2015-02-11 18:58:19 -05:00
parent 0bf2f9cfd4
commit ee370dd5a8
2 changed files with 7 additions and 0 deletions

View file

@ -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<typename T>
static sha256 hash( const T& t )

View file

@ -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);
}