If I understood it correctly, in CTR mode I encrypt the nonce or IV together with the counter as a block, which is then XORed with the plaintext. For the next block, I increment the counter. Is there a fixed size of the counter to be able to iterate through all blocks, or does it start again at 0 at some point?
For example, if an algorithm with a block size of 16 bytes, I could theoretically iterate over 4.3 billion blocks (68.8GiB) when my counter is 4 bytes. But what happens if my data gets even bigger? How big is the counter then, so that the IV is still preserved and in the first block not many bytes are filled with only 0?
Thanks in advance
"CTR"
mode), you use it as e.g."AES/CTR/NoPadding"
. Java 10 is already quite old, but Java 6 definitely already had it. – Maarten Bodewes Dec 12 '21 at 11:20