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.

APPENDIXDRevision ExercisesLet A be the alphabet {A, B, C, D, E}. Given the message A BAD CAB A DEAD DAD, we formthe strip–encoded plaintextM = ABADCABADEADDADby removing all characters not in the alphabet.Exercise D.1 Encipher the message M using the substitution key K = BDEAC. Find theinverse key and verify the correctness by deciphering your ciphertext.Solution. Recall that the key K = BDEAC specifies the map A ↦→ B, B ↦→ D, etc. Thisresults in the encipheringM = ABADCABADEADDAD ↦→ C = BDBAEBDBACBAABD.Exercise D.2 Let A → Z/5Z be the bijection A ↦→ 0, B ↦→ 1, . . . , E ↦→ 4. Encipher themessage M using the Vigenère key K = ADECB in ECB mode, then encipher the samemessage using the same key and initialization vector BBBB, in CFB and OFB modes withthe block length n = 5 and r = 1. Rather than bit sum, use summation in Z/5Z for thefeedback. Verify the correctness of your results by then deciphering the ciphertext.Solution. We make the identification M = ABADCABADEADDAD = 010320103403303 overZ/5Z. In the same way, we write K = ADECB = 03421. The enciphering in ECB mode isthen 044030440001223 = AEEADAEEAAABCCD. The enciphering in CBC mode begins withC 0 = BBBBB = 11111, and since E K (C j−1 ⊕ M j ) = C j−1 ⊕ E K (M j ), we just add in theprevious ciphertext block to get11111100141441410132 = BBBBBBAABEBEEBEBABDC.133

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

Saved successfully!

Ooh no, something went wrong!