pub struct HashContext { /* private fields */ }Expand description
Hash context for hash operations
Implementations§
Source§impl HashContext
impl HashContext
Sourcepub fn new() -> HashContext
pub fn new() -> HashContext
Create a new hash context with no provider
Sourcepub fn with_provider(provider: Box<dyn CryptoProvider>) -> HashContext
pub fn with_provider(provider: Box<dyn CryptoProvider>) -> HashContext
Create a new hash context with a provider
Sourcepub fn with_default_provider() -> HashContext
pub fn with_default_provider() -> HashContext
Create a new hash context with the default provider
Sourcepub fn set_provider(&mut self, provider: Box<dyn CryptoProvider>)
pub fn set_provider(&mut self, provider: Box<dyn CryptoProvider>)
Set the cryptographic provider
Sourcepub fn provider(&self) -> Option<&dyn CryptoProvider>
pub fn provider(&self) -> Option<&dyn CryptoProvider>
Get the current provider
Sourcepub fn hash(
&mut self,
algorithm: Algorithm,
data: &[u8],
) -> Result<Vec<u8>, Error>
pub fn hash( &mut self, algorithm: Algorithm, data: &[u8], ) -> Result<Vec<u8>, Error>
Hash data using the specified algorithm
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if the context is initialized
Trait Implementations§
Source§impl Default for HashContext
Available on crate feature alloc only.
impl Default for HashContext
Available on crate feature
alloc only.Source§fn default() -> HashContext
fn default() -> HashContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HashContext
impl !RefUnwindSafe for HashContext
impl Send for HashContext
impl Sync for HashContext
impl Unpin for HashContext
impl UnsafeUnpin for HashContext
impl !UnwindSafe for HashContext
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more