crypt - encrypt or decrypt a file
crypt [-d] [-n rotors] -p password file...
decrypt [-n rotors] -p password file...
crypt encrypts and decrypts the contents of a file. When encrypting, it replaces the orginal file with the encrypted version, adding a .x suffix. When decrypting, it replaces the original encrypted file with the decryped verion; the orginal filename must end with a .x, which will be removed. crypt decrypts if the -d option is given, or if it is invoked with a filename starting with a d, encrypts otherwise. (Under Unix, the standard way of handling such programs it to set a link with the name decrypt which points to the program.)
crypt implements a version of the German Enigma machine, using 256-element rotors; the number of rotors defaults to 2, but can be modified by a command line option. Methods of attack on such machines are widely known. Note too that the password (the key) is visible to anyone using ps or something similar while the program is executing. For these reasons, crypt cannot be considered a particularly sure means of encryption, and should not be used to encrypt critical data. It should, in fact, be considered as simply a somewhat more elaborate form of rot13, which is effective to prevent someone from accidentally seeing the data, but which will not even slow down a dedicated cracker. The program itself was designed and written more for pedagogical and experimental reasons than as a tool to enhance security. (At the time the program was first written, the Unix crypt—which uses a simpler form of the same algorithm—was considered critical technology, and it was not allowed to export it outside the United States. Scientific American had just published an article on the German Enigma machine, and it seemed interesting to implement something better than the standard crypt outside the United States.)
The following options are supported:
- -d
- Instructs the program to decrypt, rather than to encrypt. The same effect can be had by giving the program a name starting with d, either by means of a link (under Unix) or by copying it (under Windows).
- -n rotors
- Specifies the number of rotors to use (default 2). The same value must be used when encrypting and when decrypting.
- -p password
- Specifies the password. This option must be given; there is no default. This is the only way of specifying the password, and requires the password to appear in clear text on the users terminal, which is a major weakness. (Historically, the orginal version turned off echoing and read the password from the users terminal if this option wasn't given. The code was highly Unix specific, however, and so has been removed in the interests of portability.)
The following operands are supported:
- file
- A pathname of a file to be encrypted or decrypted. If the filename ends in .x, the .x will be ignored for the cleartext version of the file (input when encrypting, output when decrypting); if the filename doesn't end in .x, a .x will be added to the name of the encrypted version of the file (input when decrypting, output when encrypting).
0 no error. 2 One of the input files could not be opened. 3 Hardware error when writing an output file.
Isn't really useful for anything. It's not secure enough for real encryption, and is a lot more complicated than a simple rot13 for the cases where it would be sufficient.