CHAPTER 7Message Integrity

You should be comfortable at this stage with symmetric key cryptography. In this chapter, you learn to generate message authentication codes to let message recipients validate that the message they are receiving has not been tampered with while it was in transit. In the context of message integrity, a hash function is used to produce a fixed-length message digest from a variable-size message. The most common message digests range in length from 160 to 512 bits. Any alteration to the input message produces a dramatically different message digest. The message digests help detect unauthorized alterations and message forgeries. The principles you learn and develop here continue in the next chapter as you explore public-key cryptography; throughout this chapter, you gain cryptographic knowledge as you:

  • Learn about Message Authentication Codes (MACs)
  • Ensure that your signature is not compromised and does not get forged
  • Explore how to make forgeries when someone else failed to protect their signatures
  • Explore sending encrypted data over nonsecure channels

Message Authentication Codes

You were first introduced to hash functions and message authentication codes in Chapter 2. You now dive into those same concepts at a deeper level. Message Authentication Codes, also called tags, or MACs as they are more commonly known, play an essential role in ensuring messages are not tampered with while they are en route to their destination. MACs ensure message integrity ...

Get Implementing Cryptography Using Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.