Function aes_frast::aes_core::block_dec_k192 [] [src]

pub fn block_dec_k192(input: &[u8], output: &mut [u8], keys: &[u32])

Decrypt a block with scheduled keys (from 192bit key).

[Attention!] The first and second parameters must possess 16 elements each in the slice, and the third 52.

Examples

use aes_frast::aes_core::{setkey_dec_k192, block_dec_k192};
 
let input: [u8; 16] = [
    0xDD, 0xA9, 0x7C, 0xA4, 0x86, 0x4C, 0xDF, 0xE0,
    0x6E, 0xAF, 0x70, 0xA0, 0xEC, 0x0D, 0x71, 0x91
];
let origin_key: [u8; 24] = [
    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17
];
let mut scheduled_keys: [u32; 52] = [0; 52];
let mut output: [u8; 16] = [0; 16];
 
setkey_dec_k192(&origin_key, &mut scheduled_keys);
block_dec_k192(&input, &mut output, &scheduled_keys);
 
let expected: [u8; 16] = [
    0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
    0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
];
for i in 0..16 {
    assert_eq!(output[i], expected[i]);
}