Checking the file or message integrity

Checking the file or message integrity

A possible way to check is an integrity control which means that the message’s print will be computed and send with the message. However, it’s not secured because if someone intercept the message, he can change and produce another hash.

MAC (Message Authentication Code)

The best way is to use a MAC code which is a similar concept to hash functions. MAC system is composed by 2 functions :

  1. One will create the MAC code which takes as input an unencrypted message with a secret key.
  2. The other one that will check. This one takes as input the message, the secret key and the MAC code. It computes again the MAC from the message and the secret key to check if it matches with the ones sent.

The principle is easy: the expeditor computes the MAC code from creation function and the enclosed message. The addressee gets the message and the MAC code associated and thanks to the checking function, check if the message has been modified while the transmission.