pub struct StreamPoly1305 { /* private fields */ }Available on crate feature
allow-non-fips only.Expand description
Represents an ongoing streaming MAC computation, allowing incremental updates.
§Example
use wolf_crypto::{mac::{Poly1305, poly1305::Key}, aead::Tag};
let key: Key = [42u8; 32].into();
let tag = Poly1305::new(key.as_ref())
.update(b"chunk1")?
.update(b"chunk2")?
.update(b"chunk3")?
.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.
§Errors
The length of the input was greater than u32::MAX.
§Example
use wolf_crypto::{mac::{Poly1305, poly1305::Key}, aead::Tag};
let key: Key = [42u8; 32].into();
let tag = Poly1305::new(key.as_ref())
.update(b"chunk1")?
.update(b"chunk2")?
.update(b"chunk3")?
.finalize();Sourcepub fn finalize(self) -> Tag
pub fn finalize(self) -> Tag
Finalizes the streaming MAC computation and returns the resulting Tag.
§Returns
The associated authentication Tag.
§Example
use wolf_crypto::{mac::{Poly1305, poly1305::Key}, aead::Tag};
let key: Key = [42u8; 32].into();
let tag = Poly1305::new(key.as_ref())
.update(b"chunk1")?
.update(b"chunk2")?
.update(b"chunk3")?
.finalize();Sourcepub fn finalize_no_padding(self) -> Tag
pub fn finalize_no_padding(self) -> Tag
Finalizes the constant-time streaming MAC computation and returns the resulting Tag.
§Note
It is far more common in practice to use to pad the finalize method. This is only here
for XSalsa20Poly1305.
§Returns
The associated authentication Tag representing all updates and the total length of the
updates.
§Example
use wolf_crypto::{mac::{Poly1305, poly1305::Key}, aead::Tag};
let key: Key = [42u8; 32].into();
let tag = Poly1305::new(key.as_ref())
.update(b"chunk1").unwrap()
.update(b"chunk2").unwrap()
.finalize_no_padding();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