Calculating ciphertext sizes

Aaron Toponce aaron.toponce at
Mon Jul 11 22:31:34 CEST 2011

On Mon, Jul 11, 2011 at 01:26:07PM -0700, Robert J. Hansen wrote:
> 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.

How can I get a breakdown of this with the various ciphers? Is it listed
somewhere, or just read the source code?

> 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.

Of course. I was looking more for a resource that might be able to explain
it to me better.

The reason for asking (which actually isn't realted to GnuPG) was I wanted
to know the amount of data transferred over the wire with SCP. Knowing that
SCP and GPG use similar algs, I thought I would ask here (there are other
applications where GnuPG fits). From my limited testing, trying each of the
various ciphers, I found that at most, 1.2x the amount of data was
transferred, which surprised me, really.

So, I figured this might get a good discussion going, and I can certainly
learn more about encryption in the meantime.

. o .   o . o   . . o   o . .   . o .
. . o   . o o   o . o   . o o   . . o
o o o   . o .   . o o   o o .   o o o
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 527 bytes
Desc: Digital signature
URL: </pipermail/attachments/20110711/bbfca880/attachment.pgp>

More information about the Gnupg-users mailing list