pub struct Sha384 { /* private fields */ }
Expand description
SHA384 streaming state.
Implementations§
Trait Implementations§
source§impl Write for Sha384
Available on crate feature safe_api
only.
impl Write for Sha384
Available on crate feature
safe_api
only.Example: hashing from a Read
er with SHA384.
use orion::{
hazardous::hash::sha2::sha384::{Sha384, Digest},
errors::UnknownCryptoError,
};
use std::io::{self, Read, Write};
// `reader` could also be a `File::open(...)?`.
let mut reader = io::Cursor::new(b"some data");
let mut hasher = Sha384::new();
std::io::copy(&mut reader, &mut hasher)?;
let digest: Digest = hasher.finalize()?;
source§fn write(&mut self, bytes: &[u8]) -> Result<usize>
fn write(&mut self, bytes: &[u8]) -> Result<usize>
Update the hasher’s internal state with all of the bytes given.
If this function returns the Ok
variant, it’s guaranteed that it
will contain the length of the buffer passed to Write
.
Note that this function is just a small wrapper over
Sha384::update
.
Errors:
This function will only ever return the std::io::ErrorKind::Other
variant when it returns an error. Additionally, this will always contain Orion’s
UnknownCryptoError
type.
source§fn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
This type doesn’t buffer writes, so flushing is a no-op.
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for Sha384
impl Send for Sha384
impl Sync for Sha384
impl Unpin 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