Crate lea

source ·
Expand description

LEA

  • Example
use lea::{prelude::*, Lea128};

let key = arr![u8; 0x0F, 0x1E, 0x2D, 0x3C, 0x4B, 0x5A, 0x69, 0x78, 0x87, 0x96, 0xA5, 0xB4, 0xC3, 0xD2, 0xE1, 0xF0];
let ptxt = arr![u8; 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F];
let ctxt = arr![u8; 0x9F, 0xC8, 0x4E, 0x35, 0x28, 0xC6, 0xC6, 0x18, 0x55, 0x32, 0xC7, 0xA7, 0x04, 0x64, 0x8B, 0xFD];

let lea128 = Lea128::new(&key);

// Encryption
let mut block = ptxt.clone();
lea128.encrypt_block(&mut block);
assert_eq!(block, ctxt);

// Decryption
let mut block = ctxt.clone();
lea128.decrypt_block(&mut block);
assert_eq!(block, ptxt);

Re-exports

Modules

Structs

Type Definitions