|
15 | 15 | //! hasher.update(b"hello world"); |
16 | 16 | //! |
17 | 17 | //! // read hash digest and consume hasher |
18 | | -//! let res = hasher.result(); |
| 18 | +//! let res = hasher.finalize(); |
19 | 19 | //! assert_eq!(res[..], hex!(" |
20 | 20 | //! 021ced8799296ceca557832ab941a50b4a11f83478cf141f51f933f653ab9fbc |
21 | 21 | //! c05a037cddbed06e309bf334942c4e58cdf1a46e237911ccd7fcf9787cbc7fd0 |
|
24 | 24 | //! // same example for `Blake2s`: |
25 | 25 | //! let mut hasher = Blake2s::new(); |
26 | 26 | //! hasher.update(b"hello world"); |
27 | | -//! let res = hasher.result(); |
| 27 | +//! let res = hasher.finalize(); |
28 | 28 | //! assert_eq!(res[..], hex!(" |
29 | 29 | //! 9aec6806794561107e594b1f6a8a6b0c92a0cba9acf5e5e93cca06f781813b0b |
30 | 30 | //! ")[..]); |
|
44 | 44 | //! |
45 | 45 | //! let mut hasher = VarBlake2b::new(10).unwrap(); |
46 | 46 | //! hasher.update(b"my_input"); |
47 | | -//! hasher.variable_result(|res| { |
| 47 | +//! hasher.finalize_variable(|res| { |
48 | 48 | //! assert_eq!(res, [44, 197, 92, 132, 228, 22, 146, 78, 100, 0]) |
49 | 49 | //! }) |
50 | 50 | //! ``` |
|
62 | 62 | //! |
63 | 63 | //! // `result` has type `crypto_mac::Output` which is a thin wrapper around |
64 | 64 | //! // a byte array and provides a constant time equality check |
65 | | -//! let result = hasher.result(); |
| 65 | +//! let result = hasher.finalize(); |
66 | 66 | //! // To get underlying array use the `into_bytes` method, but be careful, |
67 | 67 | //! // since incorrect use of the code value may permit timing attacks which |
68 | 68 | //! // defeat the security provided by the `crypto_mac::Output` |
|
0 commit comments