Struct strobe_rs::Strobe[][src]

pub struct Strobe {
    pub sec: SecParam,
    pub rate: usize,
    // some fields omitted
}

The main Strobe object. This is currently limited to using Keccak-f[1600] as the internal permutation function. For more information on this object, the protocol specification is a great resource.

Description of method input

Most operations exposed by Strobe take the same set of inputs. Some inputs are not meaningful in some contexts. Again, see the specification for more info. The arguments are

  • data - The input data to the operation.
  • metadata - An optional tuple containing meta-operation flags and metadata info. See spec for more info.
  • more - Whether or not you want to add more input to the previous operation. For example:
s.ad(b"hello world".to_vec(), None, false);

is equivalent to

s.ad(b"hello ".to_vec(), None, false);
s.ad(b"world".to_vec(), None, true);

Some methods take a usize argument instead of bytes. These functions are individually commented below.

Fields

Security parameter (128 or 256)

This is the R parameter in the Strobe spec

Methods

impl Strobe
[src]

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

Returns a string of the form Strobe-Keccak-<sec>/<b>v<ver> where sec is the bits of security (128 or 256), b is the block size (in bits) of the Keccak permutation function, and ver is the protocol version.

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.

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.

Important traits for Vec<u8>

Sends a plaintext message.

Important traits for Vec<u8>

Receives a plaintext message.

Important traits for Vec<u8>

Sends an encrypted message.

Important traits for Vec<u8>

Receives an encrypted message.

Important traits for Vec<u8>

Sends a MAC of the internal state.

Takes a usize argument instead of bytes. This specifies the number of bytes the user wants as output.

Important traits for Vec<u8>

Extracts pseudorandom data as a function of the internal state.

Takes a usize argument instead of bytes. This specifies the number of bytes the user wants as output.

Mixes associated data into the internal state.

Takes input as normal. This will return a value if and only if metadata is supplied in the input.

Sets a symmetric cipher key.

Takes input as normal. This will return a value if and only if metadata is supplied in the input.

Trait Implementations

impl Clone for Strobe
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Strobe

impl Sync for Strobe