Trait snow::types::Cipher[][src]

pub trait Cipher: Send + Sync {
    fn name(&self) -> &'static str;
fn set(&mut self, key: &[u8]);
fn encrypt(
        &self,
        nonce: u64,
        authtext: &[u8],
        plaintext: &[u8],
        out: &mut [u8]
    ) -> usize;
fn decrypt(
        &self,
        nonce: u64,
        authtext: &[u8],
        ciphertext: &[u8],
        out: &mut [u8]
    ) -> Result<usize, ()>; fn rekey(&mut self) { ... } }
Expand description

Cipher operations

Required methods

fn name(&self) -> &'static str[src]

Expand description

The string that the Noise spec defines for the primitive

fn set(&mut self, key: &[u8])[src]

Expand description

Set the key

fn encrypt(
    &self,
    nonce: u64,
    authtext: &[u8],
    plaintext: &[u8],
    out: &mut [u8]
) -> usize
[src]

Expand description

Encrypt (with associated data) a given plaintext.

fn decrypt(
    &self,
    nonce: u64,
    authtext: &[u8],
    ciphertext: &[u8],
    out: &mut [u8]
) -> Result<usize, ()>
[src]

Expand description

Decrypt (with associated data) a given ciphertext.

Loading content...

Provided methods

fn rekey(&mut self)[src]

Expand description

Rekey according to Section 4.2 of the Noise Specification, with a default implementation guaranteed to be secure for all ciphers.

Loading content...

Implementors

Loading content...