Retail MAC
Authenticate messages with ISO/IEC 9797-1 MAC algorithm 3.
from oxcrypto.mac.retail_mac import RETAIL_MAC
key = RETAIL_MAC.DES.generate_key()
tag = RETAIL_MAC.DES.mac(key, b"message")Retail MAC (ISO/IEC 9797-1 MAC algorithm 3, ANSI X9.19) runs CBC-MAC with the
first key and processes the final block with decryption under the second key
and encryption under the first. The key is the two cipher keys concatenated,
so RETAIL_MAC.DES takes 16 bytes. Partial blocks are zero-padded (padding
method 1).
RETAIL_MAC.DES is the classic banking construction. The retail-mac crate
is at version 0.1, so treat it as an early release. It is offered over the
same ciphers as CBC-MAC.