pub struct Sm3Context(/* private fields */);Expand description
A SM3 context.
Implementations§
Source§impl Sm3Context
impl Sm3Context
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new context.
The context represents the in-progress processing of a single message.
Feed message bytes to Self::update, then finalize the process using
Self::finalize.
Any number of contexts can be created, to hash any number of messages concurrently.
§Panics
Panics if SM3 is disabled by eFuse.
Sourcepub fn finalize<'t>(&'t mut self, result: &mut [u8; 32]) -> ShaHandle<'t>
pub fn finalize<'t>(&'t mut self, result: &mut [u8; 32]) -> ShaHandle<'t>
Finishes the hashing process, writes the final hash to result.
Resets the context to an empty state.
Sourcepub fn finalize_into_slice<'t>(
&'t mut self,
result: &mut [u8],
) -> Result<ShaHandle<'t>, FinalizeError>
pub fn finalize_into_slice<'t>( &'t mut self, result: &mut [u8], ) -> Result<ShaHandle<'t>, FinalizeError>
Finishes the hashing process, writes the final hash to result.
Resets the context to an empty state.
Returns FinalizeError::BufferTooSmall if result is not large enough to hold
the final hash.
Trait Implementations§
Source§impl BlockSizeUser for Sm3Context
Available on crate feature unstable only.
impl BlockSizeUser for Sm3Context
Available on crate feature
unstable only.Source§impl BlockSizeUser for Sm3Context
Available on crate feature unstable only.
impl BlockSizeUser for Sm3Context
Available on crate feature
unstable only.Source§impl Clone for Sm3Context
Available on crate feature unstable only.
impl Clone for Sm3Context
Available on crate feature
unstable only.Source§impl Default for Sm3Context
Available on crate feature unstable only.
impl Default for Sm3Context
Available on crate feature
unstable only.Source§impl FixedOutput for Sm3Context
Available on crate feature unstable only.
impl FixedOutput for Sm3Context
Available on crate feature
unstable only.Source§fn finalize_into(self, out: &mut Output<Self>)
fn finalize_into(self, out: &mut Output<Self>)
Consume value and write result into provided array.
Source§fn finalize_fixed(self) -> GenericArray<u8, Self::OutputSize>
fn finalize_fixed(self) -> GenericArray<u8, Self::OutputSize>
Retrieve result and consume the hasher instance.
Source§impl FixedOutput for Sm3Context
Available on crate feature unstable only.
impl FixedOutput for Sm3Context
Available on crate feature
unstable only.Source§fn finalize_into(self, out: &mut Output<Self>)
fn finalize_into(self, out: &mut Output<Self>)
Consume value and write result into provided array.
Source§fn finalize_fixed(self) -> Array<u8, Self::OutputSize>
fn finalize_fixed(self) -> Array<u8, Self::OutputSize>
Retrieve result and consume the hasher instance.
impl HashMarker for Sm3Context
Available on crate feature
unstable only.impl HashMarker for Sm3Context
Available on crate feature
unstable only.Source§impl OutputSizeUser for Sm3Context
Available on crate feature unstable only.
impl OutputSizeUser for Sm3Context
Available on crate feature
unstable only.Source§impl OutputSizeUser for Sm3Context
Available on crate feature unstable only.
impl OutputSizeUser for Sm3Context
Available on crate feature
unstable only.Source§impl Update for Sm3Context
Available on crate feature unstable only.
impl Update for Sm3Context
Available on crate feature
unstable only.Auto Trait Implementations§
impl !Send for Sm3Context
impl !Sync for Sm3Context
impl Freeze for Sm3Context
impl RefUnwindSafe for Sm3Context
impl Unpin for Sm3Context
impl UnsafeUnpin for Sm3Context
impl UnwindSafe for Sm3Context
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<D> Digest for D
impl<D> Digest for D
Source§fn new_with_prefix(data: impl AsRef<[u8]>) -> Dwhere
D: Sized + Default,
fn new_with_prefix(data: impl AsRef<[u8]>) -> Dwhere
D: Sized + Default,
Create new hasher instance which has processed the provided data.
Source§fn chain_update(self, data: impl AsRef<[u8]>) -> D
fn chain_update(self, data: impl AsRef<[u8]>) -> D
Process input data in a chained manner.
Source§fn finalize(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
fn finalize(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
Retrieve result and consume hasher instance.
Source§fn finalize_into(
self,
out: &mut GenericArray<u8, <D as OutputSizeUser>::OutputSize>,
)
fn finalize_into( self, out: &mut GenericArray<u8, <D as OutputSizeUser>::OutputSize>, )
Write result into provided array and consume the hasher instance.
Source§fn finalize_reset(
&mut self,
) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>where
D: FixedOutputReset,
fn finalize_reset(
&mut self,
) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>where
D: FixedOutputReset,
Retrieve result and reset hasher instance.
Source§fn finalize_into_reset(
&mut self,
out: &mut GenericArray<u8, <D as OutputSizeUser>::OutputSize>,
)where
D: FixedOutputReset,
fn finalize_into_reset(
&mut self,
out: &mut GenericArray<u8, <D as OutputSizeUser>::OutputSize>,
)where
D: FixedOutputReset,
Write result into provided array and reset the hasher instance.
Source§fn output_size() -> usize
fn output_size() -> usize
Get output size of the hasher
Source§fn digest(
data: impl AsRef<[u8]>,
) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
fn digest( data: impl AsRef<[u8]>, ) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
Compute hash of
data.Source§impl<D> Digest for D
impl<D> Digest for D
Source§fn new_with_prefix(data: impl AsRef<[u8]>) -> Dwhere
D: Sized + Default,
fn new_with_prefix(data: impl AsRef<[u8]>) -> Dwhere
D: Sized + Default,
Create new hasher instance which has processed the provided data.
Source§fn chain_update(self, data: impl AsRef<[u8]>) -> D
fn chain_update(self, data: impl AsRef<[u8]>) -> D
Process input data in a chained manner.
Source§fn finalize(self) -> Array<u8, <D as OutputSizeUser>::OutputSize>
fn finalize(self) -> Array<u8, <D as OutputSizeUser>::OutputSize>
Retrieve result and consume hasher instance.
Source§fn finalize_into(self, out: &mut Array<u8, <D as OutputSizeUser>::OutputSize>)
fn finalize_into(self, out: &mut Array<u8, <D as OutputSizeUser>::OutputSize>)
Write result into provided array and consume the hasher instance.
Source§fn finalize_reset(&mut self) -> Array<u8, <D as OutputSizeUser>::OutputSize>where
D: FixedOutputReset,
fn finalize_reset(&mut self) -> Array<u8, <D as OutputSizeUser>::OutputSize>where
D: FixedOutputReset,
Retrieve result and reset hasher instance.
Source§fn finalize_into_reset(
&mut self,
out: &mut Array<u8, <D as OutputSizeUser>::OutputSize>,
)where
D: FixedOutputReset,
fn finalize_into_reset(
&mut self,
out: &mut Array<u8, <D as OutputSizeUser>::OutputSize>,
)where
D: FixedOutputReset,
Write result into provided array and reset the hasher instance.
Source§fn output_size() -> usize
fn output_size() -> usize
Get output size of the hasher
Source§fn digest(
data: impl AsRef<[u8]>,
) -> Array<u8, <D as OutputSizeUser>::OutputSize>
fn digest( data: impl AsRef<[u8]>, ) -> Array<u8, <D as OutputSizeUser>::OutputSize>
Compute hash of
data.§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
Source§impl<T> SmallBlockSizeUser for T
impl<T> SmallBlockSizeUser for T
Source§type _BlockSize = <T as BlockSizeUser>::BlockSize
type _BlockSize = <T as BlockSizeUser>::BlockSize
Helper associated type equal to
<Self as BlockSizeUser>::BlockSize.