Function rc5_cipher::rc5::decode
source · pub fn decode<W, const T: usize>(
key: Vec<u8>,
ct: Vec<u8>
) -> Result<Vec<u8>, Error>where
W: Unsigned,
for<'a> &'a [u8]: TryInto<W::Array>,Expand description
Decrypts a ciphertext ct and returns a plaintext pt.
The ct should have length 2 * w = 2 * bytes(W)
W: is the data type. Currently supported: u8, u16, u32, u64, u128
T: is the key expansion length T = 2 * (r + 1) being r number of rounds.
T should be even.
Example:
use rc5_cipher::decode;
let key = vec![0x00, 0x01, 0x02, 0x03];
let pt = vec![0x00, 0x01];
let ct = vec![0x21, 0x2A];
let res = decode::<u8, 26>(key, ct.clone()).unwrap();
assert!(&pt[..] == &res[..]);