Struct bacteria::Strobe128[][src]

pub struct Strobe128 { /* fields omitted */ }
Expand description

A Strobe context for the 128-bit security level.

Implementations

impl Strobe128[src]

pub fn new(protocol_label: &[u8]) -> Strobe128[src]

Makes a new Strobe object with a given protocol byte string and with security parameter 128bit.

pub fn set_as_receiver(&mut self)[src]

pub fn set_as_sender(&mut self)[src]

pub fn recv_mac(&mut self, data: &mut [u8], more: bool) -> Result<(), AuthError>[src]

Attempts to authenticate the current state against the given MAC. On failure, it returns an AuthError. It behooves the user of this library to check this return value and overreact on error.

pub fn meta_recv_mac(
    &mut self,
    data: &mut [u8],
    more: bool
) -> Result<(), AuthError>
[src]

Attempts to authenticate the current state against the given MAC. On failure, it returns an AuthError. It behooves the user of this library to check this return value and overreact on error.

pub fn ratchet(&mut self, num_bytes_to_zero: usize, more: bool)[src]

Ratchets the internal state forward in an irreversible way by zeroing bytes.

Takes a usize argument specifying the number of bytes of public state to zero. If the size exceeds self.rate, Keccak-f will be called before more bytes are zeroed.

pub fn meta_ratchet(&mut self, num_bytes_to_zero: usize, more: bool)[src]

Ratchets the internal state forward in an irreversible way by zeroing bytes.

Takes a usize argument specifying the number of bytes of public state to zero. If the size exceeds self.rate, Keccak-f will be called before more bytes are zeroed.

pub fn send_enc(&mut self, data: &mut [u8], more: bool)[src]

Sends an encrypted message.

pub fn meta_send_enc(&mut self, data: &mut [u8], more: bool)[src]

Sends an encrypted message.

pub fn recv_enc(&mut self, data: &mut [u8], more: bool)[src]

Receives an encrypted message.

pub fn meta_recv_enc(&mut self, data: &mut [u8], more: bool)[src]

Receives an encrypted message.

pub fn send_mac(&mut self, data: &mut [u8], more: bool)[src]

Sends a MAC of the internal state. The output is independent of the initial contents of the input buffer.

pub fn meta_send_mac(&mut self, data: &mut [u8], more: bool)[src]

Sends a MAC of the internal state. The output is independent of the initial contents of the input buffer.

pub fn prf(&mut self, data: &mut [u8], more: bool)[src]

Extracts pseudorandom data as a function of the internal state. The output is independent of the initial contents of the input buffer.

pub fn meta_prf(&mut self, data: &mut [u8], more: bool)[src]

Extracts pseudorandom data as a function of the internal state. The output is independent of the initial contents of the input buffer.

pub fn send_clr(&mut self, data: &[u8], more: bool)[src]

Sends a plaintext message.

pub fn meta_send_clr(&mut self, data: &[u8], more: bool)[src]

Sends a plaintext message.

pub fn recv_clr(&mut self, data: &[u8], more: bool)[src]

Receives a plaintext message.

pub fn meta_recv_clr(&mut self, data: &[u8], more: bool)[src]

Receives a plaintext message.

pub fn ad(&mut self, data: &[u8], more: bool)[src]

Mixes associated data into the internal state.

pub fn meta_ad(&mut self, data: &[u8], more: bool)[src]

Mixes associated data into the internal state.

pub fn key(&mut self, data: &[u8], more: bool)[src]

Sets a symmetric cipher key.

pub fn meta_key(&mut self, data: &[u8], more: bool)[src]

Sets a symmetric cipher key.

pub fn send_aead(&mut self, plaintext: &[u8], ad: &[u8]) -> Vec<u8>[src]

encrypt data and authenticate additional data

pub fn recv_aead(
    &mut self,
    ciphertext: &[u8],
    ad: &[u8]
) -> Result<Vec<u8>, AuthError>
[src]

decrypt data and authenticate additional data

Trait Implementations

impl Clone for Strobe128[src]

fn clone(&self) -> Strobe128[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Strobe128[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Drop for Strobe128[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl Zeroize for Strobe128[src]

fn zeroize(&mut self)[src]

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 

pub fn cast(self) -> U

Numeric cast from self to T.

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> FromBits<T> for T

pub fn from_bits(t: T) -> T

Safe lossless bitwise transmute from T to Self.

impl<T> FromCast<T> for T

pub fn from_cast(t: T) -> T

Numeric cast from T to Self.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

pub fn into_bits(self) -> U

Safe lossless bitwise transmute from self to T.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.