pub struct Sha512 { /* private fields */ }Expand description
SHA-512 hash function (RFC 6234 / FIPS 180-4).
Implements the Hasher trait.
§One-shot API
ⓘ
use crypto::{Hasher, sha2::Sha512};
let hash = Sha512::hash(b"hello world");§Incremental API
ⓘ
use crypto::{Hasher, sha2::Sha512};
let mut hasher = Sha512::new();
hasher.update(b"hello ");
hasher.update(b"world");
let hash = hasher.sum();§Message length limit
FIPS 180-4 permits messages with ℓ < 2^128 bits, i.e. up to 2^125 - 1
bytes. The length is counted by a 128-bit byte counter and encoded in the
128-bit field mandated by the spec, so a message of 2^125 bytes or more
produces undefined result. Such lengths are unreachable in practice; they
are neither rejected nor signalled, so no panic or error is returned for
them.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sha512
impl RefUnwindSafe for Sha512
impl Send for Sha512
impl Sync for Sha512
impl Unpin for Sha512
impl UnsafeUnpin for Sha512
impl UnwindSafe for Sha512
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more