a python puzzle

Erik Max Francis max at alcyone.com
Thu Sep 26 05:53:51 CEST 2002


Lulu of the Lotus-Eaters wrote:

> I think the various responders did this "by hand."  Probably having
> the
> Python source code made it even easier to just eyeball.  In a more
> general sense (just in case anyone doesn't know), the way to solve a
> Caesar cipher like this is to start counting letter frequencies.
> Comparing the frequencies to well-known English letter frequencies
> like:
> 
>     http://gnosis.cx/download/letterfrequency.gif
> 
> lets you start matching letters pretty quickly.  Of course, if you
> don't
> know it's English, the frequency table isn't as accurate.

This wouldn't have worked as well here, since the encrypted text was so
short; furthermore, the fact that it was mostly Python code would have
likely skewed the letter frequencies, since Python keywords, modules,
and builtin names appear more frequently in Python code than general
user-chosen identifiers; the letter frequency of the code would be
biased against the letter frequency of the common "words" in Python,
which is likely to be somewhat different from English as a whole.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Gods are born and die, but the atom endures.
\__/ Alexander Chase
    Alcyone Systems' Daily Planet / http://www.alcyone.com/planet.html
 A new, virtual planet, every day.



More information about the Python-list mailing list