RustCrypto: Retail MAC
Pure Rust implementation of the Retail Message Authentication Code, also known as ISO/IEC 9797-1 MAC algorithm 3.
WARNING! The algorithm has known weaknesses in case of variable-length messages. See the Wikipedia article for CBC-MAC for more information.
Examples
use ;
use Des;
use hex;
type RetailMacDes = ;
// test from ISO/IEC 9797-1:2011 section B.4
// K and K' are concatenated:
let key = hex!;
let mut mac = new_from_slice.unwrap;
mac.update;
let correct = hex!;
mac.verify_slice.unwrap;
let mut mac2 = new_from_slice.unwrap;
mac2.update;
let correct2 = hex!;
mac2.verify_slice.unwrap;
License
Licensed under either of:
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.