Hacker News new | past | comments | ask | show | jobs | submit login

From what I remember, a more efficient way of decrypting simple alphabet substitution codes is by working on the frequency of bigrams and trigrams, rather then single letters, because apart from E, already T and A can be easily swapped in the frequency order.



In practice, you spend a minute or two moving the dials ("E", or maybe " ", &c) and when you have the right one you can tell because the output starts making sense. Not saying you're wrong, just that you're overthinking it. :)


Actually no. Trigram analysis is the best way to solve simple substitution ciphers. Most common trigram is nearly always "THE" with a much higher probability than single-letter trials will get you.

Sure, some trial and error will probably yield results, but what he's describing is (part of the) systematic approach, not "overthinking".


Um. Like. I'm sure you're right? But in practice, single-character substitution ciphers are so trivial to solve that you can more or less try "E", then space, then maybe "T" and have it.

You don't even need to know what a "trigram" is to solve single character substitution over English text; if you couldn't do it in a job interview in code on a whiteboard here, that'd be a "NO HIRE".

Also note that the "most efficient" ways of "breaking" (strange word to use when we're talking about Carmen Sandiego-grade ciphers) ciphers aren't always the best. For instance, the best way I know to break multi-character substitution in web apps is comically inefficient (in terms of ciphertexts required), but fits in just a couple lines of code.


Also, in this example the writer didn't use the word THE, he was writing in a vernacular and used DA.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: