For The Love of Ciphers: Félix-Marie Delastelle

Two-square, three-square and four-square

Four square cipher

AT TA CK AT DA WN
    a b c d e   Z G P T F
f g h i k O I H M U
l m n o p W D R C N
q r s t u Y K E Q A
v w x y z X V S B L

M F N B D a b c d e
C R H S A f g h i k
X Y O G V l m n o p
I T U E W q r s t u
L Q Z K P v w x y z
    a b c d e   Z G P T F
f g h i k O I H M U
l m n o p W D R C N
q r s t u Y K E Q A
v w x y z X V S B L

M F N B D a b c d e
C R H S A f g h i k
X Y O G V l m n o p
I T U E W q r s t u
L Q Z K P v w x y z
    ATTACKATDAWN
TIYBFHTIZBSY
import sys
from pycipher import Foursquare
four1='ZGPTFOIHMUWDRCNYKEQAXVSBL'four2='MFNBDCRHSAXYOGVITUEWLQZKP'phrase='ATTACK AT DAWN'
if (len(sys.argv)>1):
four1=str(sys.argv[1])
if (len(sys.argv)>2):
four2=str(sys.argv[2])
if (len(sys.argv)>3):
phrase=str(sys.argv[3])
from pycipher import Foursquare
s = Foursquare(four1,four2)
res=Foursquare(key1=four1,key2=four2).encipher(phrase)
print "Cipher: ",res
print "Decipher: ",Foursquare(key1=four1,key2=four2).decipher(res)

Bifid cipher

.... . .-.. .-.. --- /      .-- --- .-. .-.. -..
H E L L O SPACE W O R L D
Plain text:    H    e l    l    o    w   o   r   l    d
Morse string: ....x.x.-..x.-..x---xx.--x---x.-.x.-..x-..
['...', '..-', '..x', '.-.', '.--', '.-x', '.x.', '.x-', '.xx', 
'-..', '-.-', '-.x', '--.', '---', '--x', '-x.', '-x-','-xx',
'x..', 'x.-', 'x.x', 'x-.', 'x--', 'x-x', 'xx.', 'xx-']
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
. . . . . . . . . - - - - - - - - - x x x x x x x x
. . . - - - x x x . . . - - - x x x . . . - - - x x
. - x . - x . - x . - x . - x . - x . - x . - x . -
AGTCDHOTQODTCJ
.--.x.x-x.x.-.xx.--.x..x.--.x.x.-.xx.--.x..x-.-.x-.-x.x-..xx
P e t e r ' ' p i p e r' ' p i c k e d ' '
E .   S ...  H ....  B -...  1 .----  period  .-.-.-
T - U ..- V ...- X-..- 2 ..--- comma --..--
I .. R .-. F ..-. C-.-. 3 ...-- query .-.-.-
A .- W .-- L .-.. Y --.- 4 ....- colon ---...
N -. D -.. P .--. Z --.. 5 ..... s/colon -.-.-.
M -- K -.- J .--- Q --.- 6 -.... dash -....-

G --. 7 --... slash -..-.

O --- 8 ---.. equals -...-

9 ----.

0 -----
EPSDUCVWYM.ZLKXNBTFGORIJHAQ
square 1   square 2   square 3   

1 2 3 1 2 3 1 2 3
1 E P S 1 M . Z 1 F G O
2 D U C 2 L K X 2 R I J
3 V W Y 3 N B T 3 H A Q
THIS IS A TEST
--------------
T - 233
H - 331
I - 322
S - 113
I - 322
S - 113
A - 332
T - 233
E - 111
S - 113
T - 233
THISISATEST
-----------
23333132211
33221133322
33111113233
233 333 321 321 311 111 331 233 232 123 123
233 333 321 321 311 111 331 233 232 123 123
T Q R R F E H T B C C

Trifid cipher (Three square)

EPSDUCVWYM.ZLKXNBTFGORIJHAQ
square 1   square 2   square 3   

1 2 3 1 2 3 1 2 3
1 E P S 1 M . Z 1 F G O
2 D U C 2 L K X 2 R I J
3 V W Y 3 N B T 3 H A Q
THIS IS A TEST
--------------
T - 233
H - 331
I - 322
S - 113
I - 322
S - 113
A - 332
T - 233
E - 111
S - 113
T - 233
THISISATEST
-----------
23333132211
33221133322
33111113233
233 333 321 321 311 111 331 233 232 123 123
233 333 321 321 311 111 331 233 232 123 123
T Q R R F E H T B C C

Conclusions

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. EU Citizen. Auld Reekie native. Old World Breaker. New World Creator.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store