Botan 3.6.1
Crypto and TLS for C&
|
#include <keccak_perm.h>
Public Member Functions | |
void | absorb (std::span< const uint8_t > input) |
Absorb input data into the Keccak sponge. | |
size_t | bit_rate () const |
size_t | byte_rate () const |
size_t | capacity () const |
void | clear () |
void | finish () |
Add final padding (as provided in the constructor) and permute. | |
Keccak_Permutation (size_t capacity_bits, uint64_t custom_padding, uint8_t custom_padding_bit_len) | |
Instantiate a Keccak permutation. | |
std::string | provider () const |
void | squeeze (std::span< uint8_t > output) |
Expand output data from the current Keccak state. | |
KECCAK FIPS
This file implements Keccak[c] which is specified by NIST FIPS 202 [1], where "c" is the variable capacity of this hash primitive. Keccak[c] is not a general purpose hash function, but used as the basic primitive for algorithms such as SHA-3 and KMAC. This is not to be confused with the "informal" general purpose hash function which is referred to as "Keccak" and apparently refers to the final submission version of the Keccak submission in the SHA-3 contest, possibly what is released by NIST under the name "KECCAK - Final Algorithm Package" [2]. See also the file keccak.h for the details how the keccak hash function is defined in terms of the Keccak[c] – a detail which cannot be found in [1].
[1] FIPS PUB 202 – FEDERAL INFORMATION PROCESSING STANDARDS PUBLICATION – SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf#page=28 [2] https://csrc.nist.gov/projects/hash-functions/sha-3-project
Definition at line 38 of file keccak_perm.h.
Botan::Keccak_Permutation::Keccak_Permutation | ( | size_t | capacity_bits, |
uint64_t | custom_padding, | ||
uint8_t | custom_padding_bit_len ) |
Instantiate a Keccak permutation.
The custom_padding
is assumed to be init_pad || 00... || fini_pad
capacity_bits | Keccak capacity |
custom_padding | the custom bit padding that is to be appended on the call to finish |
custom_padding_bit_len | the bit length of the custom_padd |
Definition at line 21 of file keccak_perm.cpp.
References BOTAN_ARG_CHECK, and capacity().
void Botan::Keccak_Permutation::absorb | ( | std::span< const uint8_t > | input | ) |
Absorb input data into the Keccak sponge.
This method can be called multiple times with arbitrary-length buffers.
input | the input data |
Definition at line 48 of file keccak_perm.cpp.
References Botan::BufferSlicer::empty(), Botan::load_le(), Botan::BufferSlicer::remaining(), Botan::BufferSlicer::take(), and Botan::BufferSlicer::take_byte().
|
inline |
Definition at line 53 of file keccak_perm.h.
|
inline |
Definition at line 55 of file keccak_perm.h.
Referenced by Botan::cSHAKE_XOF::block_size(), Botan::SHAKE_XOF::block_size(), Botan::SHAKE_Cipher::buffer_size(), Botan::Keccak_1600::hash_block_size(), Botan::SHA_3::hash_block_size(), Botan::SHAKE_128::hash_block_size(), and Botan::SHAKE_256::hash_block_size().
|
inline |
Definition at line 51 of file keccak_perm.h.
Referenced by Keccak_Permutation().
void Botan::Keccak_Permutation::clear | ( | ) |
Definition at line 42 of file keccak_perm.cpp.
References Botan::zeroise().
Referenced by Botan::Keccak_1600::clear(), Botan::SHA_3::clear(), Botan::SHAKE_128::clear(), Botan::SHAKE_256::clear(), and Botan::SHAKE_Cipher::clear().
void Botan::Keccak_Permutation::finish | ( | ) |
Add final padding (as provided in the constructor) and permute.
Definition at line 112 of file keccak_perm.cpp.
std::string Botan::Keccak_Permutation::provider | ( | ) | const |
Definition at line 32 of file keccak_perm.cpp.
Referenced by Botan::cSHAKE_XOF::provider(), Botan::Keccak_1600::provider(), Botan::SHA_3::provider(), Botan::SHAKE_128::provider(), Botan::SHAKE_256::provider(), and Botan::SHAKE_XOF::provider().
void Botan::Keccak_Permutation::squeeze | ( | std::span< uint8_t > | output | ) |
Expand output data from the current Keccak state.
This method can be called multiple times with arbitrary-length buffers.
output | the designated output memory |
Definition at line 80 of file keccak_perm.cpp.
References Botan::BufferStuffer::full(), Botan::BufferStuffer::next(), Botan::BufferStuffer::next_byte(), Botan::BufferStuffer::remaining_capacity(), and Botan::store_le().