27 void Finalize(
unsigned char hash[OUTPUT_SIZE]) {
51 void Finalize(
unsigned char hash[OUTPUT_SIZE]) {
72 static const unsigned char pblank[1] = {};
74 CHash256().
Write(pbegin == pend ? pblank : (
const unsigned char*)&pbegin[0], (pend - pbegin) *
sizeof(pbegin[0]))
80 template<
typename T1,
typename T2>
82 const T2 p2begin,
const T2 p2end) {
83 static const unsigned char pblank[1] = {};
85 CHash256().
Write(p1begin == p1end ? pblank : (
const unsigned char*)&p1begin[0], (p1end - p1begin) *
sizeof(p1begin[0]))
86 .
Write(p2begin == p2end ? pblank : (
const unsigned char*)&p2begin[0], (p2end - p2begin) *
sizeof(p2begin[0]))
92 template<
typename T1,
typename T2,
typename T3>
94 const T2 p2begin,
const T2 p2end,
95 const T3 p3begin,
const T3 p3end) {
96 static const unsigned char pblank[1] = {};
98 CHash256().
Write(p1begin == p1end ? pblank : (
const unsigned char*)&p1begin[0], (p1end - p1begin) *
sizeof(p1begin[0]))
99 .
Write(p2begin == p2end ? pblank : (
const unsigned char*)&p2begin[0], (p2end - p2begin) *
sizeof(p2begin[0]))
100 .
Write(p3begin == p3end ? pblank : (
const unsigned char*)&p3begin[0], (p3end - p3begin) *
sizeof(p3begin[0]))
106 template<
typename T1>
109 static unsigned char pblank[1] = {};
111 CHash160().
Write(pbegin == pend ? pblank : (
const unsigned char*)&pbegin[0], (pend - pbegin) *
sizeof(pbegin[0]))
119 return Hash160(vch.begin(), vch.end());
123 template<
unsigned int N>
139 CHashWriter(
int nTypeIn,
int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn) {}
145 ctx.
Write((
const unsigned char*)pch, size);
151 ctx.
Finalize((
unsigned char*)&result);
164 template<
typename Source>
173 void read(
char* pch,
size_t nSize)
175 source->read(pch, nSize);
176 this->
write(pch, nSize);
183 size_t now = std::min<size_t>(nSize, 1024);
207 unsigned int MurmurHash3(
unsigned int nHashSeed,
const std::vector<unsigned char>& vDataToHash);
209 void BIP32Hash(
const ChainCode &chainCode,
unsigned int nChild,
unsigned char header,
const unsigned char data[32],
unsigned char output[64]);
246 #endif // FABCOIN_HASH_H CSHA256 & Write(const unsigned char *data, size_t len)
void write(const char *pch, size_t size)
void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64])
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector< unsigned char > &vDataToHash)
Implementation of BufferedTransformation's attachment interface.
CHash256 & Write(const unsigned char *data, size_t len)
A hasher class for Fabcoin's 256-bit hash (double SHA-256).
uint160 Hash160(const T1 pbegin, const T1 pend)
Compute the 160-bit hash an object.
bool read(const std::string &s, Value &value)
void ignore(size_t nSize)
Reads data from an underlying stream, while hashing the read data.
uint64_t SipHashUint256(uint64_t k0, uint64_t k1, const uint256 &val)
Optimized SipHash-2-4 implementation for uint256.
void Serialize(Stream &s, char a)
void Finalize(unsigned char hash[OUTPUT_SIZE])
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
static const size_t OUTPUT_SIZE
void Finalize(unsigned char hash[OUTPUT_SIZE])
void write(const Value &value, std::ostream &os)
CHash160 & Write(const unsigned char *data, size_t len)
CHashVerifier< Source > & operator>>(T &obj)
uint256 Hash(const T1 pbegin, const T1 pend)
Compute the 256-bit hash of an object.
CHashWriter(int nTypeIn, int nVersionIn)
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
CRIPEMD160 & Write(const unsigned char *data, size_t len)
uint8_t const size_t const size
void Finalize(unsigned char hash[OUTPUT_SIZE])
CHashVerifier(Source *source_)
uint64_t SipHashUint256Extra(uint64_t k0, uint64_t k1, const uint256 &val, uint32_t extra)
static const size_t OUTPUT_SIZE
static const size_t OUTPUT_SIZE
CHashWriter & operator<<(const T &obj)
void Unserialize(Stream &s, char &a)
void read(char *pch, size_t nSize)
A writer stream (for serialization) that computes a 256-bit hash.
A hasher class for Fabcoin's 160-bit hash (SHA-256 + RIPEMD-160).
void Finalize(unsigned char hash[OUTPUT_SIZE])
A hasher class for SHA-256.
A hasher class for RIPEMD-160.