Struct wolf_crypto::mac::poly1305::StreamPoly1305
source · pub struct StreamPoly1305 { /* private fields */ }Expand description
Represents an ongoing streaming MAC computation, allowing incremental updates.
§Example
use wolf_crypto::{mac::{Poly1305, poly1305::Key}, aead::Tag};
let key: Key = [0u8; 32].into();
let mut stream = Poly1305::new(key.as_ref())
.update(b"chunk1")?
.update(b"chunk2")?
.update(b"chunk3")?;
let tag = stream.finalize()?;Implementations§
source§impl StreamPoly1305
impl StreamPoly1305
sourcepub fn update(self, input: &[u8]) -> Result<Self, Self>
pub fn update(self, input: &[u8]) -> Result<Self, Self>
Updates the streaming MAC computation with additional input.
§Arguments
input- A byte slice representing the additional data to include.
§Returns
A Result<&mut Self, Unspecified> containing a mutable reference to StreamPoly1305 for chaining or an Unspecified error on failure.
§Example
use wolf_crypto::{mac::{Poly1305, poly1305::Key}, aead::Tag};
let key: Key = [0u8; 32].into();
let tag = Poly1305::new(key.as_ref())
.update(b"chunk1")?
.update(b"chunk2")?
.update(b"chunk3")?
.finalize()?;sourcepub fn finalize(self) -> Result<Tag, Unspecified>
pub fn finalize(self) -> Result<Tag, Unspecified>
Finalizes the streaming MAC computation and returns the resulting Tag.
§Returns
A Result<Tag, Unspecified> containing the computed Tag on success or an Unspecified error on failure.
§Example
use wolf_crypto::{mac::{Poly1305, poly1305::Key}, aead::Tag};
let key: Key = [0u8; 32].into();
let tag = Poly1305::new(key.as_ref())
.update(b"chunk1")?
.update(b"chunk2")?
.update(b"chunk3")?
.finalize()?;Trait Implementations§
source§impl Debug for StreamPoly1305
impl Debug for StreamPoly1305
source§impl From<StreamPoly1305> for Unspecified
impl From<StreamPoly1305> for Unspecified
source§fn from(value: StreamPoly1305) -> Self
fn from(value: StreamPoly1305) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StreamPoly1305
impl RefUnwindSafe for StreamPoly1305
impl Send for StreamPoly1305
impl Sync for StreamPoly1305
impl Unpin for StreamPoly1305
impl UnwindSafe for StreamPoly1305
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