Struct sarkara::aead::Ascon [] [src]

pub struct Ascon { /* fields omitted */ }

Ascon.

Example(encrypt/decrypt)

use rand::{ Rng, thread_rng };
use sarkara::aead::{ Ascon, AeadCipher };

let mut rng = thread_rng();
let mut pass = vec![0; Ascon::key_length()];
let mut nonce = vec![0; Ascon::nonce_length()];
let mut data = vec![0; 1024];
rng.fill_bytes(&mut pass);
rng.fill_bytes(&mut nonce);
rng.fill_bytes(&mut data);

let ciphertext = Ascon::new(&pass)
    .with_aad(&nonce)
    .encrypt(&nonce, &data);
let plaintext = Ascon::new(&pass)
    .with_aad(&nonce)
    .decrypt(&nonce, &ciphertext)
    .unwrap();
assert_eq!(plaintext, data);

Trait Implementations

impl Debug for Ascon
[src]

Formats the value using the given formatter.

impl Clone for Ascon
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl AeadCipher for Ascon
[src]

Create a new AeadCipher.

Key length.

Tag length.

Nonce length.

Set associated data.

Encryption.

Decryption Read more