pub struct Digest { /* private fields */ }
Expand description
A type to represent the Digest
that SHA3-256 returns.
Errors:
An error will be returned if:
slice
is not 32 bytes.
Implementations§
source§impl Digest
impl Digest
sourcepub fn from_slice(slice: &[u8]) -> Result<Digest, UnknownCryptoError>
pub fn from_slice(slice: &[u8]) -> Result<Digest, UnknownCryptoError>
Construct from a given byte slice.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Digest
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for Digest
Available on crate feature
serde
only.This type tries to deserialize as a Vec<u8>
would. If it succeeds, the digest
will be built using Self::from_slice
.
Note that this allocates once to store the referenced bytes on the heap.
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<&[u8]> for Digest
impl PartialEq<&[u8]> for Digest
source§impl PartialEq<Digest> for Digest
impl PartialEq<Digest> for Digest
source§impl Serialize for Digest
Available on crate feature serde
only.
impl Serialize for Digest
Available on crate feature
serde
only.This type tries to serialize as a &[u8]
would. Note that the serialized
type likely does not have the same protections that Orion provides, such
as constant-time operations. A good rule of thumb is to only serialize
these types for storage. Don’t operate on the serialized types.
impl Copy for Digest
impl Eq for Digest
Auto Trait Implementations§
impl RefUnwindSafe for Digest
impl Send for Digest
impl Sync for Digest
impl Unpin for Digest
impl UnwindSafe for Digest
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