Dash Core  0.12.2.1
P2P Digital Currency
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>

Go to the source code of this file.

Classes

class  CHash256
 
class  CHash160
 
class  CHashWriter
 

Macros

#define GLOBAL   extern
 
#define fillz()
 
#define ZBLAKE   (memcpy(&ctx_blake, &z_blake, sizeof(z_blake)))
 
#define ZBMW   (memcpy(&ctx_bmw, &z_bmw, sizeof(z_bmw)))
 
#define ZGROESTL   (memcpy(&ctx_groestl, &z_groestl, sizeof(z_groestl)))
 
#define ZJH   (memcpy(&ctx_jh, &z_jh, sizeof(z_jh)))
 
#define ZKECCAK   (memcpy(&ctx_keccak, &z_keccak, sizeof(z_keccak)))
 
#define ZSKEIN   (memcpy(&ctx_skein, &z_skein, sizeof(z_skein)))
 

Typedefs

typedef uint256 ChainCode
 

Functions

template<typename T1 >
uint256 Hash (const T1 pbegin, const T1 pend)
 
template<typename T1 , typename T2 >
uint256 Hash (const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end)
 
template<typename T1 , typename T2 , typename T3 >
uint256 Hash (const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end, const T3 p3begin, const T3 p3end)
 
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)
 
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)
 
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)
 
template<typename T1 >
uint160 Hash160 (const T1 pbegin, const T1 pend)
 
uint160 Hash160 (const std::vector< unsigned char > &vch)
 
template<unsigned int N>
uint160 Hash160 (const prevector< N, unsigned char > &vch)
 
template<typename T >
uint256 SerializeHash (const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
 
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])
 
template<typename T1 >
uint256 HashX11 (const T1 pbegin, const T1 pend)
 

Variables

GLOBAL sph_blake512_context z_blake
 
GLOBAL sph_bmw512_context z_bmw
 
GLOBAL sph_groestl512_context z_groestl
 
GLOBAL sph_jh512_context z_jh
 
GLOBAL sph_keccak512_context z_keccak
 
GLOBAL sph_skein512_context z_skein
 
GLOBAL sph_luffa512_context z_luffa
 
GLOBAL sph_cubehash512_context z_cubehash
 
GLOBAL sph_shavite512_context z_shavite
 
GLOBAL sph_simd512_context z_simd
 
GLOBAL sph_echo512_context z_echo
 

Macro Definition Documentation

◆ fillz

#define fillz ( )
Value:
do { \
sph_blake512_init(&z_blake); \
sph_bmw512_init(&z_bmw); \
sph_groestl512_init(&z_groestl); \
sph_jh512_init(&z_jh); \
sph_keccak512_init(&z_keccak); \
sph_skein512_init(&z_skein); \
sph_luffa512_init(&z_luffa); \
sph_cubehash512_init(&z_cubehash); \
sph_shavite512_init(&z_shavite); \
sph_simd512_init(&z_simd); \
sph_echo512_init(&z_echo); \
} while (0)
GLOBAL sph_blake512_context z_blake
Definition: hash.h:39
GLOBAL sph_shavite512_context z_shavite
Definition: hash.h:47
GLOBAL sph_cubehash512_context z_cubehash
Definition: hash.h:46
GLOBAL sph_keccak512_context z_keccak
Definition: hash.h:43
GLOBAL sph_echo512_context z_echo
Definition: hash.h:49
GLOBAL sph_luffa512_context z_luffa
Definition: hash.h:45
GLOBAL sph_simd512_context z_simd
Definition: hash.h:48
GLOBAL sph_groestl512_context z_groestl
Definition: hash.h:41
GLOBAL sph_bmw512_context z_bmw
Definition: hash.h:40
GLOBAL sph_jh512_context z_jh
Definition: hash.h:42
GLOBAL sph_skein512_context z_skein
Definition: hash.h:44

Definition at line 51 of file hash.h.

◆ GLOBAL

#define GLOBAL   extern

Definition at line 36 of file hash.h.

◆ ZBLAKE

#define ZBLAKE   (memcpy(&ctx_blake, &z_blake, sizeof(z_blake)))

Definition at line 65 of file hash.h.

◆ ZBMW

#define ZBMW   (memcpy(&ctx_bmw, &z_bmw, sizeof(z_bmw)))

Definition at line 66 of file hash.h.

◆ ZGROESTL

#define ZGROESTL   (memcpy(&ctx_groestl, &z_groestl, sizeof(z_groestl)))

Definition at line 67 of file hash.h.

◆ ZJH

#define ZJH   (memcpy(&ctx_jh, &z_jh, sizeof(z_jh)))

Definition at line 68 of file hash.h.

◆ ZKECCAK

#define ZKECCAK   (memcpy(&ctx_keccak, &z_keccak, sizeof(z_keccak)))

Definition at line 69 of file hash.h.

◆ ZSKEIN

#define ZSKEIN   (memcpy(&ctx_skein, &z_skein, sizeof(z_skein)))

Definition at line 70 of file hash.h.

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] 
)

Definition at line 75 of file hash.cpp.

Referenced by CKey::Derive(), and CPubKey::Derive().

◆ Hash() [1/6]

◆ Hash() [2/6]

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 134 of file hash.h.

◆ Hash() [3/6]

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

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

Definition at line 146 of file hash.h.

◆ Hash() [4/6]

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 160 of file hash.h.

◆ Hash() [5/6]

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 176 of file hash.h.

◆ Hash() [6/6]

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 194 of file hash.h.

◆ Hash160() [1/3]

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

Compute the 160-bit hash an object.

Definition at line 214 of file hash.h.

Referenced by CWallet::AddCScript(), CPubKey::GetID(), and Hash160().

◆ Hash160() [2/3]

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

Compute the 160-bit hash of a vector.

Definition at line 224 of file hash.h.

◆ 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 231 of file hash.h.

◆ HashX11()

template<typename T1 >
uint256 HashX11 ( const T1  pbegin,
const T1  pend 
)
inline

Definition at line 283 of file hash.h.

Referenced by CBlockHeader::GetHash().

◆ MurmurHash3()

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

Definition at line 16 of file hash.cpp.

Referenced by CBloomFilter::Hash().

◆ 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 270 of file hash.h.

Referenced by CTxOut::GetHash(), CMutableTransaction::GetHash(), and CTransaction::UpdateHash().

Variable Documentation

◆ z_blake

GLOBAL sph_blake512_context z_blake

Definition at line 39 of file hash.h.

◆ z_bmw

GLOBAL sph_bmw512_context z_bmw

Definition at line 40 of file hash.h.

◆ z_cubehash

Definition at line 46 of file hash.h.

◆ z_echo

Definition at line 49 of file hash.h.

◆ z_groestl

Definition at line 41 of file hash.h.

◆ z_jh

Definition at line 42 of file hash.h.

◆ z_keccak

Definition at line 43 of file hash.h.

◆ z_luffa

Definition at line 45 of file hash.h.

◆ z_shavite

Definition at line 47 of file hash.h.

◆ z_simd

Definition at line 48 of file hash.h.

◆ z_skein

GLOBAL sph_skein512_context z_skein

Definition at line 44 of file hash.h.