Bitcoin Core  27.99.0
P2P Digital Currency
Classes | Typedefs | Functions
hash.h File Reference
#include <attributes.h>
#include <crypto/common.h>
#include <crypto/ripemd160.h>
#include <crypto/sha256.h>
#include <prevector.h>
#include <serialize.h>
#include <span.h>
#include <uint256.h>
#include <string>
#include <vector>
Include dependency graph for hash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CHash256
 A hasher class for Bitcoin's 256-bit hash (double SHA-256). More...
 
class  CHash160
 A hasher class for Bitcoin's 160-bit hash (SHA-256 + RIPEMD-160). More...
 
class  HashWriter
 A writer stream (for serialization) that computes a 256-bit hash. More...
 
class  HashVerifier< Source >
 Reads data from an underlying stream, while hashing the read data. More...
 
class  HashedSourceWriter< Source >
 Writes data to an underlying source stream, while hashing the written data. More...
 

Typedefs

typedef uint256 ChainCode
 

Functions

template<typename T >
uint256 Hash (const T &in1)
 Compute the 256-bit hash of an object. More...
 
template<typename T1 , typename T2 >
uint256 Hash (const T1 &in1, const T2 &in2)
 Compute the 256-bit hash of the concatenation of two objects. More...
 
template<typename T1 >
uint160 Hash160 (const T1 &in1)
 Compute the 160-bit hash an object. More...
 
uint256 SHA256Uint256 (const uint256 &input)
 Single-SHA256 a 32-byte input (represented as uint256). More...
 
unsigned int MurmurHash3 (unsigned int nHashSeed, Span< const unsigned char > vDataToHash)
 
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). More...
 
uint160 RIPEMD160 (Span< const unsigned char > data)
 Compute the 160-bit RIPEMD-160 hash of an array. More...
 

Typedef Documentation

◆ ChainCode

typedef uint256 ChainCode

Definition at line 21 of file hash.h.

Function Documentation

◆ BIP32Hash()

void BIP32Hash ( const ChainCode chainCode,
unsigned int  nChild,
unsigned char  header,
const unsigned char  data[32],
unsigned char  output[64] 
)

Definition at line 71 of file hash.cpp.

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

◆ Hash() [1/2]

template<typename T >
uint256 Hash ( const T &  in1)
inline

Compute the 256-bit hash of an object.

Definition at line 75 of file hash.h.

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

◆ Hash() [2/2]

template<typename T1 , typename T2 >
uint256 Hash ( const T1 &  in1,
const T2 &  in2 
)
inline

Compute the 256-bit hash of the concatenation of two objects.

Definition at line 84 of file hash.h.

Here is the call graph for this function:

◆ Hash160()

template<typename T1 >
uint160 Hash160 ( const T1 &  in1)
inline

Compute the 160-bit hash an object.

Definition at line 92 of file hash.h.

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

◆ MurmurHash3()

unsigned int MurmurHash3 ( unsigned int  nHashSeed,
Span< const unsigned char >  vDataToHash 
)

Definition at line 13 of file hash.cpp.

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

◆ RIPEMD160()

uint160 RIPEMD160 ( Span< const unsigned char >  data)
inline

Compute the 160-bit RIPEMD-160 hash of an array.

Definition at line 222 of file hash.h.

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

◆ SHA256Uint256()

uint256 SHA256Uint256 ( const uint256 input)

Single-SHA256 a 32-byte input (represented as uint256).

Definition at line 78 of file hash.cpp.

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

◆ TaggedHash()

HashWriter TaggedHash ( const std::string &  tag)

Return a HashWriter primed for tagged hashes (as specified in BIP 340).

The returned object will have SHA256(tag) written to it twice (= 64 bytes). A tagged hash can be computed by feeding the message into this object, and then calling HashWriter::GetSHA256().

Definition at line 85 of file hash.cpp.

Here is the call graph for this function: