Botan
2.1.0
Crypto and TLS for C++11
|
#include <mdx_hash.h>
Public Member Functions | |
virtual HashFunction * | clone () const =0 |
void | final (uint8_t out[]) |
secure_vector< uint8_t > | final () |
template<typename Alloc > | |
void | final (std::vector< uint8_t, Alloc > &out) |
std::vector< uint8_t > | final_stdvec () |
size_t | hash_block_size () const override |
MDx_HashFunction (size_t block_length, bool big_byte_endian, bool big_bit_endian, size_t counter_size=8) | |
virtual std::string | name () const =0 |
virtual size_t | output_length () const =0 |
secure_vector< uint8_t > | process (const uint8_t in[], size_t length) |
secure_vector< uint8_t > | process (const secure_vector< uint8_t > &in) |
secure_vector< uint8_t > | process (const std::vector< uint8_t > &in) |
secure_vector< uint8_t > | process (const std::string &in) |
virtual std::string | provider () const |
void | update (const uint8_t in[], size_t length) |
void | update (const secure_vector< uint8_t > &in) |
void | update (const std::vector< uint8_t > &in) |
void | update (const std::string &str) |
void | update (uint8_t in) |
template<typename T > | |
void | update_be (const T in) |
Static Public Member Functions | |
static std::unique_ptr< HashFunction > | create (const std::string &algo_spec, const std::string &provider="") |
static std::unique_ptr< HashFunction > | create_or_throw (const std::string &algo_spec, const std::string &provider="") |
static std::vector< std::string > | providers (const std::string &algo_spec) |
Protected Member Functions | |
void | add_data (const uint8_t input[], size_t length) override |
void | clear () override |
virtual void | compress_n (const uint8_t blocks[], size_t block_n)=0 |
virtual void | copy_out (uint8_t buffer[])=0 |
void | final_result (uint8_t output[]) override |
virtual void | write_count (uint8_t out[]) |
MDx Hash Function Base Class
Definition at line 18 of file mdx_hash.h.
Botan::MDx_HashFunction::MDx_HashFunction | ( | size_t | block_length, |
bool | big_byte_endian, | ||
bool | big_bit_endian, | ||
size_t | counter_size = 8 |
||
) |
block_length | is the number of bytes per block |
big_byte_endian | specifies if the hash uses big-endian bytes |
big_bit_endian | specifies if the hash uses big-endian bits |
counter_size | specifies the size of the counter var in bytes |
Definition at line 17 of file mdx_hash.cpp.
|
overrideprotectedvirtual |
Add more data to the computation
input | is an input buffer |
length | is the length of input in bytes |
Implements Botan::Buffered_Computation.
Definition at line 41 of file mdx_hash.cpp.
References Botan::buffer_insert(), and compress_n().
|
overrideprotectedvirtual |
Reset the state.
Implements Botan::HashFunction.
Reimplemented in Botan::SHA_512_256, Botan::SHA_256, Botan::SHA_512, Botan::Tiger, Botan::SHA_224, Botan::RIPEMD_160, Botan::SHA_160, Botan::SHA_384, and Botan::Whirlpool.
Definition at line 32 of file mdx_hash.cpp.
References Botan::zeroise().
Referenced by Botan::MD4::clear(), Botan::MD5::clear(), Botan::RIPEMD_160::clear(), Botan::SHA_384::clear(), Botan::SHA_160::clear(), Botan::Whirlpool::clear(), Botan::SHA_224::clear(), Botan::Tiger::clear(), Botan::SHA_512::clear(), Botan::SHA_256::clear(), Botan::SHA_512_256::clear(), and final_result().
|
pure virtualinherited |
Implemented in Botan::SHA_512_256, Botan::SHAKE_256, Botan::SHA_256, Botan::SHA_512, Botan::Blake2b, Botan::Comb4P, Botan::Skein_512, Botan::Keccak_1600, Botan::SHA_3, Botan::SHAKE_128, Botan::GOST_34_11, Botan::Parallel, Botan::SHA_224, Botan::Tiger, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::MD4, Botan::MD5, Botan::RIPEMD_160, Botan::SHA_160, Botan::SHA_384, and Botan::Whirlpool.
|
protectedpure virtual |
Run the hash's compression function over a set of blocks
blocks | the input |
block_n | the number of blocks |
Implemented in Botan::MD4, and Botan::MD5.
Referenced by add_data(), and final_result().
|
protectedpure virtual |
Copy the output to the buffer
buffer | to put the output into |
Implemented in Botan::MD4, and Botan::MD5.
Referenced by final_result().
|
staticinherited |
Create an instance based on a name, or return null if the algo/provider combination cannot be found. If provider is empty then best available is chosen.
Definition at line 93 of file hash.cpp.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_as_integer(), Botan::SCAN_Name::arg_count(), hash, and Botan::make_openssl_hash().
Referenced by botan_hash_init(), botan_pubkey_fingerprint(), Botan::OCSP::CertID::CertID(), Botan::BlockCipher::create(), Botan::MessageAuthenticationCode::create(), Botan::PBKDF::create(), Botan::KDF::create(), Botan::HashFunction::create_or_throw(), Botan::Certificate_Store_In_Memory::find_cert_by_pubkey_sha1(), Botan::Certificate_Store_In_Memory::find_cert_by_raw_subject_dn_sha256(), Botan::Private_Key::fingerprint(), Botan::X509_Certificate::fingerprint(), Botan::get_eme(), Botan::get_emsa(), Botan::get_hash(), Botan::get_hash_function(), Botan::OCSP::CertID::is_id_for(), Botan::X942_PRF::kdf(), Botan::newhope_shareda(), Botan::newhope_sharedb(), Botan::X509_Certificate::raw_issuer_dn_sha256(), Botan::X509_Certificate::raw_subject_dn_sha256(), and Botan::X509_Certificate::subject_public_key_bitstring_sha1().
|
staticinherited |
Create an instance based on a name If provider is empty then best available is chosen.
algo_spec | algorithm name |
provider | provider implementation to use Throws Lookup_Error if not not found. |
Definition at line 303 of file hash.cpp.
References Botan::HashFunction::create(), and hash.
Referenced by Botan::choose_sig_format(), Botan::TLS::Handshake_Hash::final(), Botan::generate_dsa_primes(), and Botan::make_hash_function().
|
inlineinherited |
Complete the computation and retrieve the final result.
out | The byte array to be filled with the result. Must be of length output_length() |
Definition at line 89 of file buf_comp.h.
Referenced by botan_hash_final(), botan_mac_final(), Botan::TLS::TLS_CBC_HMAC_AEAD_Encryption::finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), Botan::mgf1_mask(), and Botan::pbkdf2().
|
inlineinherited |
Complete the computation and retrieve the final result.
Definition at line 96 of file buf_comp.h.
|
inlineinherited |
Definition at line 111 of file buf_comp.h.
|
overrideprotectedvirtual |
Write the final output to out
out | is an output buffer of output_length() |
Implements Botan::Buffered_Computation.
Definition at line 71 of file mdx_hash.cpp.
References clear(), compress_n(), copy_out(), write_count(), and Botan::zeroise().
|
inlineinherited |
Definition at line 103 of file buf_comp.h.
|
inlineoverridevirtual |
Reimplemented from Botan::HashFunction.
Definition at line 32 of file mdx_hash.h.
Referenced by Botan::MD4::compress_n(), Botan::MD5::compress_n(), and write_count().
|
pure virtualinherited |
Implemented in Botan::SHAKE_256, Botan::SHA_512_256, Botan::SHA_256, Botan::SHA_512, Botan::Comb4P, Botan::Blake2b, Botan::Skein_512, Botan::Keccak_1600, Botan::SHA_3, Botan::SHAKE_128, Botan::Parallel, Botan::GOST_34_11, Botan::SHA_224, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::MD4, Botan::MD5, Botan::RIPEMD_160, Botan::SHA_160, Botan::SHA_384, Botan::Tiger, and Botan::Whirlpool.
Referenced by Botan::EMSA_X931::EMSA_X931().
|
pure virtualinherited |
Implemented in Botan::SHA_512_256, Botan::SHAKE_256, Botan::SHA_256, Botan::SHA_512, Botan::Blake2b, Botan::Skein_512, Botan::Keccak_1600, Botan::SHA_3, Botan::SHAKE_128, Botan::Comb4P, Botan::Poly1305, Botan::GMAC, Botan::Parallel, Botan::HMAC, Botan::SipHash, Botan::CBC_MAC, Botan::ANSI_X919_MAC, Botan::GOST_34_11, Botan::SHA_224, Botan::CMAC, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::MD4, Botan::MD5, Botan::RIPEMD_160, Botan::SHA_160, Botan::SHA_384, Botan::Tiger, and Botan::Whirlpool.
Referenced by botan_hash_output_length(), botan_mac_output_length(), Botan::pbkdf2(), and write_count().
|
inlineinherited |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process as a byte array |
length | the length of the byte array |
Definition at line 124 of file buf_comp.h.
Referenced by Botan::RTSS_Share::split().
|
inlineinherited |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process |
Definition at line 136 of file buf_comp.h.
|
inlineinherited |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process |
Definition at line 148 of file buf_comp.h.
|
inlineinherited |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process as a string |
Definition at line 160 of file buf_comp.h.
|
inlinevirtualinherited |
|
staticinherited |
algo_spec | algorithm name |
Definition at line 313 of file hash.cpp.
Referenced by Botan::get_hash_function_providers().
|
inlineinherited |
Add new input to process.
in | the input to process as a byte array |
length | of param in in bytes |
Definition at line 34 of file buf_comp.h.
Referenced by botan_hash_update(), botan_mac_update(), Botan::TLS::TLS_CBC_HMAC_AEAD_Encryption::finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), Botan::mgf1_mask(), and Botan::pbkdf2().
|
inlineinherited |
Add new input to process.
in | the input to process as a secure_vector |
Definition at line 40 of file buf_comp.h.
|
inlineinherited |
Add new input to process.
in | the input to process as a std::vector |
Definition at line 49 of file buf_comp.h.
|
inlineinherited |
Add new input to process.
str | the input to process as a std::string. Will be interpreted as a byte array based on the strings encoding. |
Definition at line 72 of file buf_comp.h.
|
inlineinherited |
|
inlineinherited |
Add an integer in big-endian order
in | the value |
Definition at line 58 of file buf_comp.h.
References Botan::get_byte().
Referenced by Botan::mgf1_mask(), and Botan::pbkdf2().
|
protectedvirtual |
Write the count, if used, to this spot
out | where to write the counter to |
Definition at line 93 of file mdx_hash.cpp.
References hash_block_size(), Botan::Buffered_Computation::output_length(), Botan::store_be(), and Botan::store_le().
Referenced by final_result().