Lines Matching refs:hash
7 //! This property makes hash algorithms like these excellent for uses such as verifying the
8 //! contents of a file- if you know the hash you expect beforehand, then you can verify that the
24 //! let hash = hasher.finish();
25 //! println!("Hashed \"Hello, world\" to {}", hex::encode(hash));
28 //! On the other hand, if you already have access to all of the data you would like to hash, you
29 //! may prefer to use the slightly simpler method of simply calling the hash function corresponding
35 //! let hash = sha256(b"your data or message");
36 //! println!("Hash = {}", hex::encode(hash));
43 /// Computes the SHA1 hash of some data.
53 let mut hash = MaybeUninit::<[u8; 20]>::uninit();
54 ffi::SHA1(data.as_ptr(), data.len(), hash.as_mut_ptr() as *mut _);
55 hash.assume_init()
59 /// Computes the SHA224 hash of some data.
64 let mut hash = MaybeUninit::<[u8; 28]>::uninit();
65 ffi::SHA224(data.as_ptr(), data.len(), hash.as_mut_ptr() as *mut _);
66 hash.assume_init()
70 /// Computes the SHA256 hash of some data.
75 let mut hash = MaybeUninit::<[u8; 32]>::uninit();
76 ffi::SHA256(data.as_ptr(), data.len(), hash.as_mut_ptr() as *mut _);
77 hash.assume_init()
81 /// Computes the SHA384 hash of some data.
86 let mut hash = MaybeUninit::<[u8; 48]>::uninit();
87 ffi::SHA384(data.as_ptr(), data.len(), hash.as_mut_ptr() as *mut _);
88 hash.assume_init()
92 /// Computes the SHA512 hash of some data.
97 let mut hash = MaybeUninit::<[u8; 64]>::uninit();
98 ffi::SHA512(data.as_ptr(), data.len(), hash.as_mut_ptr() as *mut _);
99 hash.assume_init()
105 /// An object which calculates a SHA1 hash of some data.
144 /// Returns the hash of the data.
149 let mut hash = MaybeUninit::<[u8; 20]>::uninit();
150 ffi::SHA1_Final(hash.as_mut_ptr() as *mut _, &mut self.0);
151 hash.assume_init()
156 /// An object which calculates a SHA224 hash of some data.
190 /// Returns the hash of the data.
195 let mut hash = MaybeUninit::<[u8; 28]>::uninit();
196 ffi::SHA224_Final(hash.as_mut_ptr() as *mut _, &mut self.0);
197 hash.assume_init()
202 /// An object which calculates a SHA256 hash of some data.
236 /// Returns the hash of the data.
241 let mut hash = MaybeUninit::<[u8; 32]>::uninit();
242 ffi::SHA256_Final(hash.as_mut_ptr() as *mut _, &mut self.0);
243 hash.assume_init()
248 /// An object which calculates a SHA384 hash of some data.
282 /// Returns the hash of the data.
287 let mut hash = MaybeUninit::<[u8; 48]>::uninit();
288 ffi::SHA384_Final(hash.as_mut_ptr() as *mut _, &mut self.0);
289 hash.assume_init()
294 /// An object which calculates a SHA512 hash of some data.
328 /// Returns the hash of the data.
333 let mut hash= MaybeUninit::<[u8; 64]>::uninit();
334 ffi::SHA512_Final(hash.as_mut_ptr() as *mut _, &mut self.0);
335 hash.assume_init()