Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

hash.h File Reference
#include <crypto/ripemd160.h>
#include <crypto/sha256.h>
#include <prevector.h>
#include <serialize.h>
#include <uint256.h>
#include <version.h>
#include <crypto/sph_blake.h>
#include <crypto/sph_bmw.h>
#include <crypto/sph_groestl.h>
#include <crypto/sph_jh.h>
#include <crypto/sph_keccak.h>
#include <crypto/sph_skein.h>
#include <crypto/sph_luffa.h>
#include <crypto/sph_cubehash.h>
#include <crypto/sph_shavite.h>
#include <crypto/sph_simd.h>
#include <crypto/sph_echo.h>
#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  CHashWriter
 A writer stream (for serialization) that computes a 256-bit hash. More...
 
class  CHashVerifier< Source >
 Reads data from an underlying stream, while hashing the read data. More...
 
class  CSipHasher
 SipHash-2-4. More...
 

Typedefs

typedef uint256 ChainCode
 

Functions

template<typename T1 >
uint256 Hash (const T1 pbegin, const T1 pend)
 Compute the 256-bit hash of an object. More...
 
template<typename T1 , typename T2 >
uint256 Hash (const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end)
 Compute the 256-bit hash of the concatenation of two objects. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
uint256 Hash (const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end, const T3 p3begin, const T3 p3end, const T4 p4begin, const T4 p4end)
 Compute the 256-bit hash of the concatenation of three objects. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
uint256 Hash (const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end, const T3 p3begin, const T3 p3end, const T4 p4begin, const T4 p4end, const T5 p5begin, const T5 p5end)
 Compute the 256-bit hash of the concatenation of three objects. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
uint256 Hash (const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end, const T3 p3begin, const T3 p3end, const T4 p4begin, const T4 p4end, const T5 p5begin, const T5 p5end, const T6 p6begin, const T6 p6end)
 Compute the 256-bit hash of the concatenation of three objects. More...
 
template<typename T1 >
uint160 Hash160 (const T1 pbegin, const T1 pend)
 Compute the 160-bit hash an object. More...
 
uint160 Hash160 (const std::vector< unsigned char > &vch)
 Compute the 160-bit hash of a vector. More...
 
template<unsigned int N>
uint160 Hash160 (const prevector< N, unsigned char > &vch)
 Compute the 160-bit hash of a vector. More...
 
template<typename T >
uint256 SerializeHash (const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
 Compute the 256-bit hash of an object's serialization. More...
 
unsigned int MurmurHash3 (unsigned int nHashSeed, const std::vector< unsigned char > &vDataToHash)
 
void BIP32Hash (const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64])
 
uint64_t SipHashUint256 (uint64_t k0, uint64_t k1, const uint256 &val)
 Optimized SipHash-2-4 implementation for uint256. More...
 
uint64_t SipHashUint256Extra (uint64_t k0, uint64_t k1, const uint256 &val, uint32_t extra)
 
template<typename T1 >
uint256 HashX11 (const T1 pbegin, const T1 pend)
 

Typedef Documentation

◆ ChainCode

typedef uint256 ChainCode

Definition at line 31 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] 
)

◆ Hash() [1/5]

◆ Hash() [2/5]

template<typename T1 , typename T2 >
uint256 Hash ( const T1  p1begin,
const T1  p1end,
const T2  p2begin,
const T2  p2end 
)
inline

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

Definition at line 95 of file hash.h.

References CHash256::Finalize(), and CHash256::Write().

◆ Hash() [3/5]

template<typename T1 , typename T2 , typename T3 , typename T4 >
uint256 Hash ( const T1  p1begin,
const T1  p1end,
const T2  p2begin,
const T2  p2end,
const T3  p3begin,
const T3  p3end,
const T4  p4begin,
const T4  p4end 
)
inline

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

Definition at line 107 of file hash.h.

References CHash256::Finalize(), and CHash256::Write().

◆ Hash() [4/5]

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
uint256 Hash ( const T1  p1begin,
const T1  p1end,
const T2  p2begin,
const T2  p2end,
const T3  p3begin,
const T3  p3end,
const T4  p4begin,
const T4  p4end,
const T5  p5begin,
const T5  p5end 
)
inline

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

Definition at line 123 of file hash.h.

References CHash256::Finalize(), and CHash256::Write().

◆ Hash() [5/5]

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
uint256 Hash ( const T1  p1begin,
const T1  p1end,
const T2  p2begin,
const T2  p2end,
const T3  p3begin,
const T3  p3end,
const T4  p4begin,
const T4  p4end,
const T5  p5begin,
const T5  p5end,
const T6  p6begin,
const T6  p6end 
)
inline

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

Definition at line 141 of file hash.h.

References CHash256::Finalize(), and CHash256::Write().

◆ Hash160() [1/3]

template<typename T1 >
uint160 Hash160 ( const T1  pbegin,
const T1  pend 
)
inline

◆ Hash160() [2/3]

uint160 Hash160 ( const std::vector< unsigned char > &  vch)
inline

Compute the 160-bit hash of a vector.

Definition at line 171 of file hash.h.

References Hash160().

◆ Hash160() [3/3]

template<unsigned int N>
uint160 Hash160 ( const prevector< N, unsigned char > &  vch)
inline

Compute the 160-bit hash of a vector.

Definition at line 178 of file hash.h.

References prevector< N, T, Size, Diff >::begin(), prevector< N, T, Size, Diff >::end(), and Hash160().

◆ HashX11()

◆ MurmurHash3()

unsigned int MurmurHash3 ( unsigned int  nHashSeed,
const std::vector< unsigned char > &  vDataToHash 
)

Definition at line 15 of file hash.cpp.

References k1, ReadLE32(), and ROTL32().

Referenced by CBloomFilter::Hash(), and RollingBloomHash().

◆ SerializeHash()

template<typename T >
uint256 SerializeHash ( const T &  obj,
int  nType = SER_GETHASH,
int  nVersion = PROTOCOL_VERSION 
)

Compute the 256-bit hash of an object's serialization.

Definition at line 254 of file hash.h.

References CHashWriter::GetHash().

Referenced by llmq::CQuorumBlockProcessor::AddMinableCommitment(), CTxMemPool::addUnchecked(), CDeterministicMNList::AddUniqueProperty(), CalcCbTxMerkleRootQuorums(), llmq::CLLMQUtils::CalcDeterministicWatchConnections(), CheckHashSig(), CTransaction::ComputeHash(), CChainState::ConnectBlock(), CBLSIESMultiRecipientBlobs::Decrypt(), CDeterministicMNList::DeleteUniqueProperty(), llmq::CLLMQUtils::DeterministicOutboundConnection(), ECDSASign(), ECDSAVerify(), ECDSAVerify_LargeBlock(), llmq::CLLMQUtils::GetAllQuorumMembers(), CSporkMessage::GetHash(), CMutableTransaction::GetHash(), CGovernanceVote::GetSignatureHash(), CGovernanceObject::GetSignatureHash(), CPrivateSendQueue::GetSignatureHash(), CPrivateSendBroadcastTx::GetSignatureHash(), llmq::CDKGComplaint::GetSignHash(), llmq::CDKGJustification::GetSignHash(), CDeterministicMNList::GetUniquePropertyMN(), llmq::CInstantSendManager::HandleNewInputLockRecoveredSig(), llmq::CInstantSendManager::HandleNewInstantSendLockRecoveredSig(), llmq::CChainLocksHandler::HandleNewRecoveredSig(), CDeterministicMNList::HasUniqueProperty(), CBLSIESMultiRecipientBlobs::InitEncrypt(), CProRegTx::MakeSignString(), llmq::CInstantSendManager::ProcessInstantSendLock(), llmq::CQuorumBlockProcessor::ProcessMessage(), CMNAuth::ProcessMessage(), llmq::CChainLocksHandler::ProcessMessage(), llmq::CInstantSendManager::ProcessMessageInstantSendLock(), llmq::CChainLocksHandler::ProcessNewChainLock(), llmq::ProcessPendingMessageBatch(), llmq::CInstantSendManager::ProcessTx(), CMNAuth::PushMNAUTH(), llmq::CDKGSession::ReceiveMessage(), llmq::CInstantSendManager::RemoveConflictedTx(), CTxMemPool::removeProTxConflicts(), llmq::CSigSharesManager::SelectMemberForRecovery(), llmq::CDKGSession::SendCommitment(), llmq::CInstantSendManager::TruncateRecoveredSigsForInputs(), llmq::CChainLocksHandler::TrySignChainTip(), llmq::CInstantSendManager::TrySignInstantSendLock(), llmq::CRecoveredSig::UpdateHash(), and CBLSWrapper< bls::InsecureSignature, BLS_CURVE_SIG_SIZE, CBLSSignature >::UpdateHash().

◆ SipHashUint256()

uint64_t SipHashUint256 ( uint64_t  k0,
uint64_t  k1,
const uint256 val 
)

Optimized SipHash-2-4 implementation for uint256.

It is identical to: SipHasher(k0, k1) .Write(val.GetUint64(0)) .Write(val.GetUint64(1)) .Write(val.GetUint64(2)) .Write(val.GetUint64(3)) .Finalize()

Definition at line 168 of file hash.cpp.

References base_blob< BITS >::GetUint64(), k1, and SIPROUND.

Referenced by SaltedHasherImpl< uint256 >::CalcHash(), CBlockHeaderAndShortTxIDs::GetShortID(), HASH_SipHash_0032b(), and SaltedTxidHasher::operator()().

◆ SipHashUint256Extra()

uint64_t SipHashUint256Extra ( uint64_t  k0,
uint64_t  k1,
const uint256 val,
uint32_t  extra 
)
Released under the MIT license