[−][src]Struct strobe_rs::Strobe
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
- Whether or not you want to add more input to the previous operation. For example:
s.ad(b"hello world", false);
is equivalent to
s.ad(b"hello ", false); s.ad(b"world", true);
Some methods take a usize
argument instead of bytes. These functions are individually
commented below.
Fields
sec: SecParam
Security parameter (128 or 256)
rate: usize
This is the R
parameter in the Strobe spec
Implementations
impl Strobe
[src]
pub fn new(proto: &[u8], sec: SecParam) -> Strobe
[src]
Makes a new Strobe
object with a given protocol byte string and security parameter.
pub fn version_str(&self) -> String
[src]
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.
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]
&mut self,
data: &mut [u8],
more: bool
) -> Result<(), AuthError>
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.
Trait Implementations
impl Clone for Strobe
[src]
fn clone(&self) -> Strobe
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,