7.1 Demo 1: cipher

cipher encrypts and decrypts files. On most Unix systems, the crypt program uses a variant of the Enigma cipher. This is not secure, and there exists a freely available program called ``Crypt Breaker's Workbench'' which helps in breaking the cipher if you have some knowledge of the encrypted data.

cipher is a more secure file encryption program. Simply list the names of the files to be encrypted on the command line. cipher will go through the list and encrypt or decrypt them; cipher can recognize files it has previously encrypted. The ciphertext of a file is placed in a file of the same name with '".cip"' appended; the original file is not deleted, since I'm not sure that all errors during operation are caught, and I don't want people to accidentally erase important files.

There are two command-line options: -c and -k. Both of them require an argument. -c ciphername uses the given encryption algorithm ciphername; for example, -c des will use the DES algorithm. The name should be the same as an available module name; thus it should be in lowercase letters. The default cipher is IDEA.

-k key can be used to set the encryption key to be used. Note that on a multiuser Unix system, the ps command can be used to view the arguments of commands executed by other users, so this is insecure; if you're the only user (say, on your home computer running Linux) you don't have to worry about this. If no key is set on the command line, cipher will prompt the user to input a key on standard input.


Subsections