pub struct Strobe { /* private fields */ }
Expand description

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. The arguments are

  • data - The input data to the operation.
  • more - For streaming purposes. Specifies whether you’re trying to add more input / get more output to/from the previous operation. For example:
s.ad(b"hello world", false);

is equivalent to

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

NOTE: If you try to set the more flag for an operation that is not preceded by the same operation (e.g., if you try ad followed by send_enc with more=true), then the function will panic, since that is an invalid use of the more flag.

Finally, ratchet and meta_ratchet take a usize argument instead of bytes. These functions are individually commented below.

Implementations

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.

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.

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.

Sends an encrypted message.

Sends an encrypted message.

Receives an encrypted message.

Receives an encrypted message.

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

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

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

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

Sends a plaintext message.

Sends a plaintext message.

Receives a plaintext message.

Receives a plaintext message.

Mixes associated data into the internal state.

Mixes associated data into the internal state.

Sets a symmetric cipher key.

Sets a symmetric cipher key.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.