in reply to Re: Re: How to tell if something is encrypted
in thread How to tell if something is encrypted

A compression mechanism that always results in a non-uniform distribution of 0-bytes within the output isn't doing the best compression it could.

Well-compressed output, well-encrypted output, and random output should all be indistinguishable.

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re: How to tell if something is encrypted

Replies are listed 'Best First'.
Re: (tye)Re: How to tell if something is encrypted
by nardo (Friar) on Apr 18, 2001 at 22:07 UTC
    You will often need to store some uncompressed information in a compressed file. Information about the compressed data (length, flags, etc.) is usually uncompressed. Integers within the header may contain a 0x00 because of an unused high order byte, and flags often use 0 as the default value. You can usually count on a header being at the beginning of the file, so you will probably find a few 0x00's at the beginning of a compressed file, and because there may be additional headers for additional compressed blocks throughout the file, there will not be a random distribution of 0x00's throughout the file.

      "zip" files fit your description quite nicely (I can't believe that having 20 of the first 29 bytes of a file be zero makes sense when you are trying to compress things -- like I said, they aren't doing the best compression they could).

      The "gzip" files I checked had about 2 zero bytes in the first 10 bytes. This is much more reasonable in my book but also fits your description so...

      I conceed the point; you are right. (:

              - tye (but my friends call me "Tye")
        Think of zip as being taking a tar of gzipped files. Sure the compression is not as good as gzipping a tar. But you can list contents and extract any given file without having to decompress the whole thing.

        Sometimes space saved is not the only consideration when compressing things. :-)