• Home
  • Raw
  • Download

Lines Matching full:algorithm

15 //! SHA-2 and the legacy SHA-1 digest algorithm.
46 /// The context's algorithm.
47 pub algorithm: &'static Algorithm, field
53 pub(crate) fn new(algorithm: &'static Algorithm) -> Self { in new()
55 state: algorithm.initial_state, in new()
57 algorithm, in new()
64 let num_blocks = input.len() / self.algorithm.block_len; in update()
65 assert_eq!(num_blocks * self.algorithm.block_len, input.len()); in update()
68 (self.algorithm.block_data_order)(&mut self.state, input.as_ptr(), num_blocks); in update()
78 let block_len = self.algorithm.block_len; in finish()
86 if padding_pos > block_len - self.algorithm.len_len { in finish()
89 (self.algorithm.block_data_order)(&mut self.state, pending.as_ptr(), 1); in finish()
110 (self.algorithm.block_data_order)(&mut self.state, pending.as_ptr(), 1); in finish()
114 algorithm: self.algorithm, in finish()
115 value: (self.algorithm.format_output)(self.state), in finish()
147 pub fn new(algorithm: &'static Algorithm) -> Self { in new()
149 block: BlockContext::new(algorithm), in new()
167 let block_len = self.block.algorithm.block_len; in update()
197 let block_len = self.block.algorithm.block_len; in finish()
202 /// The algorithm that this context is using.
204 pub fn algorithm(&self) -> &'static Algorithm { in algorithm() argument
205 self.block.algorithm in algorithm()
209 /// Returns the digest of `data` using the given digest algorithm.
224 pub fn digest(algorithm: &'static Algorithm, data: &[u8]) -> Digest { in digest() argument
225 let mut ctx = Context::new(algorithm); in digest()
236 algorithm: &'static Algorithm, field
240 /// The algorithm that was used to calculate the digest value.
242 pub fn algorithm(&self) -> &'static Algorithm { in algorithm() argument
243 self.algorithm in algorithm()
251 &endian::as_byte_slice(as64)[..self.algorithm.output_len] in as_ref()
257 write!(fmt, "{:?}:", self.algorithm)?; in fmt()
262 /// A digest algorithm.
263 pub struct Algorithm { struct
272 /// digest algorithm.
298 impl PartialEq for Algorithm { implementation
304 impl Eq for Algorithm {} implementation
306 derive_debug_via_id!(Algorithm);
311 pub static SHA1_FOR_LEGACY_USE_ONLY: Algorithm = Algorithm {
336 pub static SHA256: Algorithm = Algorithm {
361 pub static SHA384: Algorithm = Algorithm {
386 pub static SHA512: Algorithm = Algorithm {
415 pub static SHA512_256: Algorithm = Algorithm {
451 /// The maximum block length (`Algorithm::block_len`) of all the algorithms in
455 /// The maximum output length (`Algorithm::output_len`) of all the algorithms
459 /// The maximum chaining length (`Algorithm::chaining_len`) of all the
549 fn max_input_test(alg: &'static digest::Algorithm) { in max_input_test() argument
556 fn too_long_input_test_block(alg: &'static digest::Algorithm) { in too_long_input_test_block() argument
563 fn too_long_input_test_byte(alg: &'static digest::Algorithm) { in too_long_input_test_byte() argument
571 fn nearly_full_context(alg: &'static digest::Algorithm) -> digest::Context { in nearly_full_context()
581 algorithm: alg, in nearly_full_context()