pub fn decrypt(
buf_in1: &[u8],
buf_in2: &[u8],
buf_out: &mut [u8],
) -> Result<(), Error>Expand description
Decrypts data using the one-time pad.
buf_in1 and buf_in2 must have the same size.
§Error
Will return an Error::InvalidBufferSizes if:
buf_in1andbuf_in2don’t have the same size.buf_outis smaller than thebuf_ins.
§Example
use onetime_cli::decrypt;
let in1: [u8; 10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let in2: [u8; 10] = [26, 89, 3, 93, 78, 12, 60, 23, 4, 71];
let mut data = [0u8; 10];
decrypt(&in1, &in2, &mut data)?;
// The decrypted data is stored in `data`.
assert_eq!(data, [27, 91, 0, 89, 75, 10, 59, 31, 13, 77]);