Skip to content

Commit 88fecbc

Browse files
authored
Create README.md
1 parent 0c6adc7 commit 88fecbc

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

cryptography/porta_cipher/README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Porta Cipher
2+
3+
[From Practicalcryptography.com](http://practicalcryptography.com/ciphers/porta-cipher/):
4+
5+
The Porta Cipher is a polyalphabetic substitution cipher invented by Giovanni Battista della Porta.
6+
Where the Vigenere cipher is a polyalphabetic cipher with 26 alphabets, the Porta is basically the same except it only uses 13 alphabets.
7+
The 13 cipher alphabets it uses are reciprocal, so enciphering is the same as deciphering.
8+
9+
The algorithm used here is the same as that used by the American Cryptogram Association.
10+
11+
## The Algorithm
12+
13+
The 'key' for a porta cipher is a key word. e.g. 'FORTIFICATION'
14+
15+
The Porta Cipher uses the following tableau to encipher the plaintext:
16+
````
17+
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
18+
---------------------------------------------------------
19+
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
20+
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
21+
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
22+
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
23+
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
24+
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
25+
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
26+
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
27+
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
28+
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
29+
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
30+
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
31+
Y,Z | z n o p q r s t u v w x y b c d e f g h i j k l m a
32+
````
33+
*There are a few slightly different tableaus floating around the net, I have gone with the one used by the ACA, also referenced in Helen Fouche Gaines book "Cryptanalysis".
34+
35+
To encipher a message, repeat the keyword above the plaintext:
36+
````
37+
FORTIFICATIONFORTIFICATIONFO
38+
DEFENDTHEEASTWALLOFTHECASTLE
39+
````
40+
Now we take the first key letter 'F', and find it on the first column (the key column containing two letters) on the tableau. Then, we move along the 'F' row of the tableau until we come to the column with the 'D' at the top (The 'D' is the first plaintext letter), the intersection is our ciphertext character, 'S'. The same process is repeated for all the characters.
41+
42+
So, the ciphertext for the above plaintext is:
43+
````
44+
FORTIFICATIONFORTIFICATIONFO
45+
**DEFENDTHEEASTWALLOFTHECASTLE**
46+
synnjscvrnrlahutukucvryrlany
47+
````
48+
---
49+
You may notice that it is possible for two different keywords to produce exactly the same enciphered message. The encryption and decryption process for this cipher is identical, so encrypting a piece of text twice with the same key will return the original text.
50+
51+
[Example from Practicalcryptography.com](http://practicalcryptography.com/ciphers/porta-cipher/#javascript-example)
52+
53+
Example in Python at [https://gist.github.com/jameslyons/8910253](https://gist.github.com/jameslyons/8910253)

0 commit comments

Comments
 (0)