hexylena / poem-code

"The poem code is a simple, and insecure, cryptographic method which was used during World War II by the British Special Operations Executive (SOE) to communicate with their agents in Nazi-occupied Europe." - Wikipedia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Poem Code

Implementation of the SOE's 'poem code' used during WW2, including some poems from Between Silk & Cyanide

Usage

$ python poem.py -a enc -r 1 'Hello darling' -p jabberwocky
HELLODARLING
ASJBKLONXAXRXLXXXGXXIDXXLHE
HELLODARLINGXXXXXXXXXX

This encrypt a message with one round of double transposition (i.e. -rounds=1) using the jabberwocky poem. It prints the 'processed' message (upper case A-Z only), the enciphered string, and then the decryption of that to ensure the output looks good. Note the trailing Xs used for padding are quite excessive here.

... for security reasons, messages should be at least 200 words long. via wikipedia

This does not (yet) implement security checks but then neither did half the agents in the field đź‘€.

Decryption

Don't know what poem was used? Using the power of computers...try them all!

$ python poem.py -a dec-test 'IJORVHXAXLLXLXXONRDIGEXXXXXXXXXXX' -r 1
jabberwocky
HELLODARLINGXXXXXXXXXXXXXXXX
bodington
XIXEOXNXXAXXXRLHXXLXXXXGDL
bodington.alt
XLHXXREIAXDXXOXLNGLX
yours
XLHXAXXRXIEOLLXXXXXDXGXN
degaul
XINLRXHXXADLXOL
degaul.alt
XXXXXAHEIOLXXRLXXXXXXXGNLXXD
middle
LODXXXLNHLXIGXAXRE

Alternate poems

Agents were sometimes instructed to use incorrect word numbering by replacing a dash in some words with spaces. For poems including a -, an alternative version with the first one replaced with a is automatically generated under {name}.alt.

License

AGPLv3

About

"The poem code is a simple, and insecure, cryptographic method which was used during World War II by the British Special Operations Executive (SOE) to communicate with their agents in Nazi-occupied Europe." - Wikipedia


Languages

Language:Python 100.0%