83 template<
typename T1,
typename T2>
140 template <
typename T>
149 template <
typename Source>
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>
183 template <
typename Source>
198 template <
typename T>
211 void BIP32Hash(
const ChainCode &chainCode,
unsigned int nChild,
unsigned char header,
const unsigned char data[32],
unsigned char output[64]);
229 #endif // BITCOIN_HASH_H uint256 GetHash()
Compute the double-SHA256 hash of all data written to this object.
CSHA256 & Write(const unsigned char *data, size_t len)
void read(Span< std::byte > dst)
void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64])
void Finalize(Span< unsigned char > output)
void Finalize(Span< unsigned char > output)
unsigned int MurmurHash3(unsigned int nHashSeed, Span< const unsigned char > vDataToHash)
constexpr std::size_t size() const noexcept
A hasher class for Bitcoin's 256-bit hash (double SHA-256).
HashWriter & operator<<(const T &obj)
uint160 RIPEMD160(Span< const unsigned char > data)
Compute the 160-bit RIPEMD-160 hash of an array.
static const size_t OUTPUT_SIZE
void ignore(size_t num_bytes)
HashedSourceWriter(Source &source LIFETIMEBOUND)
uint256 SHA256Uint256(const uint256 &input)
Single-SHA256 a 32-byte input (represented as uint256).
void Unserialize(Stream &, V)=delete
uint256 GetSHA256()
Compute the SHA256 hash of all data written to this object.
void write(Span< const std::byte > src)
static const size_t OUTPUT_SIZE
HashVerifier(Source &source LIFETIMEBOUND)
A writer stream (for serialization) that computes a 256-bit hash.
uint64_t ReadLE64(const B *ptr)
void Finalize(unsigned char hash[OUTPUT_SIZE])
HashWriter TaggedHash(const std::string &tag)
Return a HashWriter primed for tagged hashes (as specified in BIP 340).
void write(Span< const std::byte > src)
CRIPEMD160 & Write(const unsigned char *data, size_t len)
uint160 Hash160(const T1 &in1)
Compute the 160-bit hash an object.
constexpr C * data() const noexcept
HashedSourceWriter & operator<<(const T &obj)
HashVerifier< Source > & operator>>(T &&obj)
uint64_t GetCheapHash()
Returns the first 64 bits from the resulting hash.
constexpr auto MakeUCharSpan(V &&v) -> decltype(UCharSpanCast(Span
Like the Span constructor, but for (const) unsigned char member types only.
static const size_t OUTPUT_SIZE
static const size_t OUTPUT_SIZE
Writes data to an underlying source stream, while hashing the written data.
unsigned char * UCharCast(char *c)
Reads data from an underlying stream, while hashing the read data.
A Span is an object that can refer to a contiguous sequence of objects.
uint256 Hash(const T &in1)
Compute the 256-bit hash of an object.
A hasher class for Bitcoin's 160-bit hash (SHA-256 + RIPEMD-160).
void Finalize(unsigned char hash[OUTPUT_SIZE])
A hasher class for SHA-256.
CHash160 & Write(Span< const unsigned char > input)
CHash256 & Write(Span< const unsigned char > input)
A hasher class for RIPEMD-160.