Bitcoin ABC  0.29.2
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
CHashWriter Class Reference

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

#include <hash.h>

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

Public Member Functions

 CHashWriter (int nTypeIn, int nVersionIn)
 
int GetType () const
 
int GetVersion () const
 
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 >
CHashWriteroperator<< (const T &obj)
 

Private Attributes

CSHA256 ctx
 
const int nType
 
const int nVersion
 

Detailed Description

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

Definition at line 99 of file hash.h.

Constructor & Destructor Documentation

◆ CHashWriter()

CHashWriter::CHashWriter ( int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 107 of file hash.h.

Member Function Documentation

◆ GetCheapHash()

uint64_t CHashWriter::GetCheapHash ( )
inline

Returns the first 64 bits from the resulting hash.

Definition at line 145 of file hash.h.

Here is the call graph for this function:

◆ GetHash()

uint256 CHashWriter::GetHash ( )
inline

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

Invalidates this object.

Definition at line 122 of file hash.h.

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

◆ GetSHA256()

uint256 CHashWriter::GetSHA256 ( )
inline

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

Invalidates this object.

Definition at line 136 of file hash.h.

Here is the call graph for this function:

◆ GetType()

int CHashWriter::GetType ( ) const
inline

Definition at line 110 of file hash.h.

◆ GetVersion()

int CHashWriter::GetVersion ( ) const
inline

Definition at line 111 of file hash.h.

◆ operator<<()

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

Definition at line 150 of file hash.h.

Here is the call graph for this function:

◆ write()

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

Definition at line 113 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 CHashWriter::ctx
private

Definition at line 101 of file hash.h.

◆ nType

const int CHashWriter::nType
private

Definition at line 103 of file hash.h.

◆ nVersion

const int CHashWriter::nVersion
private

Definition at line 104 of file hash.h.


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