Define sha256::hash( sha256 )
This commit is contained in:
parent
0bf2f9cfd4
commit
ee370dd5a8
2 changed files with 7 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ class sha256
|
||||||
|
|
||||||
static sha256 hash( const char* d, uint32_t dlen );
|
static sha256 hash( const char* d, uint32_t dlen );
|
||||||
static sha256 hash( const string& );
|
static sha256 hash( const string& );
|
||||||
|
static sha256 hash( const sha256& );
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static sha256 hash( const T& t )
|
static sha256 hash( const T& t )
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,16 @@ namespace fc {
|
||||||
e.write(d,dlen);
|
e.write(d,dlen);
|
||||||
return e.result();
|
return e.result();
|
||||||
}
|
}
|
||||||
|
|
||||||
sha256 sha256::hash( const string& s ) {
|
sha256 sha256::hash( const string& s ) {
|
||||||
return hash( s.c_str(), s.size() );
|
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 ) {
|
void sha256::encoder::write( const char* d, uint32_t dlen ) {
|
||||||
SHA256_Update( &my->ctx, d, dlen);
|
SHA256_Update( &my->ctx, d, dlen);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue