Botan 3.1.1
Crypto and TLS for C&
|
#include <mdx_hash.h>
Public Member Functions | |
HashFunction * | clone () const |
virtual std::unique_ptr< HashFunction > | copy_state () const =0 |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | final () |
void | final (std::span< uint8_t > out) |
template<concepts::resizable_byte_buffer T> | |
void | final (T &out) |
void | final (uint8_t out[]) |
std::vector< uint8_t > | final_stdvec () |
size_t | hash_block_size () const override final |
MDx_HashFunction (size_t block_length, bool big_byte_endian, bool big_bit_endian, uint8_t counter_size=8) | |
virtual std::string | name () const =0 |
virtual std::unique_ptr< HashFunction > | new_object () const =0 |
virtual size_t | output_length () const =0 |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | process (const uint8_t in[], size_t length) |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | process (std::span< const uint8_t > in) |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | process (std::string_view in) |
virtual std::string | provider () const |
void | update (const uint8_t in[], size_t length) |
void | update (std::span< const uint8_t > in) |
void | update (std::string_view str) |
void | update (uint8_t in) |
void | update_be (uint16_t val) |
void | update_be (uint32_t val) |
void | update_be (uint64_t val) |
void | update_le (uint16_t val) |
void | update_le (uint32_t val) |
void | update_le (uint64_t val) |
Static Public Member Functions | |
static std::unique_ptr< HashFunction > | create (std::string_view algo_spec, std::string_view provider="") |
static std::unique_ptr< HashFunction > | create_or_throw (std::string_view algo_spec, std::string_view provider="") |
static std::vector< std::string > | providers (std::string_view algo_spec) |
Protected Member Functions | |
void | add_data (const uint8_t input[], size_t length) override final |
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 final |
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, | ||
uint8_t | counter_size = 8 |
||
) |
block_length | is the number of bytes per block, which must be a power of 2 and at least 8. |
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 19 of file mdx_hash.cpp.
References Botan::is_power_of_2().
|
finaloverrideprotectedvirtual |
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 49 of file mdx_hash.cpp.
References Botan::buffer_insert(), and compress_n().
|
overrideprotectedvirtual |
Reset the state.
Implements Botan::HashFunction.
Reimplemented in Botan::RIPEMD_160, Botan::SHA_1, Botan::SHA_224, Botan::SHA_256, Botan::SHA_384, Botan::SHA_512, Botan::SHA_512_256, Botan::SM3, and Botan::Whirlpool.
Definition at line 41 of file mdx_hash.cpp.
References Botan::zeroise().
Referenced by Botan::MD4::clear(), Botan::MD5::clear(), Botan::RIPEMD_160::clear(), Botan::SHA_1::clear(), Botan::SHA_224::clear(), Botan::SHA_256::clear(), Botan::SHA_384::clear(), Botan::SHA_512::clear(), Botan::SHA_512_256::clear(), Botan::SM3::clear(), Botan::Whirlpool::clear(), and final_result().
|
inlineinherited |
|
protectedpure virtual |
Run the hash's compression function over a set of blocks
blocks | the input |
block_n | the number of blocks |
Referenced by add_data(), and final_result().
|
protectedpure virtual |
|
pure virtualinherited |
Return a new hash object with the same state as *this. This allows computing the hash of several messages with a common prefix more efficiently than would otherwise be possible.
This function should be called clone
but that was already used for the case of returning an uninitialized object.
Implemented in Botan::BLAKE2b, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::Comb4P, Botan::GOST_34_11, Botan::Keccak_1600, Botan::MD4, Botan::MD5, Botan::Parallel, Botan::RIPEMD_160, Botan::SHA_1, Botan::SHA_224, Botan::SHA_256, Botan::SHA_384, Botan::SHA_512, Botan::SHA_512_256, Botan::SHA_3, Botan::SHAKE_128, Botan::SHAKE_256, Botan::Skein_512, Botan::SM3, Botan::Streebog, Botan::Truncated_Hash, Botan::Whirlpool, and Botan::RawHashFunction.
|
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 103 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(), Botan::HashFunction::create(), Botan::make_commoncrypto_hash(), and Botan::HashFunction::provider().
Referenced by botan_hash_init(), Botan::EME::create(), Botan::EMSA::create(), Botan::BlockCipher::create(), Botan::HashFunction::create(), Botan::KDF::create(), Botan::MessageAuthenticationCode::create(), Botan::PBKDF::create(), Botan::PasswordHashFamily::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(), and Botan::X942_PRF::kdf().
|
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 found. |
Definition at line 288 of file hash.cpp.
References Botan::HashFunction::create(), and Botan::HashFunction::provider().
Referenced by botan_pubkey_fingerprint(), botan_pubkey_sm2_compute_za(), Botan::OCSP::CertID::CertID(), Botan::create_hex_fingerprint(), Botan::Sodium::crypto_hash_sha256(), Botan::Sodium::crypto_hash_sha512(), Botan::Bcrypt_PBKDF::derive_key(), Botan::EMSA_PKCS1v15_Raw::EMSA_PKCS1v15_Raw(), Botan::expand_message_xmd(), Botan::TLS::Handshake_Hash::final(), Botan::generate_dsa_primes(), Botan::OCSP::CertID::is_id_for(), Botan::TLS::make_hello_random(), Botan::Roughtime::nonce_from_blind(), Botan::TLS::Transcript_Hash_State::set_algorithm(), Botan::RTSS_Share::split(), Botan::srp6_client_agree(), Botan::srp6_generate_verifier(), Botan::SRP6_Server_Session::step1(), Botan::SRP6_Server_Session::step2(), Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID(), and Botan::PK_Ops::Verification_with_Hash::Verification_with_Hash().
|
inlineinherited |
Complete the computation and retrieve the final result as a container of your choice.
Definition at line 77 of file buf_comp.h.
References T.
|
inlineinherited |
Definition at line 85 of file buf_comp.h.
References BOTAN_ASSERT_NOMSG.
|
inlineinherited |
Definition at line 91 of file buf_comp.h.
|
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 69 of file buf_comp.h.
Referenced by Botan::ed25519_gen_keypair(), Botan::ed25519_sign(), Botan::ed25519_verify(), Botan::mgf1_mask(), Botan::pbkdf2(), Botan::Dilithium::Polynomial::poly_challenge(), Botan::Kyber_Modern_Symmetric_Primitives::PRF(), Botan::Sphincs_Hash_Functions_Sha2::PRF_msg(), Botan::Sphincs_Hash_Functions_Shake::PRF_msg(), and Botan::sm2_compute_za().
|
finaloverrideprotectedvirtual |
Write the final output to out
out | is an output buffer of output_length() |
Implements Botan::Buffered_Computation.
Definition at line 80 of file mdx_hash.cpp.
References BOTAN_ASSERT_NOMSG, clear(), Botan::clear_mem(), compress_n(), copy_out(), Botan::Buffered_Computation::output_length(), Botan::store_be(), Botan::store_le(), and Botan::zeroise().
|
inlineinherited |
Definition at line 83 of file buf_comp.h.
|
inlinefinaloverridevirtual |
Reimplemented from Botan::HashFunction.
Definition at line 29 of file mdx_hash.h.
|
pure virtualinherited |
Implemented in Botan::BLAKE2b, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::Comb4P, Botan::GOST_34_11, Botan::Keccak_1600, Botan::MD4, Botan::MD5, Botan::Parallel, Botan::RIPEMD_160, Botan::SHA_1, Botan::SHA_224, Botan::SHA_256, Botan::SHA_384, Botan::SHA_512, Botan::SHA_512_256, Botan::SHA_3, Botan::SHAKE_128, Botan::SHAKE_256, Botan::Skein_512, Botan::SM3, Botan::Streebog, Botan::Truncated_Hash, Botan::Whirlpool, and Botan::RawHashFunction.
|
pure virtualinherited |
Implemented in Botan::BLAKE2b, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::Comb4P, Botan::GOST_34_11, Botan::Keccak_1600, Botan::MD4, Botan::MD5, Botan::Parallel, Botan::RIPEMD_160, Botan::SHA_1, Botan::SHA_224, Botan::SHA_256, Botan::SHA_384, Botan::SHA_512, Botan::SHA_512_256, Botan::SHA_3, Botan::SHAKE_128, Botan::SHAKE_256, Botan::Skein_512, Botan::SM3, Botan::Streebog, Botan::Truncated_Hash, Botan::Whirlpool, and Botan::RawHashFunction.
|
pure virtualinherited |
Implemented in Botan::BLAKE2b, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::Comb4P, Botan::GOST_34_11, Botan::Keccak_1600, Botan::MD4, Botan::MD5, Botan::Parallel, Botan::RIPEMD_160, Botan::SHA_1, Botan::SHA_224, Botan::SHA_256, Botan::SHA_384, Botan::SHA_512, Botan::SHA_512_256, Botan::SHA_3, Botan::SHAKE_128, Botan::SHAKE_256, Botan::Skein_512, Botan::SM3, Botan::Streebog, Botan::Truncated_Hash, Botan::Whirlpool, Botan::BLAKE2bMAC, Botan::CMAC, Botan::GMAC, Botan::HMAC, Botan::Poly1305, Botan::SipHash, Botan::ANSI_X919_MAC, and Botan::RawHashFunction.
Referenced by final_result(), Botan::mgf1_mask(), Botan::pbkdf2(), Botan::sm2_compute_za(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::TLS_CBC_HMAC_AEAD_Mode().
|
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 104 of file buf_comp.h.
References update.
Referenced by Botan::Dilithium_Symmetric_Primitives::CRH(), and Botan::Dilithium_Symmetric_Primitives::H().
|
inlineinherited |
|
inlineinherited |
|
inlinevirtualinherited |
Reimplemented in Botan::SHA_1, Botan::SHA_224, Botan::SHA_256, Botan::SHA_384, Botan::SHA_512, Botan::SHA_512_256, and Botan::SHA_3.
Definition at line 49 of file hash.h.
Referenced by Botan::HashFunction::create(), and Botan::HashFunction::create_or_throw().
|
staticinherited |
|
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::ed25519_gen_keypair(), Botan::ed25519_sign(), Botan::ed25519_verify(), Botan::mgf1_mask(), Botan::pbkdf2(), Botan::Dilithium::Polynomial::poly_challenge(), Botan::Kyber_Modern_Symmetric_Primitives::PRF(), Botan::Sphincs_Hash_Functions_Sha2::PRF_msg(), Botan::Sphincs_Hash_Functions_Shake::PRF_msg(), Botan::sm2_compute_za(), and Botan::Sphincs_Hash_Functions_Shake::Sphincs_Hash_Functions_Shake().
|
inlineinherited |
Add new input to process.
in | the input to process as a contiguous data range |
Definition at line 40 of file buf_comp.h.
|
inlineinherited |
Add new input to process.
str | the input to process as a std::string_view. Will be interpreted as a byte array based on the strings encoding. |
Definition at line 55 of file buf_comp.h.
References Botan::cast_char_ptr_to_uint8().
|
inlineinherited |
Process a single byte.
in | the byte to process |
Definition at line 61 of file buf_comp.h.
|
inherited |
Definition at line 13 of file buf_comp.cpp.
References Botan::store_be().
Referenced by Botan::mgf1_mask(), and Botan::pbkdf2().
|
inherited |
Definition at line 19 of file buf_comp.cpp.
References Botan::store_be().
|
inherited |
Definition at line 25 of file buf_comp.cpp.
References Botan::store_be().
|
inherited |
Definition at line 31 of file buf_comp.cpp.
References Botan::store_le().
|
inherited |
Definition at line 37 of file buf_comp.cpp.
References Botan::store_le().
|
inherited |
Definition at line 43 of file buf_comp.cpp.
References Botan::store_le().