Encrypt to Uncrypt

Encrypt + Encrypt = plaintext

AES mode OFB is a fully symmetric cipher as the encryption algorithm can be used to uncrypt datas.

How it works ?

Remember, ciphertext = plaintext ⊕ encrypt(iv) so, what if the user want encrypt again the ciphertext ?

ciphertext = plaintext ⊕ encrypt(iv)

# if the user want encrypt again ciphertext then :
ciphertext2 = ciphertext ⊕ encrypt(iv)
ciphertext2 = plaintext ⊕ encrypt(iv) ⊕ encrypt(iv)

However, as explain here, the opposite of xor is xor itself, so encrypt(iv) ⊕ encrypt(iv) = 0 and x ⊕ 0 = x so :

ciphertext2 = plaintext ⊕ encrypt(iv) ⊕ encrypt(iv)
ciphertext2 = plaintext ⊕ 0
ciphertext2 = plaintext

That's why, using OFB mode, if the user will have access to the encrypt function without the uncrypt one, he must do not know the IV.

Last updated