pub struct Jacopone { /* private fields */ }
Expand description
enviroment for encryption and decryption
Implementations§
source§impl Jacopone
impl Jacopone
sourcepub fn new(thread_count: u8) -> Jacopone
pub fn new(thread_count: u8) -> Jacopone
create a jacopone enviroment to encrypt/decrypt using thread_count threads
use jacopone::*;
let jacopone = Jacopone::new(4);
sourcepub fn encrypt(&self, data: CipherData) -> Vec<u8>
pub fn encrypt(&self, data: CipherData) -> Vec<u8>
encrypt given CipherData
use jacopone::*;
let jacopone = Jacopone::new(4);
let message = "i'm not a safe algorithm".as_bytes().to_vec();
//I'm sorry, it has to be 60 bytes long
let nonce = vec![1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0];
let key = vec![12,45,8,43,1,2,65,9,1,4,7,9,1,9,3,5,2,4,9,4,1,2,6,9,1,3,6,9,1,9,4,6];
let counter = 42;
let data = CipherData::new(message, key, nonce, counter);
let ciphertext = jacopone.encrypt(data);