Function encrypt_default

Source
pub fn encrypt_default(
    key: [u8; 16],
    plaintext: &[u8],
) -> Result<Vec<u8>, Error>
Expand description

Given a key and plaintext, return the ciphertext using RC5/32/12/16.

This is the default RC5 implementation, which uses 32-bit words and 12 rounds and a key size of 16 bytes.

Usage example:

use rc5_rs::encrypt_default;
let key = [
  0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00, 0x95, 0x2C, 0x49, 0x10,
  0x48, 0x81, 0xFF, 0x48,
];

let pt = vec![0xEA, 0x02, 0x47, 0x14, 0xAD, 0x5C, 0x4D, 0x84];
let ct = vec![0x11, 0xE4, 0x3B, 0x86, 0xD2, 0x31, 0xEA, 0x64];
let res = encrypt_default(key, &pt).unwrap();
assert_eq!(ct, res);