Counter (CTR)

Counter is a stream mode of operation# of #Data Encryption Standard (DES) and #Advanced Encryption Standard (AES) where each block of plaintext is XORed (\(\oplus\)) with an encrypted counter to produce a ciphertext. The counter is incremented for each successive block. Other than encrypting counter value instead of output, the #algorithm is pretty similar to Output Feedback (OFB).

Note: Notice in stream mode, plaintexts are XORed instead of encrypted as they are not the input to the cipher.

The encryption scheme looks like the following:

$$ \begin{align} C_i &= p_i \oplus o_i\\ O_i &= \text{ des}_{k1} (i) \end{align} $$

Where:

  • \(C\) is the ciphertext
  • \(p\) is the plaintext
  • \(O\) is the output
  • \(k\) is the subkey
  • \(i\) is the counter

Like Output Feedback (OFB), it is a variation of One-Time Pad# which the key and counter value should never be reused on different plaintext block. Otherwise, its security is on par to other modes of operation. CTR is a rather efficient mode of operation since it can do parallel encryptions in #hardware or #software, preprocess in advance of need, and good for high speed links with high bandwidth. Random access to encrypted data blocks is possible. Since the data blocks are rather independent of each other, it is possible to do parallel encryption no plaintexts and decryption on ciphertexts (just XOR with the corresponding encrypted counter) without worrying the order.

It is often used in general-purpose block-oriented transmission and high-speed requirements.

#cryptography #algorithm #hardware #software