Your skill will accomplishwhat the force of many cannot PerlMonks

### Re: encryption (chi-squared test)

by gumby (Scribe)
 on Jun 20, 2002 at 12:40 UTC ( #175986=note: print w/replies, xml ) Need Help??

An alternative, of course, is to use a statistical method: use the chi-squared test (see Mathworld).

Let F_a(x) be the frequency of some letter, x, in you're alphabet, and let F_m(x) be the frequency of some letter, x, in the message. Now, for all 0 <= s <= 25 calculate for each letter, x, in your alphabet the sum of the squares of F_m((x + s)(mod 26)) / F_a(x). The value of s for which this obtains a minimum is the shift used to encipher the message.

Create A New User
Node Status?
node history
Node Type: note [id://175986]
help
Chatterbox?
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2018-04-26 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (97 votes). Check out past polls.

Notices?