5 Hash Functions, Message Authentication Codes, and Digital Signature

This chapter introduces three aspects of cryptography, namely hash functions, Message Authentication Codes, and Digital signature. All of them are of paramount importance for providing integrity and authentication guarantees. Hash functions produce digital fingerprints, also called Message Authentication Codes (MAC), which are used to meet multiple needs:

  • Verifying integrity of messages and files: a hash works like a fingerprint, which uniquely represents data. Thus, any change in an email, a file, a software, an image, and so on, results in a hash, which does not match the hash generated by the sender.
  • Generating and verifying digital signatures,1 which enable to verify the authenticity of a message. If the encrypted hash is altered, the verification fails and if the message is altered, the hash computed by the recipient does not match the message. In both cases, the message is rejected.
  • Facilitating secure password storage and verification: instead of storing and exchanging passwords, hashes of passwords are stored and used to control local and remote logins.
  • Since hashes look like random values, hash functions may be used as pseudorandom bit generators.

It is worth noticing that MAC algorithms provide stronger assurance of data integrity than a checksum or an error detecting code. The verification of a checksum or an error detecting code is designed to detect only accidental modifications of data, while ...

Get Cryptography 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.