Equity
Bitcoin Protocol Library
Namespaces | Typedefs | Functions | Variables
Crypto Namespace Reference

Crypto library. More...

Namespaces

 Ecc
 ECC library.
 

Typedefs

typedef std::array< uint8_t, RIPEMD160_HASH_SIZERipemd160Hash
 A RIPEMD-160 hash.
 
typedef std::array< uint8_t, SHA1_HASH_SIZESha1Hash
 A SHA-1 hash.
 
typedef std::array< uint8_t, SHA256_HASH_SIZESha256Hash
 A SHA-256 hash.
 
typedef std::vector< Sha256HashSha256HashList
 A vector of SHA-256 hashes.
 
typedef std::array< uint8_t, CHECKSUM_SIZEChecksum
 A 4-byte checksum from the first 4 bytes of doubleSha256(input)
 
typedef std::array< uint8_t, SHA512_HASH_SIZESha512Hash
 A SHA-512 hash.
 
typedef std::vector< Sha512HashSha512HashList
 A vector of SHA-512 hashes.
 

Functions

Sha512Hash hmacSha512 (uint8_t const *key, size_t keySize, uint8_t const *message, size_t messageSize)
 Computes an HMAC of the message using SHA-512. More...
 
std::vector< uint8_t > pbkdf2HmacSha512 (uint8_t const *password, size_t passwordSize, uint8_t const *salt, size_t saltSize, int count, size_t size)
 Returns the result of a PBKDF2 operation using SHA-512. More...
 
std::vector< uint8_t > pbkdf2HmacSha512 (std::vector< uint8_t > const &password, std::vector< uint8_t > const &salt, int count, size_t size)
 Returns the result of a PBKDF2 operation using SHA-512. More...
 
Ripemd160Hash ripemd160 (std::vector< uint8_t > const &input)
 Computes the RIPEMD-160 hash of the input.
 
Ripemd160Hash ripemd160 (uint8_t const *input, size_t length)
 Computes the RIPEMD-160 hash of the input.
 
template<size_t N>
Ripemd160Hash ripemd160 (std::array< uint8_t, N > const &input)
 Computes the RIPEMD-160 hash of an std::array input.
 
Sha1Hash sha1 (std::vector< uint8_t > const &input)
 Returns the SHA-1 hash of the input.
 
Sha1Hash sha1 (uint8_t const *input, size_t length)
 Returns the SHA-1 hash of the input.
 
template<size_t N>
Sha1Hash sha1 (std::array< uint8_t, N > const &input)
 Returns the SHA-1 hash of the input.
 
Sha256Hash sha256 (std::vector< uint8_t > const &input)
 Computes the SHA-256 hash of the input. More...
 
Sha256Hash sha256 (uint8_t const *input, size_t length)
 Computes the SHA-256 hash of the input. More...
 
Sha256Hash doubleSha256 (std::vector< uint8_t > const &input)
 Computes the double-SHA-256 hash of the input. More...
 
Sha256Hash doubleSha256 (uint8_t const *input, size_t length)
 Computes the double-SHA-256 hash of the input. More...
 
Checksum checksum (std::vector< uint8_t > const &input)
 Computes the double-SHA-256 checksum of the input. More...
 
Checksum checksum (uint8_t const *input, size_t length)
 Computes the double-SHA-256 checksum of the input. More...
 
template<size_t N>
Sha256Hash sha256 (std::array< uint8_t, N > const &input)
 Computes the SHA-256 hash of an std::array of uint8_t. More...
 
Sha512Hash sha512 (std::vector< uint8_t > const &input)
 Computes the SHA-512 hash of the input. More...
 
Sha512Hash sha512 (uint8_t const *input, size_t length)
 Computes the SHA-512 hash of the input. More...
 
template<size_t N>
Sha512Hash sha512 (std::array< uint8_t, N > const &input)
 Computes the SHA-512 hash of an std::array of uint8_t. More...
 

Variables

size_t const RIPEMD160_HASH_SIZE = 160 / 8
 The sized of a RIPEMD-160 hash in bytes.
 
size_t const SHA1_HASH_SIZE = 160 / 8
 Size of a SHA-1 HASH in bytes.
 
size_t const SHA256_HASH_SIZE = 256 / 8
 Size of a SHA-256 hash in bytes.
 
size_t const CHECKSUM_SIZE = 4
 Size of a checksum in bytes.
 
size_t const SHA512_HASH_SIZE = 512 / 8
 Size of a SHA-512 hash in bytes.
 

Detailed Description

Crypto library.

The primary purpose of this library is to provide a generic interface wrapping a specific implementation.

Function Documentation

Checksum Crypto::checksum ( std::vector< uint8_t > const &  input)

Computes the double-SHA-256 checksum of the input.

Parameters
inputdata to hash
Checksum Crypto::checksum ( uint8_t const *  input,
size_t  length 
)

Computes the double-SHA-256 checksum of the input.

Parameters
inputdata to hash
lengthlength of the data
Sha256Hash Crypto::doubleSha256 ( std::vector< uint8_t > const &  input)

Computes the double-SHA-256 hash of the input.

Parameters
inputdata to hash
Sha256Hash Crypto::doubleSha256 ( uint8_t const *  input,
size_t  length 
)

Computes the double-SHA-256 hash of the input.

Parameters
inputdata to hash
lengthlength of the data
Sha512Hash Crypto::hmacSha512 ( uint8_t const *  key,
size_t  keySize,
uint8_t const *  message,
size_t  messageSize 
)

Computes an HMAC of the message using SHA-512.

Parameters
keykey
keySizesize of the key
messagemessage to generate the HMAC for
messageSizesize of the message
std::vector< uint8_t > Crypto::pbkdf2HmacSha512 ( uint8_t const *  password,
size_t  passwordSize,
uint8_t const *  salt,
size_t  saltSize,
int  count,
size_t  size 
)

Returns the result of a PBKDF2 operation using SHA-512.

Parameters
passwordpassword
passwordSizelength of the password
saltsalt
saltSizelength of the salt
countnumber of iterations
sizedesired size of the returned value
std::vector< uint8_t > Crypto::pbkdf2HmacSha512 ( std::vector< uint8_t > const &  password,
std::vector< uint8_t > const &  salt,
int  count,
size_t  size 
)
inline

Returns the result of a PBKDF2 operation using SHA-512.

Parameters
passwordpassword
saltsalt
countnumber of iterations
sizedesired size of the returned value
Sha256Hash Crypto::sha256 ( std::vector< uint8_t > const &  input)

Computes the SHA-256 hash of the input.

Parameters
inputdata to hash
Sha256Hash Crypto::sha256 ( uint8_t const *  input,
size_t  length 
)

Computes the SHA-256 hash of the input.

Parameters
inputdata to hash
lengthlength of the data
template<size_t N>
Sha256Hash Crypto::sha256 ( std::array< uint8_t, N > const &  input)

Computes the SHA-256 hash of an std::array of uint8_t.

Parameters
inputdata to hash
Sha512Hash Crypto::sha512 ( std::vector< uint8_t > const &  input)

Computes the SHA-512 hash of the input.

Parameters
inputdata to hash
Sha512Hash Crypto::sha512 ( uint8_t const *  input,
size_t  length 
)

Computes the SHA-512 hash of the input.

Parameters
inputdata to hash
lengthlength of the data
template<size_t N>
Sha512Hash Crypto::sha512 ( std::array< uint8_t, N > const &  input)

Computes the SHA-512 hash of an std::array of uint8_t.

Parameters
inputdata to hash