pub struct Sha384 { /* private fields */ }Expand description
SHA-384 hash function (FIPS 180-4).
SHA-384 is identical to SHA-512 but with a distinct initialization vector and output truncated to 48 bytes (384 bits).
SHA-384 is provided only for TLS 1.3 support, users should prefer super::Sha512.
§One-shot API
ⓘ
use crypto::{Hasher, sha2::Sha384};
let hash = Sha384::hash(b"hello world");§Incremental API
ⓘ
use crypto::{Hasher, sha2::Sha384};
let mut hasher = Sha384::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 produces an 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 Sha384
impl RefUnwindSafe for Sha384
impl Send for Sha384
impl Sync for Sha384
impl Unpin for Sha384
impl UnsafeUnpin for Sha384
impl UnwindSafe for Sha384
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