23.11.2014 Views

Magma Cryptosystems - The University of Sydney

Magma Cryptosystems - The University of Sydney

Magma Cryptosystems - The University of Sydney

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Cryptanalysis<br />

One important measure <strong>of</strong> a cryptographic text is the coincidence index. If we define<br />

p i to be the probability <strong>of</strong> occurrence <strong>of</strong> the i-th character <strong>of</strong> the codomain alphabet in<br />

a sample plaintext <strong>of</strong> ciphertext, then the coincidence index <strong>of</strong> the cryptosystem is the<br />

value:<br />

n∑<br />

p 2 i ,<br />

i=1<br />

where n is the size <strong>of</strong> the alphabet. Recall that the sum <strong>of</strong> all probabilities is 1, therefore<br />

the coincidence index is at most 1. <strong>The</strong> coincidence index is a measure <strong>of</strong> the probability<br />

that two randomly chosen characters are the same.<br />

To compute the coincidence index for a particular string <strong>of</strong> length N, we first compute<br />

the number <strong>of</strong> occurrences n i <strong>of</strong> each character in the alphabet. <strong>The</strong>n the probability <strong>of</strong><br />

equality for two randomly chosen characters from that string is given by<br />

∑ n<br />

i=1 n i(n i − 1)<br />

,<br />

N(N − 1)<br />

which we define to be the coincidence index <strong>of</strong> a string.<br />

For random text (uniformly distributed characters) in an alphabet <strong>of</strong> size 26, the coincidence<br />

index is approximately 0.0385. For English text, this value is 0.0661. <strong>The</strong>refore<br />

we should be able to pick out text which is a simple substitution or a transposition <strong>of</strong><br />

English text. Other languages will have an associated coincidence index, which<br />

Another important tool for cryptanalysis Kasiski test. This is useful for determining<br />

periodicity in ciphertext. Ciphertext <strong>of</strong> a Vigenère cipher has a period m such that for each<br />

fixed j the mi +j-th characters are given simple substitution <strong>of</strong> the corresponding mi +jth<br />

plaintext. If a frequently occurring pattern, such as THE is aligned at the same position<br />

with respect to this period, then the same three characters will appear in the ciphertext,<br />

at a distance which is an exact multiple <strong>of</strong> m. By looking for frequently occurring strings<br />

in the ciphertext, and measuring the most frequent divisors <strong>of</strong> the displacements <strong>of</strong> these<br />

strings, it is <strong>of</strong>ten possible to identify the period, hence to reduce to a simple substitution.<br />

<strong>The</strong> <strong>Magma</strong> crypto package functions<br />

Exercises<br />

CoincidenceIndex, Decimation, and FrequencyDistribution<br />

provide functionality for analysis <strong>of</strong> the ciphertexts in the exercises.<br />

1. For each <strong>of</strong> the cryptographic texts from the course web page, compute the coincidence<br />

index <strong>of</strong> the ciphertexts. Can you tell which come from simple substitution<br />

or transposition ciphers? How could you distinguish the two?<br />

2. For each <strong>of</strong> the cryptographic texts from the course web page, for various periods<br />

extract the substrings <strong>of</strong> im + j-th characters. For those which are not simple<br />

substitutions, can you identify a period?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!