For extra credit, propose code that can be used to automatically break the substitution cipher. See this explanation for a starting point. At some point you'll end up with some good guesses on what might be the most likely substitutions.
The article mentions that "E", "I", and "A" are most common for English. Here are a few other heuristics you might apply:
- Q is nearly always followed by "U", and is very uncommon.
- "TH" often appear together.
- "NG" often appear together, and often at the end of words. When at the end of the word, usually preceded by "I".
- "SH" often appear together.
- "A" and "I" are the two most likely to occur alone.
I haven't investigated strategies more than to just think about it a bit, but I suppose you would work out probabilities, and then start testing assumptions against a dictionary to see if they work out. Then you can test those assumptions against the original string to see if they turn it into something recognizable.
Rotation ciphers are even easier, as the number of possibilities allows for brute force testing.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.