Welcome Guest [Log In] [Register]
Viewing Single Post From: Cracking A Vig With Ic
jdege
Member Avatar
Elite member
[ *  *  *  *  * ]
Paarth Dave
May 9 2008, 01:09 AM
How do you do that?
Have you read: http://z13.invisionfree.com/Crypto/index.php?showtopic=456?

You split the ciphertext into n slices, where n is your provisional keylength.

So if you're testing to see if the keylength is 3, you split the ciphertext into three slices, where slice 0 has letters 0,3,6,9,12,...slice 1 has letters 1,4,7,10,..., and slice 2 has letters 2,5,8,11,...

The for each slice we do a frequency count, and then calculate the Incidence of Coincidence of that slice, and then we average the IC's for the n slices.
Paarth Dave
May 9 2008, 01:09 AM
And how do you do a chi test?
You need two frequency counts, one of slice you're testing, and one of a piece of standard English text that you're using as a reference.

Suppose you have F1: {A=3, B=1, C=1, D=1, E=12, F=3,...} and F2: {A=8, B=1, C=3, D=0, E=21, F=8,...}. Where the sum of the counts for F1 is N1: 105, and the sum of the counts for F2 is N2: 306. You multiple the count for A in F1 by the count for A in F2, and add to it the product of the count for B in F1 and B in F2, etc. Then divide by the product of the sums.
Code:
 
(F1[A]*F2[A] + F1[B]*F2[B] + F1[C]*F2[C] + F1[D]*F2[D] + F1[E]*F2[E] + F1[F]*F2[F] + ... ) / (N1 * N2)

(3*8 + 1*1 + 1*3 + 1*0 + 12*21 + 3*8 + ...) / (105*306)
When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
Offline Profile Quote Post
Cracking A Vig With Ic · General