11.07.2015 Views

Cryptography - Sage

Cryptography - Sage

Cryptography - Sage

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Exercise 3.3 For each of the cryptographic texts from the course web page, for variousperiods extract the substrings of im + j-th characters. For those which are not simplesubstitutions, can you identify a period?Exercise 3.4 For each of the ciphertexts which you have reduced to simple substitutions,consider the frequency distribution of the simple substitution texts. Now recover the keysand original plaintext.Exercise 3.5 (Correlations of sequence translations) Suppose that pt and ct areplaintext and ciphertext whose frequency distributions are to be compared. Assume wehave defined:sage: S = AlphabeticStrings()sage: E = SubstitutionCryptosystem(S)The following code finds the correlations between the affine translations of two sequences.sage: X = pt.frequency_distribution()sage: Z = ct.frequency_distribution()sage: Y = DiscreteRandomVariable(X,Z.function())sage: for j in range(26):... K = S([ (j+k)%26 for k in range(26) ])... print "%s: %s" % (j, X.translation_correlation(Y,E(K)))What does frequency distribution return, and what are the ciphers e constructed in thefor loop? What does translation correlation return? Note that Ymust be created as adiscrete random variable on the probability space Xin order to compute their correlations.Exercise 3.6 (Breaking Vigenère ciphers) A Vigenère cipher is reduced to an translationcipher by the process of decimation. How does the above exercise solve the problemof finding the affine translation?Apply this exercise to the Vigenére ciphertext sample cipher01.txt from the course webpage, and the break the enciphering. Recall that you will have to use the decimation (byct[i::m]) and coincidence index to first reduce a Vigenère ciphertext to the output ofa monoalphabetic cipher.28 Chapter 3. Elementary Cryptanalysis

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

Saved successfully!

Ooh no, something went wrong!