Hash algorithm abstract class. More...
#include <hash.hpp>
Public Member Functions | |
virtual const std::array< uint8_t, O > & | digest () const =0 |
const std::array< uint8_t, O > & | digest (const std::string &data) |
template<std::size_t N> | |
const std::array< uint8_t, O > & | digest (const std::array< uint8_t, N > &data) |
const std::array< uint8_t, O > & | digest (const uint8_t *data, std::size_t len) |
const std::array< uint8_t, O > & | digest (std::istream &stream) |
Static Public Member Functions | |
static constexpr std::size_t | getOutputSize () |
static constexpr std::size_t | getBlockSize () |
Protected Member Functions | |
virtual void | reset ()=0 |
virtual void | addData (const uint8_t *data, std::size_t len)=0 |
virtual void | finalize ()=0 |
Protected Attributes | |
std::array< uint8_t, O > * | _digest |
Hash algorithm abstract class.
N is the hash output size in bytes.
B is the hash block size in bytes (used in HMAC algorithm).
|
protectedpure virtual |
Compute hash for data with the current hash
data | The data to add |
len | The data length |
Implemented in anch::crypto::MD5, and anch::crypto::SHA1.
|
pure virtual |
Get the hash result
Implemented in anch::crypto::MD5, anch::crypto::SHA1, and anch::crypto::SHA2< O, B, W, R, I >.
const std::array< uint8_t, O > & anch::crypto::Hash< O, B >::digest | ( | const std::array< uint8_t, N > & | data | ) |
Reset current hash context and compute hash for string
data | the string to hash |
template const std::array< uint8_t, 64 > & anch::crypto::Hash< O, B >::digest | ( | const std::string & | data | ) |
Reset current hash context and compute hash for string
data | the string to hash |
const std::array< uint8_t, O > & anch::crypto::Hash< O, B >::digest | ( | const uint8_t * | data, |
std::size_t | len ) |
Reset current hash context and compute hash for string
data | the string to hash |
len | the data length |
template const std::array< uint8_t, 64 > & anch::crypto::Hash< O, B >::digest | ( | std::istream & | stream | ) |
Reset current hash context and compute hash for stream
stream | the stream to hash |
|
protectedpure virtual |
Reset hash context
Implemented in anch::crypto::MD5, and anch::crypto::SHA1.
|
inlinestaticconstexpr |
Hash block size getter
|
inlinestaticconstexpr |
Hash output size getter
|
protectedpure virtual |
Reset hash context
Implemented in anch::crypto::MD5, and anch::crypto::SHA1.
|
protected |
Digest