Blog

Decrypt a subcipher with a one-liner

#Crypto · #Code | ~5min.

I recently saw some fancy Perl one-liners and ed/sed scripts that do some incredible stuff with little to no effort. This inspired me to create one myself: A one-liner that decrypts a substitution cipher. In short, a substitution cipher is one of the more simpler (and also more unsafe) ciphers. It works by simply substituting one letter by another. Even though it is practically not breakable by brute-forcing it (due to its large keyspace: 288), it is prone to crypto analysis. Calculating the letter frequency of a cipher allows one to replace each letter’s position with the corresponding frequency position in a given language1