CFB (short for cipher feedback) is an
To understand this better, let’s visualise CFB in the form of a formula:
Note: In the formula above, we are assuming C0 to be the initialization vector.
Similarly, decryption using the CFB can be depicted as:
It is essential to note that the decryption algorithm is not used here.
The main advantage of the CFB mode is that, since it doesn’t use a decryption algorithm, it is generally faster than the CBC mode. CFB encryption is also non-deterministic, which means it does not reveal any patterns the plaintext may have.
The disadvantages of CFB are identical to those of the CBC mode. The encryption cannot tolerate block losses, nor can multiple blocks be encrypted in parallel. However, decryption is both loss-tolerant and can be parallelized.
The OpenSSL toolkit provides a set of simple commands to encrypt using AES modes. The template command for encrypting a 128-bit AES with CFB mode is:
openssl enc -aes-128-cfb -e -in inputfile.txt -out cipher.bin -K
00112233445566778889aabbccddeeff -iv 0102030405060708
In the command above, we will enter the name of the file we want to encrypt after the -in
flag, and the name and format of the output file after the -out
flag. The hex value of the encryption key should be provided after the -K
flag, and the hex value of the initialization vector should be provided after the -iv
flag.
Free Resources