I was reading how AES can be used for 64 bit data. Than i came to this answer :Is it possible to implement AES with a 64-bit I/O block size?

The answer here is given that by running AES in counter stream mode 64 bit plain text produce the 64 bit cipher text. But i can't under this point when 128 bit cipher text produced by AES block cipher is XOR with 64 bit plain text. How it produce 64 bit output?


1 Answer 1


The idea of a counter stream mode of AES is to generate an random stream of bits by chunk of 128 bits but you are not forced to use all the 128 bits of it.

To encrypt the process is the following, considering $m$ the 64 bits message :

  1. Generate $s = AES(Key, Nounce)$
  2. Notice that $s$ is 128 bits long so $s = s_1 || s_2$ where $s_1$ and $s_2$ are 64 bits long.
  3. $c = m \oplus s_1$ and drop $s_2$ (useless)

To decrypt the process is the same:

  1. Generate $s = AES(Key, Nounce) = s_1 || s_2$ where $s_1$ and $s_2$ are 64 bits long.
  2. $m = c \oplus s_1$

Even though I provided you an answer from a Crypto point of view, I consider this question as off-topic as it feels more like it requires a code answer rather than a Crypto answer (more math oriented).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.