Lines Matching full:algorithm
15 //! SHA-2 and the legacy SHA-1 digest algorithm.
47 /// The context's algorithm.
48 pub algorithm: &'static Algorithm, field
54 pub(crate) fn new(algorithm: &'static Algorithm) -> Self { in new()
56 state: algorithm.initial_state, in new()
58 algorithm, in new()
65 let num_blocks = input.len() / self.algorithm.block_len; in update()
66 assert_eq!(num_blocks * self.algorithm.block_len, input.len()); in update()
71 (self.algorithm.block_data_order)(&mut self.state, input.as_ptr(), num_blocks); in update()
81 let block_len = self.algorithm.block_len; in finish()
89 if padding_pos > block_len - self.algorithm.len_len { in finish()
92 (self.algorithm.block_data_order)(&mut self.state, pending.as_ptr(), 1); in finish()
113 (self.algorithm.block_data_order)(&mut self.state, pending.as_ptr(), 1); in finish()
117 algorithm: self.algorithm, in finish()
118 value: (self.algorithm.format_output)(self.state), in finish()
150 pub fn new(algorithm: &'static Algorithm) -> Self { in new()
152 block: BlockContext::new(algorithm), in new()
170 let block_len = self.block.algorithm.block_len; in update()
200 let block_len = self.block.algorithm.block_len; in finish()
205 /// The algorithm that this context is using.
207 pub fn algorithm(&self) -> &'static Algorithm { in algorithm() argument
208 self.block.algorithm in algorithm()
212 /// Returns the digest of `data` using the given digest algorithm.
227 pub fn digest(algorithm: &'static Algorithm, data: &[u8]) -> Digest { in digest() argument
228 let mut ctx = Context::new(algorithm); in digest()
239 algorithm: &'static Algorithm, field
243 /// The algorithm that was used to calculate the digest value.
245 pub fn algorithm(&self) -> &'static Algorithm { in algorithm() argument
246 self.algorithm in algorithm()
254 &as64.as_byte_array()[..self.algorithm.output_len] in as_ref()
260 write!(fmt, "{:?}:", self.algorithm)?; in fmt()
265 /// A digest algorithm.
266 pub struct Algorithm { struct
275 /// digest algorithm.
301 impl PartialEq for Algorithm { argument
307 impl Eq for Algorithm {} implementation
309 derive_debug_via_id!(Algorithm);
314 pub static SHA1_FOR_LEGACY_USE_ONLY: Algorithm = Algorithm {
339 pub static SHA256: Algorithm = Algorithm {
364 pub static SHA384: Algorithm = Algorithm {
389 pub static SHA512: Algorithm = Algorithm {
418 pub static SHA512_256: Algorithm = Algorithm {
454 /// The maximum block length (`Algorithm::block_len`) of all the algorithms in
458 /// The maximum output length (`Algorithm::output_len`) of all the algorithms
462 /// The maximum chaining length (`Algorithm::chaining_len`) of all the
534 fn max_input_test(alg: &'static digest::Algorithm) { in max_input_test() argument
541 fn too_long_input_test_block(alg: &'static digest::Algorithm) { in too_long_input_test_block() argument
548 fn too_long_input_test_byte(alg: &'static digest::Algorithm) { in too_long_input_test_byte() argument
556 fn nearly_full_context(alg: &'static digest::Algorithm) -> digest::Context { in nearly_full_context()
566 algorithm: alg, in nearly_full_context()