S.W. Bowen
1 min readJul 10, 2022

--

Padding can be a simple, though not perfect, way to bolster the integrity of an encrypted message. For example, if an attacker can surmise that a message is of the form "Meet me at 6:00" , they could alter it by changing the bits corresponding to the time (e.g. "Meet me at 9:00") without ever actually decrypting the message. If we use a padding scheme like doubling every bit in the message and adding extra bits to the beginning and end of the message, we can protect against single-bit flips/errors and make it more difficult for the adversary to guess which bits to change.

The math behind altering the message is as follows. If the ciphertext E(m) of a one-time pad is produced by taking the "exclusive or" (⊕) of the plaintext m with the key k (i.e. E(m)=m⊕k), an adversary can change the encrypted message to m⊕a for any a since E(m)⊕a=m⊕a⊕k=E(m⊕a).

Obviously a MAC would be preferable, since it could tell us if any alteration was made to the message in addition to verifying that it came from the correct source. But given that data integrity is usually taken as part of the definition of message authentication, and since padding can improve data integrity, I think it is accurate to say that padding can assist in message authentication.

--

--

S.W. Bowen
S.W. Bowen

Written by S.W. Bowen

graph theory, topology, theoretical computer science, and plenty more

Responses (1)