Vigenere Cipher
|
Encrypt and decrypt messages and files. The Vigenere cipher is an old cryptographic system, which offers very little security, but is interesting to analyse. This program allows you to encrypt and decrypt messages and files using the original form of the cipher, which only handles capital letters. It also has a facility to try to decode a ciphertext with unknown key, which is usually successful, within some limits. The "save document with password" function in some desktop applications use the Vigenere cipher, slightly modified to handle all bytes rather than just capital letters (by using XOR), but having the same vulnerabilities.
Using the Program
The zip file contains a Windows 32-bit executable, HTML documention and C source code. So far, I've tested the code using DevStudio under Windows NT, but it should work on most platforms apart from MS-DOS. If you are familiar with computers and basic cryptography then the program is largely self explanatory, although these points are worth highlighting:
1. To work with a file, enter !filename when prompted for a string. The output is written to filename.vig
2. At any prompts ending (suggest ...), just press enter to use the suggested value
3. While trying to work out an unknown key, a sample of the ciphertext is shown in lower case, alongside a sample of the uncovered plaintext in captials.
Vigenere Cipher Features:
1. The general idea is to make the code look as if it were written in a functional language, like ML. This isnt rigorously enforced though, e.g. loops are used instead of deep recursion.
2. Errors are handled by calling vig_error as soon as the error is detected. This uses setjmp/longjmp to escape back to the main menu, so theres no null return codes to worry about.
3. vig_malloc is used instead of malloc. This keeps track of allocated memory, so calling vig_freeall frees everything.
4. Functional style low-level routines are written, e.g. vig_loadfile takes a file name and loads it into newly allocated memory.
5. For portability, size and endianness of data types doesnt matter, and only POSIX system calls are used. The program assumes at least an 80 x 25 character terminal.
6. Global variables are avoided, except where necessary in low level functions, e.g. storing the stack environment for error handling. Function names all have the prefix vig_.
The license of this software is Free, you can free download and free use this file encryption software.