30 void Finalize(std::span<unsigned char> output) {
38 sha.
Write(input.data(), input.size());
55 void Finalize(std::span<unsigned char> output) {
63 sha.
Write(input.data(), input.size());
83template<
typename T1,
typename T2>
106 void write(std::span<const std::byte> src)
140 template <
typename T>
149template <
typename Source>
158 void read(std::span<std::byte> dst)
166 std::byte
data[1024];
167 while (num_bytes > 0) {
168 size_t now = std::min<size_t>(num_bytes, 1024);
174 template <
typename T>
183template <
typename Source>
192 void write(std::span<const std::byte> src)
198 template <
typename T>
209unsigned int MurmurHash3(
unsigned int nHashSeed, std::span<const unsigned char> vDataToHash);
211void 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
CHash160 & Write(std::span< const unsigned char > input)
void Finalize(std::span< unsigned char > output)
A hasher class for Bitcoin's 256-bit hash (double SHA-256).
static const size_t OUTPUT_SIZE
void Finalize(std::span< unsigned char > output)
CHash256 & Write(std::span< const unsigned char > input)
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)
Reads data from an underlying stream, while hashing the read data.
void read(std::span< std::byte > dst)
HashVerifier(Source &source LIFETIMEBOUND)
void ignore(size_t num_bytes)
HashVerifier< Source > & operator>>(T &&obj)
A writer stream (for serialization) that computes a 256-bit hash.
HashWriter & operator<<(const T &obj)
uint64_t GetCheapHash()
Returns the first 64 bits from the resulting hash.
uint256 GetHash()
Compute the double-SHA256 hash of all data written to this object.
uint256 GetSHA256()
Compute the SHA256 hash of all data written to this object.
void write(std::span< const std::byte > src)
Writes data to an underlying source stream, while hashing the written data.
HashedSourceWriter & operator<<(const T &obj)
void write(std::span< const std::byte > src)
HashedSourceWriter(Source &source LIFETIMEBOUND)
constexpr unsigned char * begin()
uint64_t ReadLE64(const B *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])
HashWriter TaggedHash(const std::string &tag)
Return a HashWriter primed for tagged hashes (as specified in BIP 340).
uint160 RIPEMD160(std::span< const unsigned char > data)
Compute the 160-bit RIPEMD-160 hash of an array.
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).
unsigned int MurmurHash3(unsigned int nHashSeed, std::span< const unsigned char > vDataToHash)
void Serialize(Stream &, V)=delete
void Unserialize(Stream &, V)=delete
constexpr auto MakeUCharSpan(const V &v) -> decltype(UCharSpanCast(std::span{v}))
Like the std::span constructor, but for (const) unsigned char member types only.
unsigned char * UCharCast(char *c)