Registry / crypto / cmac
library0.8.0rscratesunverified

Generic implementation of Cipher-based Message Authentication Code

# Cargo.toml [dependencies] cmac = "0.8.0"
INSTALL
IMPORT
SIG · CMAC
C
cmac
cryptorustv0.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Cmac
✓ use cmac::Cmac;

Compute CMAC with AES-128

use cmac::{Cmac, Mac}; use aes::Aes128; fn main() { let key = aes::Aes128::new_from_slice(&[0u8; 16]).unwrap(); let mut mac = Cmac::<Aes128>::new(&key); mac.update(b"data"); let result = mac.finalize(); println!("{:x}", result.into_bytes()); }
Debug
Known issues
gotchaRequires a block cipher implementation (e.g., `aes` crate) as a type parameter.
fix
Add `aes` to dependencies and import the cipher type.
affects: >=0.8.0
Upgrade
Version history
0.8.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
Amazon
1
Resources
cmac — cargo add cmac · libregistry