Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
HashWriter Class Reference

A writer stream (for serialization) that computes a 256-bit hash. More...

#include <hash.h>

Inheritance diagram for HashWriter:
[legend]
Collaboration diagram for HashWriter:
[legend]

Public Member Functions

void write (Span< const std::byte > src)
 
uint256 GetHash ()
 Compute the double-SHA256 hash of all data written to this object. More...
 
uint256 GetSHA256 ()
 Compute the SHA256 hash of all data written to this object. More...
 
uint64_t GetCheapHash ()
 Returns the first 64 bits from the resulting hash. More...
 
template<typename T >
HashWriteroperator<< (const T &obj)
 

Private Attributes

CSHA256 ctx
 

Detailed Description

A writer stream (for serialization) that computes a 256-bit hash.

Definition at line 100 of file hash.h.

Member Function Documentation

◆ GetCheapHash()

uint64_t HashWriter::GetCheapHash ( )
inline

Returns the first 64 bits from the resulting hash.

Definition at line 135 of file hash.h.

Here is the call graph for this function:

◆ GetHash()

uint256 HashWriter::GetHash ( )
inline

Compute the double-SHA256 hash of all data written to this object.

Invalidates this object.

Definition at line 115 of file hash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSHA256()

uint256 HashWriter::GetSHA256 ( )
inline

Compute the SHA256 hash of all data written to this object.

Invalidates this object.

Definition at line 126 of file hash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<<()

template<typename T >
HashWriter & HashWriter::operator<< ( const T obj)
inline

Definition at line 141 of file hash.h.

Here is the call graph for this function:

◆ write()

void HashWriter::write ( Span< const std::byte >  src)
inline

Definition at line 106 of file hash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ ctx

CSHA256 HashWriter::ctx
private

Definition at line 103 of file hash.h.


The documentation for this class was generated from the following file: