pub fn encrypt(
buf_in: &[u8],
buf_out1: &mut [u8],
buf_out2: &mut [u8],
) -> Result<(), Error>
Expand description
Encrypts data using the one-time pad.
§Error
Will return an Error::InvalidBufferSizes
if either
of buf_out1
or buf_out2
is smaller than buf_in
.
§Example
use onetime_cli::encrypt;
let data: [u8; 10] = [1,2,3,4,5,6,7,8,9,10];
let mut out1 = [0u8; 10];
let mut out2 = [0u8; 10];
encrypt(&data, &mut out1, &mut out2)?;
// The encrypted parts are stored in `out1` and `out2`.
println!("{:?}", out1);
println!("{:?}", out2);