Debian Codegraph @

src/lib.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 //! The [MD5] hash function.
2 //!
3 //! ## Example
4 //!
5 //! ```
6 //! let digest = md5::compute(b"abcdefghijklmnopqrstuvwxyz");
7 //! assert_eq!(format!("{:x}", digest), "c3fcd3d76192e4007dfb496cca67e13b");
8 //! ```
9 //!
10 //! ## Security Warning
11 //!
12 //! The package is provided for the purposes of interoperability with protocols
13 //! and systems that mandate the use of MD5. However, MD5 should be considered
14 //! [cryptographically broken and unsuitable for further use][VU836068].
15 //! Collision attacks against MD5 are both practical and trivial, and
16 //! [theoretical attacks against MD5 have been found][ACM1724151].
17 //!
18 //! [RFC6151] advises no new protocols to be designed with any MD5-based
19 //! constructions, including HMAC-MD5.
20 //!
21 //! [MD5]: https://en.wikipedia.org/wiki/MD5
22 //!
23 //! [ACM1724151]: https://dl.acm.org/citation.cfm?id=1724151
24 //! [RFC6151]: https://tools.ietf.org/html/rfc6151
25 //! [VU836068]: https://www.kb.cert.org/vuls/id/836068
26
27 // The implementation is based on:
28 // https://www.ietf.org/rfc/rfc1321.txt
29
30 #![cfg_attr(not(feature = "std"), no_std)]
31
32 #[cfg(feature = "std")]
33 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/ as corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/;
34
35 /// A digest.
36 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
37 pub struct Digestrust-analyzer cargo md5 0.8.0 Digest#(pub [u8; 16]);
38
39 impl corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Digestrust-analyzer cargo md5 0.8.0 Digest#> for [u8; 16] {
40 #[inline]
41 fn fromrust-analyzer cargo md5 0.8.0 impl#[`[u8; 16]`][`From<Digest>`]from().(digest: Digestrust-analyzer cargo md5 0.8.0 Digest#) -> Selfrust-analyzer cargo md5 0.8.0 impl#[`[u8; 16]`][`From<Digest>`] {
42 digest.0rust-analyzer cargo md5 0.8.0 Digest#0.
43 }
44 }
45
46 impl corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Digestrust-analyzer cargo md5 0.8.0 Digest# {
47 #[inline]
48 fn fmtrust-analyzer cargo md5 0.8.0 impl#[Digest][Debug]fmt().(&self, formatter: &mut corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
49 corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::LowerHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/LowerHex#::fmtrust-analyzer cargo md5 0.8.0 impl#[Digest][LowerHex]fmt().(self, formatter)
50 }
51 }
52
53 impl corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for Digestrust-analyzer cargo md5 0.8.0 Digest# {
54 type Targetrust-analyzer cargo md5 0.8.0 impl#[Digest][Deref]Target# = [u8; 16];
55
56 #[inline]
57 fn derefrust-analyzer cargo md5 0.8.0 impl#[Digest][Deref]deref().(&self) -> &Selfrust-analyzer cargo md5 0.8.0 impl#[Digest][Deref]::Targetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#Target# {
58 &self.0rust-analyzer cargo md5 0.8.0 Digest#0.
59 }
60 }
61
62 impl corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut# for Digestrust-analyzer cargo md5 0.8.0 Digest# {
63 #[inline]
64 fn deref_mutrust-analyzer cargo md5 0.8.0 impl#[Digest][DerefMut]deref_mut().(&mut self) -> &mut Selfrust-analyzer cargo md5 0.8.0 impl#[Digest][DerefMut]::Targetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#Target# {
65 &mut self.0rust-analyzer cargo md5 0.8.0 Digest#0.
66 }
67 }
68
69 macro_rules! implementrust-analyzer cargo md5 0.8.0 implement! {
70 ($kind:ident, $format:expr) => {
71 impl core::fmt::$kind for Digest {
72 fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
73 for value in &self.0 {
74 write!(formatter, $format, value)?;
75 }
76 Ok(())
77 }
78 }
79 };
80 }
81
82 implementrust-analyzer cargo md5 0.8.0 implement!!(LowerHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/LowerHex#, "{:02x}");
83 implementrust-analyzer cargo md5 0.8.0 implement!!(UpperHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/UpperHex#, "{:02X}");
84
85 /// A context.
86 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
87 pub struct Contextrust-analyzer cargo md5 0.8.0 Context# {
88 bufferrust-analyzer cargo md5 0.8.0 Context#buffer.: [u8; 64],
89 countrust-analyzer cargo md5 0.8.0 Context#count.: u64,
90 staterust-analyzer cargo md5 0.8.0 Context#state.: [u32; 4],
91 }
92
93 const PADDINGrust-analyzer cargo md5 0.8.0 PADDING.: [u8; 64] = [
94 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
95 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
96 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98 ];
99
100 impl Contextrust-analyzer cargo md5 0.8.0 Context# {
101 /// Create a context for computing a digest.
102 #[inline]
103 pub fn newrust-analyzer cargo md5 0.8.0 impl#[Context]new().() -> Contextrust-analyzer cargo md5 0.8.0 Context# {
104 Contextrust-analyzer cargo md5 0.8.0 Context# {
105 bufferrust-analyzer cargo md5 0.8.0 Context#buffer.: [0; 64],
106 countrust-analyzer cargo md5 0.8.0 Context#count.: 0,
107 staterust-analyzer cargo md5 0.8.0 Context#state.: [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476],
108 }
109 }
110
111 /// Consume data.
112 #[inline]
113 pub fn consumerust-analyzer cargo md5 0.8.0 impl#[Context]consume().<T: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]>>(&mut self, data: T) {
114 consumerust-analyzer cargo md5 0.8.0 consume().(self, data.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().());
115 }
116
117 /// Finalize and return the digest.
118 #[rustfmt::skip]
119 #[allow(clippy::double_parens, clippy::needless_range_loop)]
120 pub fn finalizerust-analyzer cargo md5 0.8.0 impl#[Context]finalize().(mut self) -> Digestrust-analyzer cargo md5 0.8.0 Digest# {
121 let mut input = [0u32; 16];
122 let k = ((self.countrust-analyzer cargo md5 0.8.0 Context#count. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr().3) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().0x3f) as usize;
123 input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().14]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.countrust-analyzer cargo md5 0.8.0 Context#count. as u32;
124 input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().15]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = (self.countrust-analyzer cargo md5 0.8.0 Context#count. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr().32) as u32;
125 consumerust-analyzer cargo md5 0.8.0 consume().(
126 &mut self,
127 &PADDINGrust-analyzer cargo md5 0.8.0 PADDING.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#(if k rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().56 { 56 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().k } else { 120 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().k })]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().,
128 );
129 let mut j = 0;
130 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#14 {
131 input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = ((self.bufferrust-analyzer cargo md5 0.8.0 Context#buffer.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().24) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
132 ((self.bufferrust-analyzer cargo md5 0.8.0 Context#buffer.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
133 ((self.bufferrust-analyzer cargo md5 0.8.0 Context#buffer.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().8) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
134 ((self.bufferrust-analyzer cargo md5 0.8.0 Context#buffer.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u32) );
135 j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().4;
136 }
137 transformrust-analyzer cargo md5 0.8.0 transform().(&mut self.staterust-analyzer cargo md5 0.8.0 Context#state., &input);
138 let mut digest = [0u8; 16];
139 let mut j = 0;
140 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4 {
141 digest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = ((self.staterust-analyzer cargo md5 0.8.0 Context#state.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). ) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0xff) as u8;
142 digest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = ((self.staterust-analyzer cargo md5 0.8.0 Context#state.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().8) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0xff) as u8;
143 digest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = ((self.staterust-analyzer cargo md5 0.8.0 Context#state.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0xff) as u8;
144 digest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = ((self.staterust-analyzer cargo md5 0.8.0 Context#state.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().24) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0xff) as u8;
145 j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().4;
146 }
147 Digestrust-analyzer cargo md5 0.8.0 Digest#(digest)
148 }
149
150 /// Finalize and return the digest.
151 #[deprecated(since = "0.8.0", note = "Use `finalize`.")]
152 #[inline]
153 pub fn computerust-analyzer cargo md5 0.8.0 impl#[Context]compute().(self) -> Digestrust-analyzer cargo md5 0.8.0 Digest# {
154 self.finalizerust-analyzer cargo md5 0.8.0 impl#[Context]finalize().()
155 }
156 }
157
158 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Contextrust-analyzer cargo md5 0.8.0 Context# {
159 #[inline]
160 fn defaultrust-analyzer cargo md5 0.8.0 impl#[Context][Default]default().() -> Selfrust-analyzer cargo md5 0.8.0 impl#[Context][Default] {
161 Selfrust-analyzer cargo md5 0.8.0 impl#[Context][Default]::newrust-analyzer cargo md5 0.8.0 impl#[Context]new().()
162 }
163 }
164
165 impl corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Contextrust-analyzer cargo md5 0.8.0 Context#> for Digestrust-analyzer cargo md5 0.8.0 Digest# {
166 #[inline]
167 fn fromrust-analyzer cargo md5 0.8.0 impl#[Digest][`From<Context>`]from().(context: Contextrust-analyzer cargo md5 0.8.0 Context#) -> Digestrust-analyzer cargo md5 0.8.0 Digest# {
168 context.finalizerust-analyzer cargo md5 0.8.0 impl#[Context]finalize().()
169 }
170 }
171
172 #[cfg(feature = "std")]
173 impl corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write# for Contextrust-analyzer cargo md5 0.8.0 Context# {
174 #[inline]
175 fn writerust-analyzer cargo md5 0.8.0 impl#[Context][Write]write().(&mut self, data: &[u8]) -> corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
176 self.consumerust-analyzer cargo md5 0.8.0 impl#[Context]consume().(data);
177 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(data.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().())
178 }
179
180 #[inline]
181 fn flushrust-analyzer cargo md5 0.8.0 impl#[Context][Write]flush().(&mut self) -> corerust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
182 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
183 }
184 }
185
186 /// Compute the digest of data.
187 #[inline]
188 pub fn computerust-analyzer cargo md5 0.8.0 compute().<T: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]>>(data: T) -> Digestrust-analyzer cargo md5 0.8.0 Digest# {
189 let mut context = Contextrust-analyzer cargo md5 0.8.0 Context#::newrust-analyzer cargo md5 0.8.0 impl#[Context]new().();
190 context.consumerust-analyzer cargo md5 0.8.0 impl#[Context]consume().(data);
191 context.finalizerust-analyzer cargo md5 0.8.0 impl#[Context]finalize().()
192 }
193
194 #[rustfmt::skip]
195 #[allow(clippy::double_parens, clippy::needless_range_loop)]
196 fn consumerust-analyzer cargo md5 0.8.0 consume().(
197 Contextrust-analyzer cargo md5 0.8.0 Context# {
198 bufferrust-analyzer cargo md5 0.8.0 Context#buffer.,
199 countrust-analyzer cargo md5 0.8.0 Context#count.,
200 staterust-analyzer cargo md5 0.8.0 Context#state.,
201 }: &mut Contextrust-analyzer cargo md5 0.8.0 Context#,
202 data: &[u8],
203 ) {
204 let mut input = [0u32; 16];
205 let mut k = ((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shr<i32>`]shr().3) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().0x3f) as usize;
206 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().count = count.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]wrapping_add().((data.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as u64) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl().3);
207 for &value in data {
208 buffer[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().k]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = value;
209 k rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
210 if k rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0x40 {
211 let mut j = 0;
212 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#16 {
213 input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = ((buffer[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().24) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
214 ((buffer[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
215 ((buffer[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().8) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
216 ((buffer[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). as u32) );
217 j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().4;
218 }
219 transformrust-analyzer cargo md5 0.8.0 transform().(state, &input);
220 k = 0;
221 }
222 }
223 }
224
225 #[rustfmt::skip]
226 fn transformrust-analyzer cargo md5 0.8.0 transform().(state: &mut [u32; 4], input: &[u32; 16]) {
227 let (mut a, mut b, mut c, mut d) = (state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
228 macro_rules! addrust-analyzer cargo md5 0.8.0 add!(
229 ($a:expr, $b:expr) => ($a.wrapping_add($b));
230 );
231 macro_rules! rotaterust-analyzer cargo md5 0.8.0 rotate!(
232 ($x:expr, $n:expr) => ($x.rotate_left($n));
233 );
234 {
235 macro_rules! Frust-analyzer cargo md5 0.8.0 F!(
236 ($x:expr, $y:expr, $z:expr) => (($x & $y) | (!$x & $z));
237 );
238 macro_rules! Trust-analyzer cargo md5 0.8.0 T!(
239 ($a:expr, $b:expr, $c:expr, $d:expr, $x:expr, $s:expr, $ac:expr) => ({
240 $a = add!(add!(add!($a, F!($b, $c, $d)), $x), $ac);
241 $a = rotate!($a, $s);
242 $a = add!($a, $b);
243 });
244 );
245 const S1rust-analyzer cargo md5 0.8.0 S1.: u32 = 7;
246 const S2rust-analyzer cargo md5 0.8.0 S2.: u32 = 12;
247 const S3rust-analyzer cargo md5 0.8.0 S3.: u32 = 17;
248 const S4rust-analyzer cargo md5 0.8.0 S4.: u32 = 22;
249 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 3614090360);
250 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 3905402710);
251 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 606105819);
252 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 3250441966);
253 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 4118548399);
254 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 1200080426);
255 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 2821735955);
256 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 4249261313);
257 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 1770035416);
258 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 2336552879);
259 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().10]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 4294925233);
260 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().11]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 2304563134);
261 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().12]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 1804603682);
262 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().13]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 4254626195);
263 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().14]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 2792965006);
264 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().15]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 1236535329);
265 }
266 {
267 macro_rules! Frust-analyzer cargo md5 0.8.0 F!(
268 ($x:expr, $y:expr, $z:expr) => (($x & $z) | ($y & !$z));
269 );
270 macro_rules! Trust-analyzer cargo md5 0.8.0 T!(
271 ($a:expr, $b:expr, $c:expr, $d:expr, $x:expr, $s:expr, $ac:expr) => ({
272 $a = add!(add!(add!($a, F!($b, $c, $d)), $x), $ac);
273 $a = rotate!($a, $s);
274 $a = add!($a, $b);
275 });
276 );
277 const S1rust-analyzer cargo md5 0.8.0 S1.: u32 = 5;
278 const S2rust-analyzer cargo md5 0.8.0 S2.: u32 = 9;
279 const S3rust-analyzer cargo md5 0.8.0 S3.: u32 = 14;
280 const S4rust-analyzer cargo md5 0.8.0 S4.: u32 = 20;
281 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 4129170786);
282 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 3225465664);
283 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().11]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 643717713);
284 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 3921069994);
285 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 3593408605);
286 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().10]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 38016083);
287 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().15]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 3634488961);
288 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 3889429448);
289 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 568446438);
290 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().14]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 3275163606);
291 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 4107603335);
292 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 1163531501);
293 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().13]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 2850285829);
294 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 4243563512);
295 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 1735328473);
296 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().12]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 2368359562);
297 }
298 {
299 macro_rules! Frust-analyzer cargo md5 0.8.0 F!(
300 ($x:expr, $y:expr, $z:expr) => ($x ^ $y ^ $z);
301 );
302 macro_rules! Trust-analyzer cargo md5 0.8.0 T!(
303 ($a:expr, $b:expr, $c:expr, $d:expr, $x:expr, $s:expr, $ac:expr) => ({
304 $a = add!(add!(add!($a, F!($b, $c, $d)), $x), $ac);
305 $a = rotate!($a, $s);
306 $a = add!($a, $b);
307 });
308 );
309 const S1rust-analyzer cargo md5 0.8.0 S1.: u32 = 4;
310 const S2rust-analyzer cargo md5 0.8.0 S2.: u32 = 11;
311 const S3rust-analyzer cargo md5 0.8.0 S3.: u32 = 16;
312 const S4rust-analyzer cargo md5 0.8.0 S4.: u32 = 23;
313 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 4294588738);
314 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 2272392833);
315 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().11]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 1839030562);
316 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().14]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 4259657740);
317 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 2763975236);
318 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 1272893353);
319 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 4139469664);
320 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().10]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 3200236656);
321 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().13]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 681279174);
322 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 3936430074);
323 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 3572445317);
324 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 76029189);
325 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 3654602809);
326 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().12]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 3873151461);
327 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().15]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 530742520);
328 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 3299628645);
329 }
330 {
331 macro_rules! Frust-analyzer cargo md5 0.8.0 F!(
332 ($x:expr, $y:expr, $z:expr) => ($y ^ ($x | !$z));
333 );
334 macro_rules! Trust-analyzer cargo md5 0.8.0 T!(
335 ($a:expr, $b:expr, $c:expr, $d:expr, $x:expr, $s:expr, $ac:expr) => ({
336 $a = add!(add!(add!($a, F!($b, $c, $d)), $x), $ac);
337 $a = rotate!($a, $s);
338 $a = add!($a, $b);
339 });
340 );
341 const S1rust-analyzer cargo md5 0.8.0 S1.: u32 = 6;
342 const S2rust-analyzer cargo md5 0.8.0 S2.: u32 = 10;
343 const S3rust-analyzer cargo md5 0.8.0 S3.: u32 = 15;
344 const S4rust-analyzer cargo md5 0.8.0 S4.: u32 = 21;
345 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 4096336452);
346 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 1126891415);
347 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().14]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 2878612391);
348 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 4237533241);
349 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().12]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 1700485571);
350 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 2399980690);
351 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().10]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 4293915773);
352 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 2240044497);
353 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 1873313359);
354 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().15]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 4264355552);
355 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 2734768916);
356 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().13]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 1309151649);
357 Trust-analyzer cargo md5 0.8.0 T!!(a, b, c, d, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S1rust-analyzer cargo md5 0.8.0 S1., 4149444226);
358 Trust-analyzer cargo md5 0.8.0 T!!(d, a, b, c, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().11]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S2rust-analyzer cargo md5 0.8.0 S2., 3174756917);
359 Trust-analyzer cargo md5 0.8.0 T!!(c, d, a, b, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S3rust-analyzer cargo md5 0.8.0 S3., 718787259);
360 Trust-analyzer cargo md5 0.8.0 T!!(b, c, d, a, input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., S4rust-analyzer cargo md5 0.8.0 S4., 3951481745);
361 }
362 state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = addrust-analyzer cargo md5 0.8.0 add!!(state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., a);
363 state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = addrust-analyzer cargo md5 0.8.0 add!!(state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., b);
364 state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = addrust-analyzer cargo md5 0.8.0 add!!(state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., c);
365 state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = addrust-analyzer cargo md5 0.8.0 add!!(state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., d);
366 }
367
368 #[cfg(test)]
369 mod testsrust-analyzer cargo md5 0.8.0 tests/ {
370 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::preluderust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/prelude/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#;
371
372 use superrust-analyzer cargo md5 0.8.0 crate/::Contextrust-analyzer cargo md5 0.8.0 Context#;
373
374 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
375 fn computerust-analyzer cargo md5 0.8.0 tests/compute().() {
376 let inputs = [
377 "",
378 "a",
379 "abc",
380 "message digest",
381 "abcdefghijklmnopqrstuvwxyz",
382 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
383 "0123456789012345678901234567890123456789012345678901234567890123",
384 "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
385 ];
386 let outputs = [
387 "d41d8cd98f00b204e9800998ecf8427e",
388 "0cc175b9c0f1b6a831c399e269772661",
389 "900150983cd24fb0d6963f7d28e17f72",
390 "f96b697d7cb7938d525a2f31aaf161d0",
391 "c3fcd3d76192e4007dfb496cca67e13b",
392 "d174ab98d277d9f5a5611c2c9f419d9f",
393 "7f7bfd348709deeaace19e3f535f8c54",
394 "57edf4a22be3c955ac49da2e2107b67a",
395 ];
396 for (input, &output) in inputs.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(outputs.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
397 let digest = superrust-analyzer cargo md5 0.8.0 crate/::computerust-analyzer cargo md5 0.8.0 compute().(input);
398 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{digest:x}"), output);
399
400 let mut context = Contextrust-analyzer cargo md5 0.8.0 Context#::newrust-analyzer cargo md5 0.8.0 impl#[Context]new().();
401 context.consumerust-analyzer cargo md5 0.8.0 impl#[Context]consume().(input);
402 let digest = context.finalizerust-analyzer cargo md5 0.8.0 impl#[Context]finalize().();
403 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{digest:x}"), output);
404 }
405 }
406
407 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
408 fn indexrust-analyzer cargo md5 0.8.0 tests/index().() {
409 let mut digest = superrust-analyzer cargo md5 0.8.0 crate/::computerust-analyzer cargo md5 0.8.0 compute().(b"abc");
410 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(digest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., 0x90);
411 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&digest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., &0x90);
412 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&mut digest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut()., &mut 0x90);
413 }
414
415 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
416 fn write_29rust-analyzer cargo md5 0.8.0 tests/write_29().() {
417 let data = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 8 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1024 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1024];
418 let mut context = Contextrust-analyzer cargo md5 0.8.0 Context#::newrust-analyzer cargo md5 0.8.0 impl#[Context]new().();
419 for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#64 {
420 context.writerust-analyzer cargo md5 0.8.0 impl#[Context][Write]write().(&data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
421 }
422 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
423 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", context.finalizerust-analyzer cargo md5 0.8.0 impl#[Context]finalize().()),
424 "aa559b4e3523a6c931f08f4df52d58f2",
425 );
426 }
427
428 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
•429 #[cfg(target_pointer_width = "64")]
430 fn write_32rust-analyzer cargo md5 0.8.0 tests/write_32().() {
431 let data = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::u32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u32/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u32/MAX. as usize +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1];
432 let mut context = Contextrust-analyzer cargo md5 0.8.0 Context#::newrust-analyzer cargo md5 0.8.0 impl#[Context]new().();
433 context.writerust-analyzer cargo md5 0.8.0 impl#[Context][Write]write().(&data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
434 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
435 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", context.finalizerust-analyzer cargo md5 0.8.0 impl#[Context]finalize().()),
436 "c9a5a6878d97b48cc965c1e41859f034",
437 );
438 }
439 }