Module cipher_crypt::porta

source ·
Expand description

The Porta Cipher is a polyalphabetic substitution cipher. It was invented by Giovanni Battista della Porta, an Italian polymath, in 1563.

To generate the keystream for encryption, a key is repeated as often as needed to match the number of (alphabetic) symbols in the plaintext message. Finally, the (alphabetic) symbols of the message are substituted using a substitution table. Since Porta is a reciprocal cipher, decryption works the same as encryption.

This implementation uses the following substitution table:

Keys| 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
---------------------------------------------------------
A,B | n o p q r s t u v w x y z a b c d e f g h i j k l m
C,D | o p q r s t u v w x y z n m a b c d e f g h i j k l
E,F | p q r s t u v w x y z n o l m a b c d e f g h i j k
G,H | q r s t u v w x y z n o p k l m a b c d e f g h i j
I,J | r s t u v w x y z n o p q j k l m a b c d e f g h i
K,L | s t u v w x y z n o p q r i j k l m a b c d e f g h
M,N | t u v w x y z n o p q r s h i j k l m a b c d e f g
O,P | u v w x y z n o p q r s t g h i j k l m a b c d e f
Q,R | v w x y z n o p q r s t u f g h i j k l m a b c d e
S,T | w x y z n o p q r s t u v e f g h i j k l m a b c d
U,V | x y z n o p q r s t u v w d e f g h i j k l m a b c
W,X | y z n o p q r s t u v w x c d e f g h i j k l m a b

For every key-message symbol pair (k, m), the corresponding ciphertext symbol is determined by selecting the table row according to k and the column according to m.

Structs

A Porta cipher.