A Message Authentication Code (MAC) can indeed be constructed using block ciphers. A MAC is a cryptographic checksum that provides integrity and authenticity assurances on a message. It ensures that the message has not been altered and that it originates from a legitimate sender who possesses the secret key. Block ciphers, which are deterministic algorithms operating on fixed-size blocks of data with a symmetric key, can be utilized to build MACs through various constructions.
Understanding Block Ciphers
Block ciphers operate on fixed-size blocks of plaintext, typically 64 or 128 bits, and transform them into ciphertext blocks of the same size using a symmetric key. Common examples of block ciphers include the Data Encryption Standard (DES), Triple DES (3DES), and the Advanced Encryption Standard (AES). Block ciphers can be used in different modes of operation to encrypt data of arbitrary length and to achieve various cryptographic goals.
MAC Construction Using Block Ciphers
Several methods exist to build a MAC using block ciphers, each leveraging the properties of the cipher to ensure message integrity and authenticity. Notable methods include CBC-MAC, HMAC, and CMAC.
CBC-MAC (Cipher Block Chaining Message Authentication Code)
CBC-MAC is one of the simplest and most straightforward methods to construct a MAC using a block cipher. It employs the Cipher Block Chaining (CBC) mode of operation, which is commonly used for encryption. In CBC mode, each plaintext block is XORed with the previous ciphertext block before being encrypted. For MAC generation, the final ciphertext block is used as the MAC.
Construction Steps:
1. Initialization: Choose a symmetric key
and an initial vector (IV), typically set to zero.
2. Block-wise Processing: For a message
divided into blocks
:
– ![]()
– For
to
:
– ![]()
3. MAC Generation: The MAC is the final ciphertext block
.
Example:
Consider a message
divided into three blocks
. Using a block cipher
with key
:
– ![]()
– ![]()
– ![]()
– ![]()
The MAC is
.
Security Considerations:
While CBC-MAC is secure for fixed-length messages, it is vulnerable to certain attacks when used with variable-length messages. To mitigate this, variations such as Length-Prefix CBC-MAC or CMAC are used.
CMAC (Cipher-based Message Authentication Code)
CMAC is an improvement over CBC-MAC and addresses its vulnerabilities. It is standardized in NIST SP 800-38B and is secure for messages of arbitrary length.
Construction Steps:
1. Key Derivation: Derive two sub-keys
and
from the main key
using the block cipher.
2. Padding: If the message length is not a multiple of the block size, pad the final block.
3. Block-wise Processing: For a message
divided into blocks
:
– ![]()
– For
to
:
– ![]()
– For the final block
:
– If
is complete, ![]()
– If
is padded, ![]()
– ![]()
4. MAC Generation: The MAC is
.
Example:
Consider a message
divided into three blocks
. Using a block cipher
with key
:
– Derive
and
.
– ![]()
– ![]()
– ![]()
– For
:
– If complete, ![]()
– If padded, ![]()
– ![]()
The MAC is
.
HMAC (Hash-based Message Authentication Code)
Although HMAC primarily uses hash functions, it can be built using block ciphers by employing the Davies-Meyer construction, which turns a block cipher into a hash function. HMAC is widely used due to its simplicity and strong security guarantees.
Construction Steps:
1. Key Preparation: If the key
is longer than the block size, hash it to obtain a key of the appropriate length. If shorter, pad it with zeros.
2. Inner Hash: Compute the hash of the inner padded key concatenated with the message.
3. Outer Hash: Compute the hash of the outer padded key concatenated with the result of the inner hash.
4. MAC Generation: The MAC is the result of the outer hash.
Example:
Consider a message
and a key
with block size
:
– If
is longer than
,
.
– If
is shorter than
, pad
with zeros.
– Compute
.
– Compute
.
– Inner hash:
.
– Outer hash:
.
The MAC is
.
Security Analysis
The security of a MAC constructed using block ciphers depends on the strength of the underlying block cipher and the construction method. CBC-MAC, CMAC, and HMAC (with block ciphers) each offer different security properties and efficiency trade-offs.
– CBC-MAC: Secure for fixed-length messages but vulnerable to length extension attacks. Variants like Length-Prefix CBC-MAC or CMAC are recommended for variable-length messages.
– CMAC: Provides strong security guarantees for messages of arbitrary length and is resistant to various attacks.
– HMAC: Offers robust security by combining the properties of hash functions and block ciphers, making it suitable for a wide range of applications.
Practical Applications
MACs constructed using block ciphers are employed in various applications to ensure data integrity and authenticity. Examples include:
– Financial Transactions: Ensuring the integrity of transaction data in banking systems.
– Secure Communications: Authenticating messages in secure communication protocols like TLS/SSL.
– Digital Signatures: Providing an additional layer of security for digital signatures by ensuring message integrity.
In the realm of classical cryptography, block ciphers serve as versatile tools for constructing MACs, offering robust mechanisms to ensure message integrity and authenticity. By leveraging the properties of block ciphers through methods such as CBC-MAC, CMAC, and HMAC, cryptographic systems can provide strong security guarantees against tampering and forgery.
Other recent questions and answers regarding Modes of operation for block ciphers:
- What should a block cipher include according to Shannon?
- Does the security of block ciphers depend on combining confusion and diffusion operations many times?
- Does diffusion mean, that single bits of ciphertext are influenced by many bits of plaintext?
- Does the ECB mode breaks large input plaintext into subsequent blocks
- Can we use a block cipher to build a hash function or MAC?
- Can OFB mode be used as keystream generators?
- Can an encrytion be deterministic?
- What are modes of operation?
- What does the ECB mode do to simple block ciphers
- Can PSRNG be made by block ciphers?
View more questions and answers in Modes of operation for block ciphers

