82template <
typename T1,
typename T2>
185 std::byte data[1024];
187 size_t now = std::min<size_t>(nSize, 1024);
A hasher class for Bitcoin's 160-bit hash (SHA-256 + RIPEMD-160).
static const size_t OUTPUT_SIZE
CHash160 & Write(Span< const uint8_t > input)
void Finalize(Span< uint8_t > output)
A hasher class for Bitcoin's 256-bit hash (double SHA-256).
CHash256 & Write(Span< const uint8_t > input)
void Finalize(Span< uint8_t > output)
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(Span< std::byte > dst)
CHashWriter & operator<<(const T &obj)
CHashWriter(int nTypeIn, int nVersionIn)
A hasher class for RIPEMD-160.
CRIPEMD160 & Write(const uint8_t *data, size_t len)
void Finalize(uint8_t hash[OUTPUT_SIZE])
static const size_t OUTPUT_SIZE
A hasher class for SHA-256.
CSHA256 & Write(const uint8_t *data, size_t len)
static const size_t OUTPUT_SIZE
void Finalize(uint8_t hash[OUTPUT_SIZE])
A writer stream (for serialization) that computes a 256-bit hash.
void write(Span< const std::byte > src)
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.
Writes data to an underlying source stream, while hashing the written data.
HashedSourceWriter & operator<<(const T &obj)
void write(Span< const std::byte > src)
HashedSourceWriter(Source &source LIFETIMEBOUND)
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 uint8_t *ptr)
uint160 Hash160(const T1 &in1)
Compute the 160-bit hash an object.
uint32_t MurmurHash3(uint32_t nHashSeed, Span< const uint8_t > vDataToHash)
void BIP32Hash(const ChainCode &chainCode, uint32_t nChild, uint8_t header, const uint8_t data[32], uint8_t output[64])
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.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
void Unserialize(Stream &, char)=delete
void Serialize(Stream &, char)=delete
uint8_t * UCharCast(char *c)
constexpr auto MakeUCharSpan(V &&v) -> decltype(UCharSpanCast(Span{std::forward< V >(v)}))
Like the Span constructor, but for (const) uint8_t member types only.
static const int PROTOCOL_VERSION
network protocol versioning