{"id":59735,"library":"cmac","title":"cmac","description":"Generic implementation of Cipher-based Message Authentication Code","status":"active","version":"0.8.0","language":"rust","source_language":null,"source_url":"https://github.com/RustCrypto/MACs","tags":["crypto","mac","authentication","aes","cmac"],"install":[{"cmd":"# Cargo.toml\n[dependencies]\ncmac = \"0.8.0\"","lang":"toml","label":"Cargo.toml"},{"cmd":"cargo add cmac","lang":"bash","label":"cargo add"}],"dependencies":[],"imports":[{"symbol":"Cmac","correct":"use cmac::Cmac;"}],"quickstart":{"code":"use cmac::{Cmac, Mac};\nuse aes::Aes128;\n\nfn main() {\n    let key = aes::Aes128::new_from_slice(&[0u8; 16]).unwrap();\n    let mut mac = Cmac::<Aes128>::new(&key);\n    mac.update(b\"data\");\n    let result = mac.finalize();\n    println!(\"{:x}\", result.into_bytes());\n}","lang":"rust","description":"Compute CMAC with AES-128"},"warnings":[{"fix":"Add `aes` to dependencies and import the cipher type.","message":"Requires a block cipher implementation (e.g., `aes` crate) as a type parameter.","severity":"gotcha","affected_versions":">=0.8.0"}],"env_vars":null,"search_vec":"'ae':14 'authent':9,13 'base':7 'cipher':6 'cipher-bas':5 'cmac':1,15 'code':10 'crypto':11 'generic':2 'implement':3 'mac':12 'messag':8","created_at":"2026-06-16T17:15:01.617361+00:00","updated_at":"2026-06-16T17:15:01.617361+00:00","problems":[],"ecosystem":"crates","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/RustCrypto/MACs","github":"https://github.com/RustCrypto/MACs","docs":"https://docs.rs/cmac/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["crypto"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-16","next_check":"2026-12-13","install_tag":null}}