cryptencryption/decryption filter |
Command |
crypt
[-det
] [key]
crypt
reads data from the standard input and writes it to
the standard output in an encrypted (coded) form. It also decrypts (decodes)
previously encrypted data.
The encryption is uniquely determined by a user-supplied key, which is an
arbitrary text string. The details of the transformation depend on the key in a
way that makes them difficult to derive from the output alone. You may supply
the key on the command line; otherwise crypt
prompts
you to enter the key. When you type in the key in response to the prompt,
crypt
does not display it on the screen. This latter
approach is recommended for security reasons, because when you specify the key
on the command line, it appears in the shell's command history, whereas a key
typed in response to a prompt does not.
By default, the data transformation is a simulation of a rotor machine (styled
after the Enigma machine used by the German military during WWII, but
simplified). This is fully compatible with the UNIX version of this command. The
encryption algorithm is reflexive, so the application of
crypt
to its own output, with the same key, yields the
original input. This is also the algorithm used by the encryption options of
ed
and
vi
.
Many methods of cryptanalysis depend on knowing that the distribution of input
characters is highly skewed. This is certainly the case for ASCII text. You can
frustrate these methods by making the input distribution more uniform, by first
compressing the file or encrypting more than once, with unrelated keys.
-d
decrypts data that was encrypted with the -e
option.
-e
encrypts the input using the National Bureau of Standards' Data
Encryption Standard (DES) algorithm. You can decrypt data encrypted in
this way with the -d
option.
The DES algorithm is not reflexive and is probably much more secure than the rotor machine; however, it is noticeably slower.
-t
attempts to decrypt the input if it appears to be encrypted; otherwise,
it applies no transformations. This is a heuristic used to improve the
behavior of ed
and
vi
. However, if the first block
of characters of a non-encrypted file are randomly distributed, this
option may not work. You cannot use -t
with either of
the -d
or -e
options.
0
Successful completion.
1
Failure due to any of the following: