pub struct Context {
pub(crate) algorithm: &'static Algorithm,
digest_ctx: DigestContext,
msg_len: u64,
max_input_reached: bool,
}
Expand description
A context for multi-step (Init-Update-Finish) digest calculations.
Fields§
§algorithm: &'static Algorithm
The context’s algorithm.
digest_ctx: DigestContext
§msg_len: u64
§max_input_reached: bool
Implementations§
Source§impl Context
impl Context
Sourcepub fn new(algorithm: &'static Algorithm) -> Self
pub fn new(algorithm: &'static Algorithm) -> Self
Constructs a new context.
§Panics
new
panics if it fails to initialize an aws-lc digest context for the given
algorithm.
Sourcepub fn update(&mut self, data: &[u8])
pub fn update(&mut self, data: &[u8])
Updates the message to digest with all the data in data
.
§Panics
Panics if update causes total input length to exceed maximum allowed (u64::MAX
).
fn try_update(&mut self, data: &[u8]) -> Result<(), Unspecified>
Sourcepub fn finish(self) -> Digest
pub fn finish(self) -> Digest
Finalizes the digest calculation and returns the digest value.
finish
consumes the context so it cannot be (mis-)used after finish
has been called.
§Panics
Panics if the digest is unable to be finalized
fn try_finish(self) -> Result<Digest, Unspecified>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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