11.07.2015 Views

Cryptography - Sage

Cryptography - Sage

Cryptography - Sage

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ExercisesRead over the above SAGE tutorial and become familiar with the concepts of type, parent,assignment, basic constructions of integers, rationals, and strings, and with simple loopingand boolean operations.Exercise B.1 For the function strip encoding, type the function name followed by a ?at the SAGE prompt to display the docstring for the function. Do the same forSubstitutionCryptosystem and TranspositionCryptosystem.What are the components of this information, and what does it tell you?Create a cryptosystem E and typeto read the corresponding docstrings.E.encoding?, E.random key? and E.enciphering?Solution.The docstring details of the path for the function and a description of its use.Exercise B.2 Create the string in SAGE“I am standing up at the water’s edge in my dream”and assign it to a variable W . Next create the string monoid S of AlphabeticStrings.Apply the member function encoding to W , while reassign W to be the output. What isthe encoded plaintext that you obtain?Solution.The command encoding gives IAMSTANDINGUPATTHEWATERSEDGEINMYDREAM.Exercise B.3 Define K to be the output of E.random key() for a substitution cryptosystem.What is your key? Using the cipher E(K), to find the enciphering of W with respectto the key K.Solution. The substitution key UVLOIDTGKYZCRHBPMJQWXNFSAE enciphers the above plaintextas KURQWUHOKHTXPUWWGIFUWIJQIOTIKHRAOJIUR.Exercise B.4 Show that the deciphering map with respect to K is also a simple substitution.What is the inverse substitution key with respect to your particular K? Verify thisby creating the inverse key and enciphering the ciphertext with respect to it.100 Appendix B. SAGE Cryptosystems

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

Saved successfully!

Ooh no, something went wrong!