gnupg doesn't compress files starting with 4 bytes 0

Max max at tellus.dyndns.org
Sun Sep 15 18:57:01 CEST 2002


Hello,

Is this a known bug, am I doing something wrong, or maybe it's even a
feature that I don't understand?

When encrypting a file that starts with 4 binary 0 bytes then gnupg does
not automatically compress it (you'd have to explicitely specify -z6,
which normally is the default).
Anything else gets compressed fine. Please have a look at the examples
below...

I'm using GnuPG v1.0.7 on a 32bit x86 Linux system.


Example #1. File looks like: <3 times 0><1001 times 1>
            GnuPG DOES compress this file (as it should be!).

max at scotty:/tmp$ perl -e 'print "\0"x3' > file
max at scotty:/tmp$ perl -e 'print "\1"x1001' >> file
max at scotty:/tmp$ gpg -r markus --encrypt file
max at scotty:/tmp$ gpg --list-packets file.gpg 
:pubkey enc packet: version 3, algo 1, keyid 661C7ADBE6401E5B
        data: [4095 bits]

You need a passphrase to unlock the secret key for
user: "Markus Stoeger <markus_stoeger at gmx.at>"
4096-bit RSA key, ID E6401E5B, created 2002-05-01 (main key ID 5514D918)

:encrypted data packet:
        length: 67
                ^^-- looks compressed!
        mdc_method: 2
gpg: encrypted with 4096-bit RSA key, ID E6401E5B, created 2002-05-01
      "Markus Stoeger <markus_stoeger at gmx.at>"
:compressed packet: algo=2
^^^^^^^^^^^^^^^^^^^^^^^^^^-- all ok!
:literal data packet:
        mode b, created 1032104276, name="file",
        raw data: 1004 bytes



Example #2. File looks like: <4 times 0><1000 times 1>
            GnuPG does NOT compress this file.

max at scotty:/tmp$ perl -e 'print "\0"x4' > file
max at scotty:/tmp$ perl -e 'print "\1"x1000' >> file
max at scotty:/tmp$ gpg -r markus --encrypt file
max at scotty:/tmp$ gpg --list-packets file.gpg 
:pubkey enc packet: version 3, algo 1, keyid 661C7ADBE6401E5B
        data: [4096 bits]

You need a passphrase to unlock the secret key for
user: "Markus Stoeger <markus_stoeger at gmx.at>"
4096-bit RSA key, ID E6401E5B, created 2002-05-01 (main key ID 5514D918)

:encrypted data packet:
        length: 1027
                ^^^^-- no compression here...
        mdc_method: 2
gpg: encrypted with 4096-bit RSA key, ID E6401E5B, created 2002-05-01
      "Markus Stoeger <markus_stoeger at gmx.at>"
??????????????????????????-- no compression here...
:literal data packet:
        mode b, created 1032104224, name="file",
        raw data: 1004 bytes
:mdc packet: length=20






More information about the Gnupg-devel mailing list