Calculating ciphertext sizes

Robert J. Hansen rjh at sixdemonbag.org
Mon Jul 11 22:26:07 CEST 2011


> When encrypting a plaintext source, is there a way to predict the size
of
> the ciphertext output? I'm sure this depends on the cipher used, as well
if
> compression or hashing algos are used.

The short answer is "yes," but it's hard to give a more precise answer
without knowing a lot of specifics.  For instance, assuming you're running
AES in ECB mode, your ciphertext will be of size ceil(size/16)*16.  Running
3DES in CBC mode, your ciphertext will be of size (ceil(size/8)+1)*8. 
Etc., etc.

For any given encryption algorithm and operation mode the output size is
well-defined, but it's hard to give general answers for how it's computed.





More information about the Gnupg-users mailing list