Botan 3.0.0
Crypto and TLS for C&
Public Member Functions | Static Public Member Functions | List of all members
Botan::SHA_3 Class Reference

#include <sha3.h>

Inheritance diagram for Botan::SHA_3:
Botan::HashFunction Botan::Buffered_Computation Botan::SHA_3_224 Botan::SHA_3_256 Botan::SHA_3_384 Botan::SHA_3_512

Public Member Functions

void clear () override
 
HashFunctionclone () const
 
std::unique_ptr< HashFunctioncopy_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< HashFunctionnew_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
 
 SHA_3 (size_t output_bits)
 
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 size_t absorb (size_t bitrate, secure_vector< uint64_t > &S, size_t S_pos, const uint8_t input[], size_t length)
 
static std::unique_ptr< HashFunctioncreate (std::string_view algo_spec, std::string_view provider="")
 
static std::unique_ptr< HashFunctioncreate_or_throw (std::string_view algo_spec, std::string_view provider="")
 
static void expand (size_t bitrate, secure_vector< uint64_t > &S, uint8_t output[], size_t output_length)
 
static void finish (size_t bitrate, secure_vector< uint64_t > &S, size_t S_pos, uint8_t init_pad, uint8_t fini_pad)
 
static void permute (uint64_t A[25])
 
static std::vector< std::string > providers (std::string_view algo_spec)
 

Detailed Description

SHA-3

Definition at line 20 of file sha3.h.

Constructor & Destructor Documentation

◆ SHA_3()

Botan::SHA_3::SHA_3 ( size_t  output_bits)
explicit
Parameters
output_bitsthe size of the hash output; must be one of 224, 256, 384, or 512

Definition at line 131 of file sha3.cpp.

131 :
132 m_output_bits(output_bits),
133 m_bitrate(1600 - 2*output_bits),
134 m_S(25),
135 m_S_pos(0)
136 {
137 // We only support the parameters for SHA-3 in this constructor
138
139 if(output_bits != 224 && output_bits != 256 &&
140 output_bits != 384 && output_bits != 512)
141 {
142 throw Invalid_Argument(fmt("SHA_3: Invalid output length {}", output_bits));
143 }
144 }
std::string fmt(std::string_view format, const T &... args)
Definition: fmt.h:60

References Botan::fmt().

Member Function Documentation

◆ absorb()

size_t Botan::SHA_3::absorb ( size_t  bitrate,
secure_vector< uint64_t > &  S,
size_t  S_pos,
const uint8_t  input[],
size_t  length 
)
static

Absorb data into the provided state

Parameters
bitratethe bitrate to absorb into the sponge
Sthe sponge state
S_poswhere to begin absorbing into S
inputthe input data
lengthsize of input in bytes

Definition at line 48 of file sha3.cpp.

51 {
52 while(length > 0)
53 {
54 size_t to_take = std::min(length, bitrate / 8 - S_pos);
55
56 length -= to_take;
57
58 while(to_take && S_pos % 8)
59 {
60 S[S_pos / 8] ^= static_cast<uint64_t>(input[0]) << (8 * (S_pos % 8));
61
62 ++S_pos;
63 ++input;
64 --to_take;
65 }
66
67 while(to_take && to_take % 8 == 0)
68 {
69 S[S_pos / 8] ^= load_le<uint64_t>(input, 0);
70 S_pos += 8;
71 input += 8;
72 to_take -= 8;
73 }
74
75 while(to_take)
76 {
77 S[S_pos / 8] ^= static_cast<uint64_t>(input[0]) << (8 * (S_pos % 8));
78
79 ++S_pos;
80 ++input;
81 --to_take;
82 }
83
84 if(S_pos == bitrate / 8)
85 {
86 SHA_3::permute(S.data());
87 S_pos = 0;
88 }
89 }
90
91 return S_pos;
92 }
static void permute(uint64_t A[25])
Definition: sha3.cpp:18
constexpr uint64_t load_le< uint64_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:248

References Botan::load_le< uint64_t >(), and permute().

◆ clear()

void Botan::SHA_3::clear ( )
overridevirtual

Reset the state.

Implements Botan::HashFunction.

Definition at line 173 of file sha3.cpp.

174 {
175 zeroise(m_S);
176 m_S_pos = 0;
177 }
void zeroise(std::vector< T, Alloc > &vec)
Definition: secmem.h:119

References Botan::zeroise().

◆ clone()

HashFunction * Botan::HashFunction::clone ( ) const
inlineinherited
Returns
new object representing the same algorithm as *this

Definition at line 92 of file hash.h.

93 {
94 return this->new_object().release();
95 }
virtual std::unique_ptr< HashFunction > new_object() const =0

◆ copy_state()

std::unique_ptr< HashFunction > Botan::SHA_3::copy_state ( ) const
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.

Returns
new hash object

Implements Botan::HashFunction.

Definition at line 163 of file sha3.cpp.

164 {
165 return std::make_unique<SHA_3>(*this);
166 }

◆ create()

std::unique_ptr< HashFunction > Botan::HashFunction::create ( std::string_view  algo_spec,
std::string_view  provider = "" 
)
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 102 of file hash.cpp.

104 {
105
106#if defined(BOTAN_HAS_COMMONCRYPTO)
107 if(provider.empty() || provider == "commoncrypto")
108 {
109 if(auto hash = make_commoncrypto_hash(algo_spec))
110 return hash;
111
112 if(!provider.empty())
113 return nullptr;
114 }
115#endif
116
117 if(provider.empty() == false && provider != "base")
118 return nullptr; // unknown provider
119
120#if defined(BOTAN_HAS_SHA1)
121 if(algo_spec == "SHA-1")
122 {
123 return std::make_unique<SHA_1>();
124 }
125#endif
126
127#if defined(BOTAN_HAS_SHA2_32)
128 if(algo_spec == "SHA-224")
129 {
130 return std::make_unique<SHA_224>();
131 }
132
133 if(algo_spec == "SHA-256")
134 {
135 return std::make_unique<SHA_256>();
136 }
137#endif
138
139#if defined(BOTAN_HAS_SHA2_64)
140 if(algo_spec == "SHA-384")
141 {
142 return std::make_unique<SHA_384>();
143 }
144
145 if(algo_spec == "SHA-512")
146 {
147 return std::make_unique<SHA_512>();
148 }
149
150 if(algo_spec == "SHA-512-256")
151 {
152 return std::make_unique<SHA_512_256>();
153 }
154#endif
155
156#if defined(BOTAN_HAS_RIPEMD_160)
157 if(algo_spec == "RIPEMD-160")
158 {
159 return std::make_unique<RIPEMD_160>();
160 }
161#endif
162
163#if defined(BOTAN_HAS_WHIRLPOOL)
164 if(algo_spec == "Whirlpool")
165 {
166 return std::make_unique<Whirlpool>();
167 }
168#endif
169
170#if defined(BOTAN_HAS_MD5)
171 if(algo_spec == "MD5")
172 {
173 return std::make_unique<MD5>();
174 }
175#endif
176
177#if defined(BOTAN_HAS_MD4)
178 if(algo_spec == "MD4")
179 {
180 return std::make_unique<MD4>();
181 }
182#endif
183
184#if defined(BOTAN_HAS_GOST_34_11)
185 if(algo_spec == "GOST-R-34.11-94" || algo_spec == "GOST-34.11")
186 {
187 return std::make_unique<GOST_34_11>();
188 }
189#endif
190
191#if defined(BOTAN_HAS_ADLER32)
192 if(algo_spec == "Adler32")
193 {
194 return std::make_unique<Adler32>();
195 }
196#endif
197
198#if defined(BOTAN_HAS_CRC24)
199 if(algo_spec == "CRC24")
200 {
201 return std::make_unique<CRC24>();
202 }
203#endif
204
205#if defined(BOTAN_HAS_CRC32)
206 if(algo_spec == "CRC32")
207 {
208 return std::make_unique<CRC32>();
209 }
210#endif
211
212#if defined(BOTAN_HAS_STREEBOG)
213 if(algo_spec == "Streebog-256")
214 {
215 return std::make_unique<Streebog>(256);
216 }
217 if(algo_spec == "Streebog-512")
218 {
219 return std::make_unique<Streebog>(512);
220 }
221#endif
222
223#if defined(BOTAN_HAS_SM3)
224 if(algo_spec == "SM3")
225 {
226 return std::make_unique<SM3>();
227 }
228#endif
229
230 const SCAN_Name req(algo_spec);
231
232#if defined(BOTAN_HAS_SKEIN_512)
233 if(req.algo_name() == "Skein-512")
234 {
235 return std::make_unique<Skein_512>(req.arg_as_integer(0, 512), req.arg(1, ""));
236 }
237#endif
238
239#if defined(BOTAN_HAS_BLAKE2B)
240 if(req.algo_name() == "Blake2b" || req.algo_name() == "BLAKE2b")
241 {
242 return std::make_unique<BLAKE2b>(req.arg_as_integer(0, 512));
243 }
244#endif
245
246#if defined(BOTAN_HAS_KECCAK)
247 if(req.algo_name() == "Keccak-1600")
248 {
249 return std::make_unique<Keccak_1600>(req.arg_as_integer(0, 512));
250 }
251#endif
252
253#if defined(BOTAN_HAS_SHA3)
254 if(req.algo_name() == "SHA-3")
255 {
256 return std::make_unique<SHA_3>(req.arg_as_integer(0, 512));
257 }
258#endif
259
260#if defined(BOTAN_HAS_SHAKE)
261 if(req.algo_name() == "SHAKE-128" && req.arg_count() == 1)
262 {
263 return std::make_unique<SHAKE_128>(req.arg_as_integer(0));
264 }
265 if(req.algo_name() == "SHAKE-256" && req.arg_count() == 1)
266 {
267 return std::make_unique<SHAKE_256>(req.arg_as_integer(0));
268 }
269#endif
270
271#if defined(BOTAN_HAS_PARALLEL_HASH)
272 if(req.algo_name() == "Parallel")
273 {
274 std::vector<std::unique_ptr<HashFunction>> hashes;
275
276 for(size_t i = 0; i != req.arg_count(); ++i)
277 {
278 auto h = HashFunction::create(req.arg(i));
279 if(!h)
280 {
281 return nullptr;
282 }
283 hashes.push_back(std::move(h));
284 }
285
286 return std::make_unique<Parallel>(hashes);
287 }
288#endif
289
290#if defined(BOTAN_HAS_TRUNCATED_HASH)
291 if(req.algo_name() == "Truncated" && req.arg_count() == 2)
292 {
293 auto hash = HashFunction::create(req.arg(0));
294 if(!hash)
295 {
296 return nullptr;
297 }
298
299 return std::make_unique<Truncated_Hash>(std::move(hash), req.arg_as_integer(1));
300 }
301#endif
302
303#if defined(BOTAN_HAS_COMB4P)
304 if(req.algo_name() == "Comb4P" && req.arg_count() == 2)
305 {
306 auto h1 = HashFunction::create(req.arg(0));
307 auto h2 = HashFunction::create(req.arg(1));
308
309 if(h1 && h2)
310 return std::make_unique<Comb4P>(std::move(h1), std::move(h2));
311 }
312#endif
313
314
315 return nullptr;
316 }
virtual std::string provider() const
Definition: hash.h:54
static std::unique_ptr< HashFunction > create(std::string_view algo_spec, std::string_view provider="")
Definition: hash.cpp:102
std::unique_ptr< HashFunction > make_commoncrypto_hash(std::string_view name)

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().

◆ create_or_throw()

std::unique_ptr< HashFunction > Botan::HashFunction::create_or_throw ( std::string_view  algo_spec,
std::string_view  provider = "" 
)
staticinherited

◆ expand()

void Botan::SHA_3::expand ( size_t  bitrate,
secure_vector< uint64_t > &  S,
uint8_t  output[],
size_t  output_length 
)
static

Expand from provided state

Parameters
bitratesponge parameter
Sthe state
outputthe output buffer
output_lengththe size of output in bytes

Definition at line 107 of file sha3.cpp.

110 {
111 BOTAN_ARG_CHECK(bitrate % 64 == 0, "SHA-3 bitrate must be multiple of 64");
112
113 const size_t byterate = bitrate / 8;
114
115 while(output_length > 0)
116 {
117 const size_t copying = std::min(byterate, output_length);
118
119 copy_out_vec_le(output, copying, S);
120
121 output += copying;
122 output_length -= copying;
123
124 if(output_length > 0)
125 {
126 SHA_3::permute(S.data());
127 }
128 }
129 }
#define BOTAN_ARG_CHECK(expr, msg)
Definition: assert.h:36
size_t output_length() const override
Definition: sha3.h:31
void copy_out_vec_le(uint8_t out[], size_t out_bytes, const std::vector< T, Alloc > &in)
Definition: loadstor.h:705

References BOTAN_ARG_CHECK, Botan::copy_out_vec_le(), output_length(), and permute().

◆ final() [1/4]

template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>>
T Botan::Buffered_Computation::final ( )
inlineinherited

Complete the computation and retrieve the final result as a container of your choice.

Returns
a contiguous container holding the result

Definition at line 84 of file buf_comp.h.

85 {
86 T output(output_length());
87 final_result(output.data());
88 return output;
89 }
virtual size_t output_length() const =0
FE_25519 T
Definition: ge.cpp:36

References T.

◆ final() [2/4]

void Botan::Buffered_Computation::final ( std::span< uint8_t >  out)
inlineinherited

Definition at line 96 of file buf_comp.h.

97 {
98 BOTAN_ASSERT_NOMSG(out.size() >= output_length());
99 final_result(out.data());
100 }
#define BOTAN_ASSERT_NOMSG(expr)
Definition: assert.h:67

References BOTAN_ASSERT_NOMSG.

◆ final() [3/4]

template<concepts::resizable_byte_buffer T>
void Botan::Buffered_Computation::final ( T out)
inlineinherited

Definition at line 103 of file buf_comp.h.

104 {
105 out.resize(output_length());
106 final_result(out.data());
107 }

◆ final() [4/4]

void Botan::Buffered_Computation::final ( uint8_t  out[])
inlineinherited

Complete the computation and retrieve the final result.

Parameters
outThe byte array to be filled with the result. Must be of length output_length()

Definition at line 76 of file buf_comp.h.

76{ final_result(out); }

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(), and Botan::sm2_compute_za().

◆ final_stdvec()

std::vector< uint8_t > Botan::Buffered_Computation::final_stdvec ( )
inlineinherited

Definition at line 91 of file buf_comp.h.

92 {
93 return final<std::vector<uint8_t>>();
94 }

◆ finish()

void Botan::SHA_3::finish ( size_t  bitrate,
secure_vector< uint64_t > &  S,
size_t  S_pos,
uint8_t  init_pad,
uint8_t  fini_pad 
)
static

Add final padding and permute. The padding is assumed to be init_pad || 00... || fini_pad

Parameters
bitratethe bitrate to absorb into the sponge
Sthe sponge state
S_poswhere to begin absorbing into S
init_padthe leading pad bits
fini_padthe final pad bits

Definition at line 95 of file sha3.cpp.

98 {
99 BOTAN_ARG_CHECK(bitrate % 64 == 0, "SHA-3 bitrate must be multiple of 64");
100
101 S[S_pos / 8] ^= static_cast<uint64_t>(init_pad) << (8 * (S_pos % 8));
102 S[(bitrate / 64) - 1] ^= static_cast<uint64_t>(fini_pad) << 56;
103 SHA_3::permute(S.data());
104 }

References BOTAN_ARG_CHECK, and permute().

◆ hash_block_size()

size_t Botan::SHA_3::hash_block_size ( ) const
inlineoverridevirtual
Returns
hash block size as defined for this algorithm

Reimplemented from Botan::HashFunction.

Definition at line 30 of file sha3.h.

30{ return m_bitrate / 8; }

◆ name()

std::string Botan::SHA_3::name ( ) const
overridevirtual
Returns
the hash function name

Implements Botan::HashFunction.

Definition at line 146 of file sha3.cpp.

147 {
148 return fmt("SHA-3({})", m_output_bits);
149 }

References Botan::fmt().

◆ new_object()

std::unique_ptr< HashFunction > Botan::SHA_3::new_object ( ) const
overridevirtual
Returns
new object representing the same algorithm as *this

Implements Botan::HashFunction.

Definition at line 168 of file sha3.cpp.

169 {
170 return std::make_unique<SHA_3>(m_output_bits);
171 }

◆ output_length()

size_t Botan::SHA_3::output_length ( ) const
inlineoverridevirtual
Returns
length of the output of this function in bytes

Implements Botan::Buffered_Computation.

Definition at line 31 of file sha3.h.

31{ return m_output_bits / 8; }

Referenced by expand().

◆ permute()

void Botan::SHA_3::permute ( uint64_t  A[25])
static

The bare Keccak-1600 permutation

Definition at line 18 of file sha3.cpp.

19 {
20#if defined(BOTAN_HAS_SHA3_BMI2)
21 if(CPUID::has_bmi2())
22 {
23 return permute_bmi2(A);
24 }
25#endif
26
27 static const uint64_t RC[24] = {
28 0x0000000000000001, 0x0000000000008082, 0x800000000000808A,
29 0x8000000080008000, 0x000000000000808B, 0x0000000080000001,
30 0x8000000080008081, 0x8000000000008009, 0x000000000000008A,
31 0x0000000000000088, 0x0000000080008009, 0x000000008000000A,
32 0x000000008000808B, 0x800000000000008B, 0x8000000000008089,
33 0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
34 0x000000000000800A, 0x800000008000000A, 0x8000000080008081,
35 0x8000000000008080, 0x0000000080000001, 0x8000000080008008
36 };
37
38 uint64_t T[25];
39
40 for(size_t i = 0; i != 24; i += 2)
41 {
42 SHA3_round(T, A, RC[i+0]);
43 SHA3_round(A, T, RC[i+1]);
44 }
45 }
void SHA3_round(uint64_t T[25], const uint64_t A[25], uint64_t RC)
Definition: sha3_round.h:15

References Botan::SHA3_round(), and T.

Referenced by absorb(), expand(), and finish().

◆ process() [1/3]

template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>>
T Botan::Buffered_Computation::process ( const uint8_t  in[],
size_t  length 
)
inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters
inthe input to process as a byte array
lengththe length of the byte array
Returns
the result of the call to final()

Definition at line 117 of file buf_comp.h.

118 {
119 update(in, length);
120 return final<T>();
121 }
int(* update)(CTX *, const void *, CC_LONG len)

References update.

Referenced by Botan::Dilithium_Symmetric_Primitives::CRH(), and Botan::Dilithium_Symmetric_Primitives::H().

◆ process() [2/3]

template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>>
T Botan::Buffered_Computation::process ( std::span< const uint8_t >  in)
inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters
inthe input to process as a contiguous container
Returns
the result of the call to final()

Definition at line 143 of file buf_comp.h.

144 {
145 update(in);
146 return final<T>();
147 }

References update.

◆ process() [3/3]

template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>>
T Botan::Buffered_Computation::process ( std::string_view  in)
inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters
inthe input to process as a string
Returns
the result of the call to final()

Definition at line 130 of file buf_comp.h.

131 {
132 update(in);
133 return final<T>();
134 }

References update.

◆ provider()

std::string Botan::SHA_3::provider ( ) const
overridevirtual
Returns
provider information about this implementation. Default is "base", might also return "sse2", "avx2", "openssl", or some other arbitrary string.

Reimplemented from Botan::HashFunction.

Definition at line 151 of file sha3.cpp.

152 {
153#if defined(BOTAN_HAS_SHA3_BMI2)
154 if(CPUID::has_bmi2())
155 {
156 return "bmi2";
157 }
158#endif
159
160 return "base";
161 }

◆ providers()

std::vector< std::string > Botan::HashFunction::providers ( std::string_view  algo_spec)
staticinherited
Returns
list of available providers for this algorithm, empty if not available
Parameters
algo_specalgorithm name

Definition at line 330 of file hash.cpp.

331 {
332 return probe_providers_of<HashFunction>(algo_spec, {"base", "commoncrypto"});
333 }

◆ update() [1/4]

void Botan::Buffered_Computation::update ( const uint8_t  in[],
size_t  length 
)
inlineinherited

Add new input to process.

Parameters
inthe input to process as a byte array
lengthof param in in bytes

Definition at line 35 of file buf_comp.h.

35{ add_data(in, length); }

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(), and Botan::sm2_compute_za().

◆ update() [2/4]

void Botan::Buffered_Computation::update ( std::span< const uint8_t >  in)
inlineinherited

Add new input to process.

Parameters
inthe input to process as a contiguous data range

Definition at line 41 of file buf_comp.h.

42 {
43 add_data(in.data(), in.size());
44 }

◆ update() [3/4]

void Botan::Buffered_Computation::update ( std::string_view  str)
inlineinherited

Add new input to process.

Parameters
strthe input to process as a std::string_view. Will be interpreted as a byte array based on the strings encoding.

Definition at line 59 of file buf_comp.h.

60 {
61 add_data(cast_char_ptr_to_uint8(str.data()), str.size());
62 }
const uint8_t * cast_char_ptr_to_uint8(const char *s)
Definition: mem_ops.h:183

References Botan::cast_char_ptr_to_uint8().

◆ update() [4/4]

void Botan::Buffered_Computation::update ( uint8_t  in)
inlineinherited

Process a single byte.

Parameters
inthe byte to process

Definition at line 68 of file buf_comp.h.

68{ add_data(&in, 1); }

◆ update_be() [1/3]

void Botan::Buffered_Computation::update_be ( uint16_t  val)
inherited

Definition at line 12 of file buf_comp.cpp.

13 {
14 uint8_t inb[sizeof(val)];
15 store_be(val, inb);
16 add_data(inb, sizeof(inb));
17 }
constexpr void store_be(uint16_t in, uint8_t out[2])
Definition: loadstor.h:449

References Botan::store_be().

Referenced by Botan::mgf1_mask(), and Botan::pbkdf2().

◆ update_be() [2/3]

void Botan::Buffered_Computation::update_be ( uint32_t  val)
inherited

Definition at line 19 of file buf_comp.cpp.

20 {
21 uint8_t inb[sizeof(val)];
22 store_be(val, inb);
23 add_data(inb, sizeof(inb));
24 }

References Botan::store_be().

◆ update_be() [3/3]

void Botan::Buffered_Computation::update_be ( uint64_t  val)
inherited

Definition at line 26 of file buf_comp.cpp.

27 {
28 uint8_t inb[sizeof(val)];
29 store_be(val, inb);
30 add_data(inb, sizeof(inb));
31 }

References Botan::store_be().

◆ update_le() [1/3]

void Botan::Buffered_Computation::update_le ( uint16_t  val)
inherited

Definition at line 33 of file buf_comp.cpp.

34 {
35 uint8_t inb[sizeof(val)];
36 store_le(val, inb);
37 add_data(inb, sizeof(inb));
38 }
constexpr void store_le(uint16_t in, uint8_t out[2])
Definition: loadstor.h:465

References Botan::store_le().

◆ update_le() [2/3]

void Botan::Buffered_Computation::update_le ( uint32_t  val)
inherited

Definition at line 40 of file buf_comp.cpp.

41 {
42 uint8_t inb[sizeof(val)];
43 store_le(val, inb);
44 add_data(inb, sizeof(inb));
45 }

References Botan::store_le().

◆ update_le() [3/3]

void Botan::Buffered_Computation::update_le ( uint64_t  val)
inherited

Definition at line 47 of file buf_comp.cpp.

48 {
49 uint8_t inb[sizeof(val)];
50 store_le(val, inb);
51 add_data(inb, sizeof(inb));
52 }

References Botan::store_le().


The documentation for this class was generated from the following files: