https://github.com/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
https://github.com/hexylena/poem-code
cryptography historical-cipher
Last synced: 10 months ago
JSON representation
"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
- Host: GitHub
- URL: https://github.com/hexylena/poem-code
- Owner: hexylena
- Created: 2021-08-16T16:53:20.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-16T17:03:03.000Z (almost 5 years ago)
- Last Synced: 2025-04-07T19:52:08.043Z (about 1 year ago)
- Topics: cryptography, historical-cipher
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Poem Code
Implementation of the [SOE's 'poem code'](https://en.wikipedia.org/wiki/Poem_code) used during WW2, including some poems from [Between Silk & Cyanide](https://en.wikipedia.org/wiki/Between_Silk_and_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. `-r`ounds=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](https://en.wikipedia.org/wiki/Poem_code)*
This does not (yet) implement security checks but then neither did half the agents in the field :eyes:.
## 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