83template<
typename T1,
typename T2>
114 void write(
const char *pch,
size_t size) {
115 ctx.
Write((
const unsigned char*)pch, size);
156template<
typename Source>
165 void read(
char* pch,
size_t nSize)
168 this->
write(pch, nSize);
175 size_t now = std::min<size_t>(nSize, 1024);
204void BIP32Hash(
const ChainCode &chainCode,
unsigned int nChild,
unsigned char header,
const unsigned char data[32],
unsigned char output[64]);
A hasher class for Bitcoin's 160-bit hash (SHA-256 + RIPEMD-160).
static const size_t OUTPUT_SIZE
void Finalize(Span< unsigned char > output)
CHash160 & Write(Span< const unsigned char > input)
A hasher class for Bitcoin's 256-bit hash (double SHA-256).
void Finalize(Span< unsigned char > output)
CHash256 & Write(Span< const unsigned char > input)
static const size_t OUTPUT_SIZE
Reads data from an underlying stream, while hashing the read data.
CHashVerifier(Source *source_)
void ignore(size_t nSize)
CHashVerifier< Source > & operator>>(T &&obj)
void read(char *pch, size_t nSize)
A writer stream (for serialization) that computes a 256-bit hash.
uint64_t GetCheapHash()
Returns the first 64 bits from the resulting hash.
CHashWriter & operator<<(const T &obj)
uint256 GetSHA256()
Compute the SHA256 hash of all data written to this object.
CHashWriter(int nTypeIn, int nVersionIn)
void write(const char *pch, size_t size)
uint256 GetHash()
Compute the double-SHA256 hash of all data written to this object.
A hasher class for RIPEMD-160.
CRIPEMD160 & Write(const unsigned char *data, size_t len)
void Finalize(unsigned char hash[OUTPUT_SIZE])
static const size_t OUTPUT_SIZE
A hasher class for SHA-256.
static const size_t OUTPUT_SIZE
void Finalize(unsigned char hash[OUTPUT_SIZE])
CSHA256 & Write(const unsigned char *data, size_t len)
A Span is an object that can refer to a contiguous sequence of objects.
constexpr std::size_t size() const noexcept
constexpr C * data() const noexcept
static uint64_t ReadLE64(const unsigned char *ptr)
uint160 Hash160(const T1 &in1)
Compute the 160-bit hash an object.
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, Span< const unsigned char > vDataToHash)
CHashWriter TaggedHash(const std::string &tag)
Return a CHashWriter primed for tagged hashes (as specified in BIP 340).
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
uint256 Hash(const T &in1)
Compute the 256-bit hash of an object.
uint256 SHA256Uint256(const uint256 &input)
Single-SHA256 a 32-byte input (represented as uint256).
#define T(expected, seed, data)
void Serialize(Stream &s, char a)
void Unserialize(Stream &s, char &a)
constexpr auto MakeUCharSpan(V &&v) -> decltype(UCharSpanCast(MakeSpan(std::forward< V >(v))))
Like MakeSpan, but for (const) unsigned char member types only.
static const int PROTOCOL_VERSION
network protocol versioning