|
Botan 3.13.0
Crypto and TLS for C&
|
#include <sha2_64.h>
Public Types | |
| using | digest_type = secure_vector<uint64_t> |
Public Member Functions | |
| void | clear () override |
| HashFunction * | clone () const |
| std::unique_ptr< HashFunction > | copy_state () const override |
| 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 |
| std::string | name () const override |
| std::unique_ptr< HashFunction > | new_object () const override |
| size_t | output_length () const override |
| 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) |
| std::string | provider () const override |
| virtual size_t | security_level () 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 void | compress_digest (digest_type &digest, std::span< const uint8_t > input, size_t blocks) |
| static void | compress_n (digest_type &digest, std::span< const uint8_t > input, size_t blocks) |
| 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 void | init (digest_type &digest) |
| static std::vector< std::string > | providers (std::string_view algo_spec) |
Static Public Attributes | |
| static constexpr MD_Endian | bit_endianness = MD_Endian::Big |
| static constexpr size_t | block_bytes = 128 |
| static constexpr MD_Endian | byte_endianness = MD_Endian::Big |
| static constexpr size_t | ctr_bytes = 16 |
| static constexpr size_t | output_bytes = 64 |
| using Botan::SHA_512::digest_type = secure_vector<uint64_t> |
|
inlineoverridevirtual |
Reset the state.
Implements Botan::HashFunction.
Definition at line 84 of file sha2_64.h.
|
inlineinherited |
Create a new uninitialized object of the same type
Definition at line 100 of file hash.h.
References new_object().
|
static |
Definition at line 56 of file sha2_64.cpp.
References Botan::CPUFeature::AVX2, Botan::CPUFeature::AVX512, block_bytes, Botan::CPUFeature::BMI, Botan::CPUID::has(), Botan::load_be(), Botan::CPUFeature::SHA2_512, Botan::SHA2_64_F(), Botan::CPUFeature::SHA512, and Botan::BufferSlicer::take().
Referenced by Botan::SHA_384::compress_n(), compress_n(), and Botan::SHA_512_256::compress_n().
|
static |
Definition at line 213 of file sha2_64.cpp.
References compress_digest().
|
overridevirtual |
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.
Implements Botan::HashFunction.
Definition at line 266 of file sha2_64.cpp.
|
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 111 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(), create(), Botan::make_commoncrypto_hash(), and provider().
Referenced by botan_hash_init(), Botan::BlockCipher::create(), Botan::EncryptionPaddingScheme::create(), create(), Botan::KDF::create(), Botan::MessageAuthenticationCode::create(), Botan::PasswordHashFamily::create(), Botan::PBKDF::create(), Botan::SignaturePaddingScheme::create(), create_or_throw(), and Botan::EC_Group_Data::hash_to_curve_supported().
|
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 308 of file hash.cpp.
References create(), and provider().
Referenced by botan_pubkey_fingerprint(), botan_pubkey_sm2_compute_za(), Botan::OCSP::CertID::CertID(), Botan::TLS::Client_Hello_Internal::Client_Hello_Internal(), Botan::SPAKE2p::SystemParameters::confirmation_size(), Botan::Kyber_90s_Symmetric_Primitives::create_G(), Botan::Kyber_Modern_Symmetric_Primitives::create_G(), Botan::ML_KEM_Symmetric_Primitives::create_G(), Botan::Kyber_90s_Symmetric_Primitives::create_H(), Botan::Kyber_Modern_Symmetric_Primitives::create_H(), Botan::ML_KEM_Symmetric_Primitives::create_H(), Botan::create_hex_fingerprint(), Botan::ML_KEM_Symmetric_Primitives::create_J(), Botan::Kyber_90s_Symmetric_Primitives::create_KDF(), Botan::Kyber_Modern_Symmetric_Primitives::create_KDF(), Botan::Sodium::crypto_hash_sha256(), Botan::Sodium::crypto_hash_sha512(), Botan::TLS::PSKImporter::derive_imported_psk(), Botan::Bcrypt_PBKDF::derive_key(), Botan::ed25519_gen_keypair(), Botan::ed25519_sign(), Botan::ed25519_verify(), Botan::PKCS12::export_to(), Botan::TLS::Handshake_Hash::final(), Botan::X509_Certificate_Cache::find_or_insert(), Botan::generate_dsa_primes(), Botan::h2c_expand_message(), Botan::LMOTS_Params::hash(), Botan::LMS_Params::hash(), Botan::Classic_McEliece_Parameters::hash_func(), Botan::Stateful_Key_Index_Registry::KeyId::KeyId(), Botan::TLS::make_hello_random(), Botan::Roughtime::nonce_from_blind(), Botan::PKCS1v15_Raw_SignaturePaddingScheme::PKCS1v15_Raw_SignaturePaddingScheme(), 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(), 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.
Definition at line 104 of file buf_comp.h.
References output_length().
|
inherited |
Complete the computation and retrieve the final result
| out | the buffer to write the result to, must be output_length() bytes |
Definition at line 54 of file buf_comp.cpp.
References BOTAN_ARG_CHECK, and output_length().
|
inlineinherited |
Complete the computation and retrieve the final result
| out | a container which is resized to hold the result |
Definition at line 127 of file buf_comp.h.
References output_length().
|
inlineinherited |
Complete the computation and retrieve the final result.
| out | The byte array to be filled with the result, which must be of length output_length() |
Definition at line 97 of file buf_comp.h.
References output_length().
Referenced by Botan::expand_message_xmd(), final_stdvec(), Botan::PseudorandomKeyGeneration::gen(), Botan::TPM2::Verification_Operation::is_valid_signature(), Botan::mgf1_mask(), Botan::KMAC::operator=(), Botan::pbkdf2(), Botan::Sphincs_Hash_Functions_Sha2::PRF_msg(), process(), process(), process(), Botan::TPM2::Signature_Operation::sign(), and Botan::sm2_compute_za().
|
inlineinherited |
Complete the computation and retrieve the final result
Definition at line 114 of file buf_comp.h.
References final().
|
inlineoverridevirtual |
Return the internal block size of this hash function
Reimplemented from Botan::HashFunction.
Definition at line 76 of file sha2_64.h.
References block_bytes.
|
static |
Definition at line 239 of file sha2_64.cpp.
|
inlineoverridevirtual |
Return the name of this hash function
Implements Botan::HashFunction.
Definition at line 72 of file sha2_64.h.
|
overridevirtual |
Create a new uninitialized object of the same type
Implements Botan::HashFunction.
Definition at line 254 of file sha2_64.cpp.
|
inlineoverridevirtual |
Return the output length of this function
Implements Botan::Buffered_Computation.
Definition at line 74 of file sha2_64.h.
References output_bytes.
|
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 140 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 contiguous container |
Definition at line 164 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 152 of file buf_comp.h.
|
overridevirtual |
Return the name of the provider implementing this object
Reimplemented from Botan::HashFunction.
Definition at line 201 of file sha2_64.cpp.
|
staticinherited |
List the providers available for a given hash
| algo_spec | algorithm name |
Definition at line 315 of file hash.cpp.
References Botan::probe_providers_of().
|
inlinevirtualinherited |
Return an estimate, in bits, of the security level of this hash function, with respect to collision resistance. For most hashes this is simply half the output length, matching the generic birthday attack. It is lower for hash functions with a known collision attack, and zero for checksums and any hash where finding collisions is trivial.
Reimplemented in Botan::Adler32, Botan::Comb4P, Botan::CRC24, Botan::CRC32, Botan::GOST_34_11, Botan::MD4, Botan::MD5, Botan::Parallel, Botan::SHA_1, Botan::SHAKE_128, Botan::SHAKE_256, Botan::TPM2::HashFunction, and Botan::Truncated_Hash.
Definition at line 77 of file hash.h.
References Botan::Buffered_Computation::output_length().
|
inlineinherited |
Add new input to process.
| in | the input to process as a byte array |
| length | of param in in bytes |
Definition at line 35 of file buf_comp.h.
Referenced by Botan::expand_message_xmd(), Botan::PseudorandomKeyGeneration::gen(), Botan::LMOTS_Public_Key::LMOTS_Public_Key(), Botan::mgf1_mask(), Botan::pbkdf2(), Botan::Sphincs_Hash_Functions_Sha2::PRF_msg(), process(), process(), process(), and Botan::sm2_compute_za().
|
inlineinherited |
Add new input to process.
| in | the input to process as a contiguous data range |
Definition at line 41 of file buf_comp.h.
|
inherited |
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 14 of file buf_comp.cpp.
References Botan::as_span_of_bytes().
|
inlineinherited |
Process a single byte.
| in | the byte to process |
Definition at line 90 of file buf_comp.h.
|
inherited |
Add new input to process, encoded as a big-endian integer
| val | the value to process |
Definition at line 18 of file buf_comp.cpp.
References Botan::store_be().
Referenced by Botan::expand_message_xmd(), Botan::mgf1_mask(), and Botan::pbkdf2().
|
inherited |
Add new input to process, encoded as a big-endian integer
| val | the value to process |
Definition at line 24 of file buf_comp.cpp.
References Botan::store_be().
|
inherited |
Add new input to process, encoded as a big-endian integer
| val | the value to process |
Definition at line 30 of file buf_comp.cpp.
References Botan::store_be().
|
inherited |
Add new input to process, encoded as a little-endian integer
| val | the value to process |
Definition at line 36 of file buf_comp.cpp.
References Botan::store_le().
|
inherited |
Add new input to process, encoded as a little-endian integer
| val | the value to process |
Definition at line 42 of file buf_comp.cpp.
References Botan::store_le().
|
inherited |
Add new input to process, encoded as a little-endian integer
| val | the value to process |
Definition at line 48 of file buf_comp.cpp.
References Botan::store_le().
|
staticconstexpr |
|
staticconstexpr |
Definition at line 64 of file sha2_64.h.
Referenced by compress_digest(), and hash_block_size().
|
staticconstexpr |
|
staticconstexpr |
Definition at line 65 of file sha2_64.h.
Referenced by output_length().