Crate playfair_cipher

Crate playfair_cipher 

Source
Expand description

§About

The crate contains the playfair, the two square and the four square cipers. Note all of the are pre computer cipers. Do not feel like protecting data of any value with them. They are crackable in very short time. So this crate implements something historical and is not inteded to be used in a serious context.

As the ciphers playfair, two square and four square are closely related to each other they are implemented in the same crate, based on the playfair implementation. Two square and four square are in this implementation just wrapped aroud playfair as they are just using several playfair squares.

Any ciper can be used with a 5 to 5 or 6 to 6 matrix.

§Example 5 to 5

A B C D E
F G H I K
L M N O P
Q R S T U
V W X Y Z

When using the method encrypt the payload is converted to uppercase and any character not within the range A..I and K..Z is ignored. E.g. “I would like 4 tins of jam.” becomes “IWOULDLIKETINSOFIAM”. So you don’t need to clear off not encryptable characters when using this library. This is the classical cipher as proposed 1854.

§Example 6 to 6

A B C D E F
G H I J K L
M N O P Q R
S T U V W X
Y Z 0 1 2 3
4 5 6 7 8 9

With the 6 to 6 matrix, the senence “I would like 4 tins of jam.” becomes “IWOULDLIKE4TINSOFJAM”. So the 6 to 6 matrix allows to include digits too.

Modules§

cryptable
Traits indicating the cryptablilty of a modul
To be a cipher a module must implement the trait Crypt. Pablic exposed is the modul cipher
errors
four_square
This is the implentation of the FourSquare cipher as described https://en.wikipedia.org/wiki/Four-square_cipher
playfair
This is the implentation of the PlayFair cipher as described https://en.wikipedia.org/wiki/Playfair_cipher
two_square
This is the implentation of the TwoSquare cipher as described https://en.wikipedia.org/wiki/Two-square_cipher