pub struct Sha3_384 { /* private fields */ }
Expand description

SHA3-384 streaming state.

Implementations§

source§

impl Sha3_384

source

pub fn new() -> Self

Initialize a Sha3_384 struct.

source

pub fn reset(&mut self)

Reset to new() state.

source

pub fn update(&mut self, data: &[u8]) -> Result<(), UnknownCryptoError>

Update state with data. This can be called multiple times.

source

pub fn finalize(&mut self) -> Result<Digest, UnknownCryptoError>

Return a SHA3-384 digest.

source

pub fn digest(data: &[u8]) -> Result<Digest, UnknownCryptoError>

Calculate a SHA3-384 digest of some data.

Trait Implementations§

source§

impl Clone for Sha3_384

source§

fn clone(&self) -> Sha3_384

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Sha3_384

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Sha3_384

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Write for Sha3_384

Available on crate feature safe_api only.

Example: hashing from a Reader with SHA3-384.

use orion::{
    hazardous::hash::sha3::sha3_384::{Sha3_384, 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 = Sha3_384::new();
std::io::copy(&mut reader, &mut hasher)?;

let digest: Digest = hasher.finalize()?;
source§

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 Sha3_384::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>

This type doesn’t buffer writes, so flushing is a no-op.

1.36.0 · source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · source§

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>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.