Practical 8: Hash Function using CBC-MAC (Based on Block Cipher)
Understanding Message Authentication in Symmetric Cryptography
Implement CBC-MAC using AES encryption and understand how it ensures message integrity in symmetric cryptography.
Understand CBC-MAC working, observe MAC changes with message alterations, and demonstrate AES block cipher usage.
CBC-MAC (Cipher Block Chaining - Message Authentication Code) is a method of constructing a message authentication code using a block cipher like AES in CBC mode.
| Feature | Explanation |
|---|---|
| Key is required | Unlike hash functions, CBC-MAC uses a symmetric key |
| Sensitive to input | Small changes in input → completely different MAC |
| Fixed IV (zero) | CBC-MAC standard requires IV = 0 |
| Not collision-resistant | CBC-MAC is for integrity, not hashing large data |
| Used in | Secure protocols like IPsec, TLS (modified forms) |
Ensures messages are not tampered with during transmission
Verifies the authenticity of transferred financial data
Guarantees that update files are untampered
Used where symmetric cryptography is preferred due to resource constraints
The MAC for msg1 = "GECBHARUCH" and msg2 = "GECBHARUCH?" is entirely different, even though the messages are nearly identical.
After this practical, students will be able to:
Understand how a block cipher can be used to generate a MAC
Learn how padding and CBC mode work together
Use AES in CBC mode to generate a MAC for messages
Observe how small message changes affect the MAC output
In this practical, we implemented CBC-MAC using AES to authenticate messages. The output MAC depends heavily on the exact message content and length. Even a minor change in the message completely changes the MAC, making it suitable for message integrity verification in secure systems.
CBC-MAC is a powerful tool in symmetric cryptography, particularly in resource-constrained environments like IoT and embedded systems.