Index

I don’t know if the post about nonces was really clear.

To encrypt the counter, you need to put it in a buffer the size of a block. For example to encrypt the counter 1234567890, you’d have something like that (notation little-endian):

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x49 0x96 0x02 0xd2
                    ^^^^^^^^^^^^^^^^^^^ 1234567890

You encrypt that block, then you use the resulting encrypted block as initialization vector to decrypt the first block of the encrypted message.