Cryptographer's Toolkit (Help)

The toolkit is designed to allow students of cryptography to break simple ciphers without tedious transcriptions and calculations. In particular, it is not designed to break ciphers automatically.

Working with the toolkit

The toolkit consists of individual toolbars. You can display or hide toolbars by (un)checking the corresponding check-boxes.

Most, but not all, toolbars apply a cipher to the message in the Input text area and write the output into the Output text area.

Here is a detailed description of all toolbars:

[I/O]
Input/Output toolbar

All calculations performed by the toolkit (except those in the Calculator toolbar) apply to the message written into the Input text area.

All upper-case characters in Input and Output are converted internally into lower-case, and then all characters except "abcdefghijklmnopqrtsuvwxyz*" are ignored.

By checking the group characters checkbox, the string in the Input or Output text area is split into groups of characters, with the size of each group specified by the value of the groups of size parameter.

By clicking the input » output button, the content of the Input text area is moved into the Output text area. The output » input button has the opposite effect, and the input «» output button interchanges the contents of the Input and Output text areas.

[Monoalphabetic]
Monoalphabetic Cipher toolbar

Characters 'a', ..., 'z' are identified with integers 0, ..., 25, and all modular arithmetic performed with the characters is understood modulo 26.

By clicking the Apply! button, one of three calculations will be performed:

If the first radio button is selected, the characters in Input will be first multiplied by n and then shifted by m, according to the values specified in the form.

If the second radio button is selected, the characters in Input will be first shifted by n and then multiplied by m, according to the values specified in the form.

If the third radio button is selected, the characters in Input will be replaced according to the prescribed values. If the prescribed value is left blank then the corresponding character is replaced by an asterisk (*).

[Vigenere]
Vigenere Cipher toolbar

By clicking the Apply! button, the selected keyword is either added to or subtracted from the Input. The keyword and the message in Input are added or subtracted one character at a time, and when the message is longer than the keyword, the keyword is repeated as many times as needed.

[Playfair]
Playfair Cipher toolbar

By clicking the Erase square! button, the content of the square is erased for easier input.

By clicking the Apply! button, the Playfair's cipher is applied to Input according to the specified parameters.

First the message in Input is prepared as follows: All characters missing from the Playfair square are deleted. If the resulting message is of odd length, a specified character is added to the end of it. The message is split into groups of two characters. If two characters in a group coincide, the second character is replaced by the specified character.

Then the ciphertext is produced, two characters at a time. If the two characters form corners of a rectangle (i.e., they are not in the same row or same column) in the Playfair square, they are replaced by the characters in the two remaining corners of the rectangle, using first the character in the same row as the first character. If the two characters are in the same row, the resulting characters are obtained by shifting the characters in the square to the right by the prescribed number of columns, with wrap-around. If the two characters are in the same column, the resulting characters are obtained by shifting the characters down by the prescribed number of rows, with wrap-around.

Note that the cipher works properly only if the Playfair square contains all but one character of the alphabet. Moreover, the cipher gets stuck if it contains the same two characters in a group, say "xx", and if the instructions specify that the second character is supposed to be replaced by "x".

[Hill]
Hill's System toolbar

By clicking the Apply! button, either the 2 by 2 Hill's cipher or the 3 x 3 Hill's cipher is applied to Input.

Since the Hill cipher processes 2 (respectively 3) characters at a time, you must tell the toolkit how to terminate a message if its length is not divisible by 2 (respectively 3). Each digraph (respectively trigraph) x of the message is then encrypted as Ax, where A is the specified matrix.

Note that the encryption works for any matrix A, but you will only be able to recover the message if A is invertible modulo 26.

[RSA]
Baby RSA toolbar

The RSA ciphers works as follows:

The public key is the pair (n,e), and the private key is the number d.

Given a nonnegative integer m less than n, the encryption turns it into c = me mod n, and then m is recovered from c during decryption via m = cd mod n.

By clicking the Encrypt! button, the encryption is performed with the provided public key (n,e). By clicking the Decrypt! button, the decryption is performed with the provided private key d. (Note that n is required during the decryption, too.)

An integral part of the encryption/decryption in RSA is the conversion of (groups of) characters into numbers, and vice versa. This can be done in many ways. Here is how the toolkit does it:

Encryption. Let k be the largest integer such that 26k<=n.

Decryption is the inverse process to encryption, starting by splitting the content of the Input box into groups of k+1 characters, converting them into numbers, raising to the power d, reducing modulo n, converting back into groups of k characters, and displaying the result in the Output box.

For pedagogical reasons, all intermediate steps of the calculation (as described above) will be displayed in the Output box, too, if the corresponding checkbox is checked.

[Edit]
Edit Text toolbar

By clicking the Apply! button, you can do one of the following:

[Stats]
Statistical Information toolbar

Several statistical tests can be applied to the Input by clicking the "=" buttons. Namely:

[Calc]
Calculator toolbar

This toolbar performs some arithmetic operations often needed in cryptography. It finds:

To perform a calculation, set the value of the modulus n and then click on the corresponding button "=", "+", "-", "*" or "/".

[English]
English toolbar

This inactive toolbar gives the positions of all characters in the alphabet, and also lists the most common characters, digraphs, and trigraphs in English.

[Primes]
Primes toolbar

This inactive toolbar lists all prime numbers less than 5000.

(c) Petr Vojtechovsky, 2006-2020.
Cryptographer's toolkit is freeware. It is therefore available for use free of charge and for an unlimited time.