# codes / ciphers / encryption

source: local ♦ tags: #math #prog #nerd #privacy

#1 )) Name: Anonymous @ 2021-01-07 10:15

What are your favorite ciphers? My favorite ciphers to use "for fun" are the autokey cipher (specifically using the NSA DIANA tabula recta) and variants of the chaocipher.

NSA's DIANA essentially inverts the direction of a typical tabula recta, such that A+A=Z, A+B=Y, B+B=X, A+C=X, etc. One interesting side effect of this is that within a set of 3 letters, any combination of 2 will always produce the third, simplifying encoding/decoding. Some people seem to call this pattern reciprocal trigrams. [1] There are also only 126 trigrams, so they're easily memorized.

Autokey cipher [2] means that after the original key is consumed, the plaintext of the message is used as a key.

The chaocipher was originally designed to be a matchbox sized device built from simple wooden parts; two code-wheels spin together, but for each enciphering/deciphering, letters on each wheel are moved according to different rules per wheel. The initial alphabets used on the code wheels also make enciphering more complex.

Interestingly, the chaocipher mechanism can be reproduced using playing cards[3] or Scrabble tiles[4]. A nice side effect of using playing cards as a mechanism is that a pre-sorted deck can be given for an initial message, and whatever state the deck is left in after enciphering/deciphering a message can be used for the next communication. I've written my own chaocipher implementation in Arc Lisp which is fairly readable once you read any of the literature about chaocipher[5]

[2] - https://en.wikipedia.org/wiki/Autokey_cipher
[3] - https://pthree.org/2015/07/09/the-chaocipher-with-playing-cards/
[4] - https://prgomez.com/scrabble-cipher/
[5] - https://pastebin.com/QLN2aiN8

#2 )) Name: Anonymous @ 2021-01-07 10:20

NSA DIANA autokey example:
original key = "thegame" (7 letters)
message = "helloworld" (10 letters)
new key= "thegamehel" (10 letters: key + 3 of message)

h+t = z
e+h = o

... ZOKILRHBKL

#3 )) Name: Anonymous @ 2021-01-07 10:28

Can you decipher this chaocipher message:
>Left alphabet:
QGDJEAHKBZCUPIXNFVYLOSRWMT
>Right alphabet:
BNVKJTQOGZMAUIRLCESHDPYXFW
>Message:
WASJFOQFQWOGVFCWAWHYWOGQOYNAFSCQKGGFMBFRYYBCPVDNZEUGJAAWNCIMEDVGBOSEIVQPWZTHYEMMUQJGSFRYLZFBHDYLANSUXETEZRSZSWKFEILJDPEP

Bonus points if you try to brute force it or use dictionary attacks. I wrote a Python version of the chaocipher tool, too:
https://raw.githubusercontent.com/153/toys/master/chao.py

You need to solve the captcha before you can post.