Cryptology - Unofficial St. Mary's College of California Web Site
Cryptology - Unofficial St. Mary's College of California Web Site
Cryptology - Unofficial St. Mary's College of California Web Site
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
8.3. THE FRIEDMAN TEST 143<br />
The Friedman Test: Given a ciphertext, perhaps from a polyalphabetic<br />
cipher, compute<br />
Then<br />
Φ =<br />
#A(#A − 1) + #B(#B − 1) + · · · + #Z(#Z − 1)<br />
.<br />
N(N − 1)<br />
1. If Φ is near .065, the cipher is likely to be a monoalphabetic one. If<br />
Φ is closer to .038, the cipher is likely to be polyalphabetic.<br />
2. The value <strong>of</strong> Φ to be expected from a polyalphabetic ciphers <strong>of</strong> given<br />
keylength is<br />
Keylength Expected Φ<br />
1 .065601<br />
2 .052036<br />
3 .047515<br />
4 .045254<br />
5 .043898<br />
6 .042994<br />
10 .041186<br />
large .038461<br />
Suppose, for example, we compute that a cipher text has Φ = 0.47. Then<br />
Friedman’s Test 7 would suggest that the keyword is probably three or four letters<br />
long. Notice from the wiggle words (“suggest” and “probably”) that this method<br />
gives only an approximation and there will frequently be cases in which the<br />
Φ = .043 but the length <strong>of</strong> the keyword is actually 3. To double check that the<br />
correct keylength was found one can either<br />
1. Do a brief Kasiski Examination <strong>of</strong> the text to see if you can find 3 or 4<br />
sequences <strong>of</strong> letters that support the Friedman computation. Or<br />
2. Use the keylength suggest by the Friedman test to divide the ciphertext<br />
into that number <strong>of</strong> rows. Recompute Φ for each row. These Φ’s will<br />
be between .03 and .07. If most <strong>of</strong> them are closer to .07 than .03 you<br />
have probably discovered the correct keylength. (It might seem time consuming<br />
to recompute several mini−Φ’s, but since we will need to do a<br />
frequency count for each <strong>of</strong> the rows anyway there is relatively little extra<br />
computation.)<br />
7 Calling this “The Friedman Test” is wildly unfair to Friedman. The Index <strong>of</strong> Coincidence<br />
has many applications, only one <strong>of</strong> which is estimating the keylength <strong>of</strong> a polyalphabetic<br />
cipher. Another application (see Exercises 8.20) is the determination <strong>of</strong> a ciphertext’s original<br />
language. Another, more important, one is to solve the superimposition problem: given<br />
several, perhaps partial, polyalphabetic ciphertexts with the same key, how should the texts<br />
be lined up under one another (“superimposed”) so that the letters in each column have the<br />
same keyletter. This is especially valuable when breaking machine ciphers <strong>of</strong> the type used in<br />
the 1930’s and 1940’s.