Description of the encryption and decryption algorithms

(Note: The algorithms are written in PHP.)

Encryption

Encryption starts with the generation of a human-readable key of length seven. This key is generated by choosing certain letters and digits using the 'mt_rand' pseudo-random number function. The key characters are:

First characters: "acdefhijkmnprtvwxyz"
Subsequent characters: "acdefhijkmnprtvwxyz23479"

A letter is prefixed to the key to indicate which algorithm version is used.

Next, the input text is padded on the right with DEL (0x7f) characters. The number of pad characters depends on the key (via the 'md5' digest function).

Next, the input text is shuffled depending on the key (via 'md5'). The key mapping used is different from that used for padding.

Next, encryption proper is done. Each character in the input text is XORed with a number that depends on the key (via 'md5'). The key mapping used is different from that used previously, and includes dependence on the index in the input text. These XOR values are converted to human-readable by breaking each 8-bit value into two 4-bit values, and storing them, using '@' as a base character offset, in the output text. The resulting encrypted string characters are '@' and 'A' through 'O'. Finally, the resulting encrypted string is broken into fixed-length lines by inserting newline characters. Newlines are ignored by the decryption algorithm.

Decryption

Decryption starts with decryption proper, using the same proper algorithm described above for encryption. Note that if EncryptedChar = XOR(A,PlaintextChar), then XOR(A,EncryptedChar) is PlaintextChar.

Next, the input text is shuffled depending on the key, as described above. The order of shuffling is reversed, so the original order is restored. Finally, the trailing pad characters are removed.


Courtesy of David Spector (www.springtimesoftware.com)