logo
Expand description

Cipher Block Chaining Message Authentication Code (CBC-MAC) implemented in pure Rust and generic over block cipher.

WARNING! The algorithm has known weaknesses in case of variable-length messages. See the linked Wikipedia article for more information.

Examples

use cbc_mac::{CbcMac, Mac};
use des::Des;
use hex_literal::hex;

// CBC-MAC with the DES block cipher is equivalent to DAA
type Daa = CbcMac<Des>;

// test from FIPS 113
let key = hex!("0123456789ABCDEF");
let mut mac = Daa::new_from_slice(&key).unwrap();
mac.update(b"7654321 Now is the time for ");
let correct = hex!("F1D30F6849312CA4");
mac.verify_slice(&correct).unwrap();

Re-exports

pub use digest;

Structs

Generic core CMAC instance, which operates over blocks.

Traits

Convinience wrapper trait covering functionality of Message Authentication algorithms.

Type Definitions

Generic CMAC instance.