# ๐Output Feedback (OFB)

- tag: ยง Cryptography

OFB is a block cipher mode of operation which makes a block cipher into a synchronous stream cipher. OFB does not require padding.

Encryption algorithm:

Decryption algorithm:

- Because of symmetry of Xor, the decryption algorithm is exactly the same as encryption.
- Encrypt IV and use that as IV for the next block.
- Xor encrypted IV with the block of ciphertext.

- The stream of encrypted IVs (keystream) can be computed beforehand and applied in parallel.
- The keystream can be obtained by using CBC with a constant stream of zeros as input. That is useful as it allows using hardware acceleration.
- Using OFB mode with partial blocks as feedback reduces the average cycle length by factor of $2^{32}$ or more. For this reason, support for truncated feedback was removed from the specification of OFB.