Back hashes with boost endian buffers
This commit is contained in:
parent
5a9cf32696
commit
9568948350
10 changed files with 34 additions and 31 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <boost/endian/buffers.hpp>
|
||||
#include <fc/fwd.hpp>
|
||||
#include <fc/io/raw_fwd.hpp>
|
||||
#include <fc/reflect/typename.hpp>
|
||||
|
|
@ -68,7 +68,7 @@ class ripemd160
|
|||
friend bool operator > ( const ripemd160& h1, const ripemd160& h2 );
|
||||
friend bool operator < ( const ripemd160& h1, const ripemd160& h2 );
|
||||
|
||||
uint32_t _hash[5];
|
||||
boost::endian::little_uint32_buf_t _hash[5];
|
||||
};
|
||||
|
||||
namespace raw {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <boost/endian/buffers.hpp>
|
||||
#include <fc/fwd.hpp>
|
||||
|
||||
#include <functional>
|
||||
|
|
@ -64,7 +65,7 @@ class sha1
|
|||
friend bool operator > ( const sha1& h1, const sha1& h2 );
|
||||
friend bool operator < ( const sha1& h1, const sha1& h2 );
|
||||
|
||||
uint32_t _hash[5];
|
||||
boost::endian::little_uint32_buf_t _hash[5];
|
||||
};
|
||||
|
||||
class variant;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include <unordered_map>
|
||||
#include <boost/endian/buffers.hpp>
|
||||
#include <fc/fwd.hpp>
|
||||
#include <fc/io/raw_fwd.hpp>
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ class sha224
|
|||
friend bool operator > ( const sha224& h1, const sha224& h2 );
|
||||
friend bool operator < ( const sha224& h1, const sha224& h2 );
|
||||
|
||||
uint32_t _hash[7];
|
||||
boost::endian::little_uint32_buf_t _hash[7];
|
||||
};
|
||||
|
||||
namespace raw {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <boost/endian/buffers.hpp>
|
||||
#include <fc/fwd.hpp>
|
||||
#include <fc/platform_independence.hpp>
|
||||
#include <fc/string.hpp>
|
||||
#include <fc/io/raw_fwd.hpp>
|
||||
|
||||
namespace fc
|
||||
|
|
@ -67,7 +68,7 @@ class sha256
|
|||
friend bool operator > ( const sha256& h1, const sha256& h2 );
|
||||
friend bool operator < ( const sha256& h1, const sha256& h2 );
|
||||
|
||||
uint64_t _hash[4];
|
||||
boost::endian::little_uint64_buf_t _hash[4];
|
||||
};
|
||||
|
||||
namespace raw {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <boost/endian/buffers.hpp>
|
||||
#include <fc/fwd.hpp>
|
||||
|
||||
namespace fc
|
||||
|
|
@ -62,7 +63,7 @@ class sha512
|
|||
friend bool operator > ( const sha512& h1, const sha512& h2 );
|
||||
friend bool operator < ( const sha512& h1, const sha512& h2 );
|
||||
|
||||
uint64_t _hash[8];
|
||||
boost::endian::little_uint64_buf_t _hash[8];
|
||||
};
|
||||
|
||||
namespace raw {
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@ ripemd160 operator << ( const ripemd160& h1, uint32_t i ) {
|
|||
}
|
||||
ripemd160 operator ^ ( const ripemd160& h1, const ripemd160& h2 ) {
|
||||
ripemd160 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._hash[3] = h1._hash[3] ^ h2._hash[3];
|
||||
result._hash[4] = h1._hash[4] ^ h2._hash[4];
|
||||
result._hash[0] = h1._hash[0].value() ^ h2._hash[0].value();
|
||||
result._hash[1] = h1._hash[1].value() ^ h2._hash[1].value();
|
||||
result._hash[2] = h1._hash[2].value() ^ h2._hash[2].value();
|
||||
result._hash[3] = h1._hash[3].value() ^ h2._hash[3].value();
|
||||
result._hash[4] = h1._hash[4].value() ^ h2._hash[4].value();
|
||||
return result;
|
||||
}
|
||||
bool operator >= ( const ripemd160& h1, const ripemd160& h2 ) {
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@ sha1 operator << ( const sha1& h1, uint32_t i ) {
|
|||
}
|
||||
sha1 operator ^ ( const sha1& h1, const sha1& h2 ) {
|
||||
sha1 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._hash[3] = h1._hash[3] ^ h2._hash[3];
|
||||
result._hash[4] = h1._hash[4] ^ h2._hash[4];
|
||||
result._hash[0] = h1._hash[0].value() ^ h2._hash[0].value();
|
||||
result._hash[1] = h1._hash[1].value() ^ h2._hash[1].value();
|
||||
result._hash[2] = h1._hash[2].value() ^ h2._hash[2].value();
|
||||
result._hash[3] = h1._hash[3].value() ^ h2._hash[3].value();
|
||||
result._hash[4] = h1._hash[4].value() ^ h2._hash[4].value();
|
||||
return result;
|
||||
}
|
||||
bool operator >= ( const sha1& h1, const sha1& h2 ) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace fc {
|
|||
sha224 operator ^ ( const sha224& h1, const sha224& h2 ) {
|
||||
sha224 result;
|
||||
for( uint32_t i = 0; i < 7; ++i )
|
||||
result._hash[i] = h1._hash[i] ^ h2._hash[i];
|
||||
result._hash[i] = h1._hash[i].value() ^ h2._hash[i].value();
|
||||
return result;
|
||||
}
|
||||
bool operator >= ( const sha224& h1, const sha224& h2 ) {
|
||||
|
|
|
|||
|
|
@ -77,10 +77,10 @@ namespace fc {
|
|||
}
|
||||
sha256 operator ^ ( const sha256& h1, const sha256& h2 ) {
|
||||
sha256 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._hash[3] = h1._hash[3] ^ h2._hash[3];
|
||||
result._hash[0] = h1._hash[0].value() ^ h2._hash[0].value();
|
||||
result._hash[1] = h1._hash[1].value() ^ h2._hash[1].value();
|
||||
result._hash[2] = h1._hash[2].value() ^ h2._hash[2].value();
|
||||
result._hash[3] = h1._hash[3].value() ^ h2._hash[3].value();
|
||||
return result;
|
||||
}
|
||||
bool operator >= ( const sha256& h1, const sha256& h2 ) {
|
||||
|
|
|
|||
|
|
@ -59,14 +59,14 @@ namespace fc {
|
|||
}
|
||||
sha512 operator ^ ( const sha512& h1, const sha512& h2 ) {
|
||||
sha512 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._hash[3] = h1._hash[3] ^ h2._hash[3];
|
||||
result._hash[4] = h1._hash[4] ^ h2._hash[4];
|
||||
result._hash[5] = h1._hash[5] ^ h2._hash[5];
|
||||
result._hash[6] = h1._hash[6] ^ h2._hash[6];
|
||||
result._hash[7] = h1._hash[7] ^ h2._hash[7];
|
||||
result._hash[0] = h1._hash[0].value() ^ h2._hash[0].value();
|
||||
result._hash[1] = h1._hash[1].value() ^ h2._hash[1].value();
|
||||
result._hash[2] = h1._hash[2].value() ^ h2._hash[2].value();
|
||||
result._hash[3] = h1._hash[3].value() ^ h2._hash[3].value();
|
||||
result._hash[4] = h1._hash[4].value() ^ h2._hash[4].value();
|
||||
result._hash[5] = h1._hash[5].value() ^ h2._hash[5].value();
|
||||
result._hash[6] = h1._hash[6].value() ^ h2._hash[6].value();
|
||||
result._hash[7] = h1._hash[7].value() ^ h2._hash[7].value();
|
||||
return result;
|
||||
}
|
||||
bool operator >= ( const sha512& h1, const sha512& h2 ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue