February 23, 2001, 5:01 PM — One of my colleagues asked me
whether to compress a file before encrypting it or to encrypt
before compressing it when sending the file through e-mail. The
answer is neither. Compression algorithms such as the one used
in WinZIP look for repeated sequences (e.g., groups of blanks,
the sequence "the" and so on) and define a table of
abbreviations that can replace those repeated sequences by a
short code. For example, the frequently used four-byte sequence
"the " might be represented by a two-byte code of, say, "/5."
(I'm just making up the code as an illustration.) You may have
noticed that picture files (JPG, GIF and so on) often have very-
high compression ratios; the repeated sequences of similarly
colored pixels allows a high efficiency in substituting short
codes for long repeated sequences. In contrast, it usually is
not possible to compress an encrypted file. A good encryption
algorithm will produce few repeated sequences that compression
algorithms can use. An exception, in