PIVX Core  5.6.99
P2P Digital Currency
Classes | Macros | Typedefs | Functions | Variables
hash.h File Reference
#include "arith_uint256.h"
#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/sha512.h"
#include <iomanip>
#include <sstream>
#include <vector>
#include <sodium.h>
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  CHash512
 
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  CBLAKE2bWriter
 A writer stream (for serialization) that computes a 256-bit BLAKE2b hash. More...
 

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 >
uint512 Hash512 (const T1 pbegin, const T1 pend)
 Compute the 512-bit hash of an object. More...
 
template<typename T1 , typename T2 >
uint512 Hash512 (const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end)
 
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 >
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])
 
template<typename T1 >
uint256 HashQuark (const T1 pbegin, const T1 pend)
 
void scrypt_hash (const char *pass, unsigned int pLen, const char *salt, unsigned int sLen, char *output, unsigned int N, unsigned int r, unsigned int p, unsigned int dkLen)
 

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
 

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); \
} while (0)
GLOBAL sph_skein512_context z_skein
Definition: hash.h:104
GLOBAL sph_bmw512_context z_bmw
Definition: hash.h:100
GLOBAL sph_jh512_context z_jh
Definition: hash.h:102
GLOBAL sph_blake512_context z_blake
Definition: hash.h:99
GLOBAL sph_keccak512_context z_keccak
Definition: hash.h:103
GLOBAL sph_groestl512_context z_groestl
Definition: hash.h:101

Definition at line 106 of file hash.h.

◆ GLOBAL

#define GLOBAL   extern

Definition at line 96 of file hash.h.

◆ ZBLAKE

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

Definition at line 116 of file hash.h.

◆ ZBMW

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

Definition at line 117 of file hash.h.

◆ ZGROESTL

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

Definition at line 118 of file hash.h.

◆ ZJH

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

Definition at line 119 of file hash.h.

◆ ZKECCAK

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

Definition at line 120 of file hash.h.

◆ ZSKEIN

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

Definition at line 121 of file hash.h.

Typedef Documentation

◆ ChainCode

typedef uint256 ChainCode

Definition at line 34 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 72 of file hash.cpp.

Here is the caller graph for this function:

◆ Hash() [1/2]

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

Here is the call graph for this function:

◆ Hash() [2/2]

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

Compute the 256-bit hash of an object.

Definition at line 173 of file hash.h.

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

◆ Hash160() [1/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 209 of file hash.h.

Here is the call graph for this function:

◆ Hash160() [2/3]

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

Compute the 160-bit hash of a vector.

Definition at line 202 of file hash.h.

Here is the call graph for this function:

◆ Hash160() [3/3]

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

Compute the 160-bit hash an object.

Definition at line 193 of file hash.h.

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

◆ Hash512() [1/2]

template<typename T1 , typename T2 >
uint512 Hash512 ( const T1  p1begin,
const T1  p1end,
const T2  p2begin,
const T2  p2end 
)
inline

Definition at line 163 of file hash.h.

Here is the call graph for this function:

◆ Hash512() [2/2]

template<typename T1 >
uint512 Hash512 ( const T1  pbegin,
const T1  pend 
)
inline

Compute the 512-bit hash of an object.

Definition at line 155 of file hash.h.

Here is the call graph for this function:

◆ HashQuark()

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

Definition at line 345 of file hash.h.

Here is the caller graph for this function:

◆ MurmurHash3()

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

Definition at line 16 of file hash.cpp.

Here is the caller graph for this function:

◆ scrypt_hash()

void scrypt_hash ( const char *  pass,
unsigned int  pLen,
const char *  salt,
unsigned int  sLen,
char *  output,
unsigned int  N,
unsigned int  r,
unsigned int  p,
unsigned int  dkLen 
)

Definition at line 82 of file hash.cpp.

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

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

Here is the caller graph for this function:

Variable Documentation

◆ z_blake

GLOBAL sph_blake512_context z_blake

Definition at line 99 of file hash.h.

◆ z_bmw

GLOBAL sph_bmw512_context z_bmw

Definition at line 100 of file hash.h.

◆ z_groestl

Definition at line 101 of file hash.h.

◆ z_jh

Definition at line 102 of file hash.h.

◆ z_keccak

Definition at line 103 of file hash.h.

◆ z_skein

GLOBAL sph_skein512_context z_skein

Definition at line 104 of file hash.h.