fix sha224 serialization / sizeof

This commit is contained in:
Daniel Larimer 2013-07-05 20:29:07 -04:00
parent 4307054c9c
commit a8ab947b20
2 changed files with 4 additions and 6 deletions

View file

@ -45,6 +45,7 @@ class sha224
template<typename T>
inline friend T& operator<<( T& ds, const sha224& ep ) {
static_assert( sizeof(ep) == (8*3+4), "sha224 size mismatch" );
ds.write( ep.data(), sizeof(ep) );
return ds;
}
@ -62,8 +63,7 @@ class sha224
friend bool operator > ( const sha224& h1, const sha224& h2 );
friend bool operator < ( const sha224& h1, const sha224& h2 );
uint64_t _hash[3];
uint32_t _hash4;
uint32_t _hash[7];
};
class variant;

View file

@ -61,10 +61,8 @@ namespace fc {
}
sha224 operator ^ ( const sha224& h1, const sha224& h2 ) {
sha224 result;
result._hash[0] = h1._hash[0] ^ h2._hash[0];
result._hash[1] = h1._hash[1] ^ h2._hash[1];
result._hash[2] = h1._hash[2] ^ h2._hash[2];
result._hash4 = h1._hash4 ^ h2._hash4;
for( uint32_t i = 0; i < 7; ++i )
result._hash[i] = h1._hash[i] ^ h2._hash[i];
return result;
}
bool operator >= ( const sha224& h1, const sha224& h2 ) {