Exploring Cryptography Using the Sage Computer Algebra System School of Engineering and Science Victoria University

Exploring Cryptography Using the Sage Computer Algebra System School of Engineering and Science Victoria University

Exploring Cryptography Using the Sage Computer Algebra System by Minh Van Nguyen Thesis submitted in partial fulfillment of the Requirements for the Degree of Bachelor of Science (Honours) in Computer Science Supervisor: Dr Alasdair McAndrew School of Engineering and Science Victoria University December, 2009 c Copyright by Minh Van Nguyen 2009 Exploring Cryptography Using the Sage Computer Algebra System Declaration I hereby declare that this submission is my own work and to the best of my knowl- edge it contains no material previously published or written by another person, nor material which to a substantial extent has been accepted for the award of any other degree or diploma at Victoria University or any other educational institution, except where due acknowledgement is made in the thesis. Any contribution made to the re- search by colleagues, with whom I have worked at Victoria University or elsewhere, during my candidature, is fully acknowledged. I also declare that the intellectual content of this thesis is the product of my own work, except to the extent that assistance from others in the project’s design and conception or in style, presentation and linguistic expression is acknowledged. Information derived from the published and unpublished work of others has been acknowledged in the text and a list of references is given. Minh Van Nguyen 05 December 2009 iii Exploring Cryptography Using the Sage Computer Algebra System Minh Van Nguyen [email protected] Victoria University, 2009 Supervisor: Dr Alasdair McAndrew [email protected] Abstract Cryptography has become indispensable in areas such as e-commerce, the legal safe- guarding of medical records, and secure electronic communication. Hence, it is incumbent upon software engineers to understand the concepts and techniques un- derlying the cryptosystems that they implement. An educator needs to consider which topics to cover in a course on cryptography as well as how to present the concepts and techniques to be covered in the course. This thesis contributes to the field of cryptography pedagogy by discussing and implementing small-scale cryp- tosystems whose encryption and decryption processes can be stepped through by hand. Our implementation has been accepted and integrated into the code base of the computer algebra system Sage. As Sage is free and open source, students and educators of cryptology need not worry about paying license fees in order to use Sage, but can instead concentrate on exploring cryptography using Sage’s built-in support for cryptography. iv Acknowledgements I am indebted to several people whose support, inspiration and encouragement have been invaluable during the course of writing and performing the work described in the thesis. First and foremost is my thesis supervisor Dr Alasdair McAndrew who provided a stimulating environment during the time that we worked together. His probing questions and indefatigable support have contributed to enhancing the quality of the thesis. The majority of my software development effort took place on the compute node sage.math [101], which is one of four machines comprising the Sage cluster and supported by US National Science Foundation Grant No. DMS-0821725. I wish to extend my gratitude to Associate Professor William A. Stein of the University of Washington, USA, for allowing me access to the Sage cluster in order to develop and test all of the software implementation described in this thesis. Professor Stein is a technical reviewer of my implementation of S-DES [83]. He also provided me with access to the machine bsd.math.washington.edu and expended considerable effort so that I have access to the computer network SkyNet, which is a research network of the US Department of Defense and administered by Mariah Lenox. Software testing conducted on the Sage cluster, the machine bsd.math.washington.edu, and SkyNet has contributed to enhancing the quality, stability and portability of my enhancements to the cryptography module of the Sage computer algebra system. Martin Albrecht of the University of London, UK, is a technical reviewer of my implementation of S-DES [83] and the sole technical reviewer of my implementation of Mini-AES [80]. His constructive and timely feedback played a considerable role in enhancing the quality of those two implementations. He also read an early draft of this thesis and made numerous suggestions to clarify the exposition of Chapters 1 and 2. I also wish to thank Mr Albrecht for reminding me that Sage distributes the PyCrypto library. This observation has contributed to improving the exposition of Chapter 2. Nick Alexander of the University of California at Irvine, USA, is the sole technical reviewer of my patch at ticket #6222 [85]. Sage developer and release manager Mike Hansen reviewed my implementation [79] of an algorithm for solving the subset sum problem over super-increasing sequences. He is also the sole technical reviewer of my patch at ticket #6176 [81], and co-reviewed my patches at ticket #7123 [78]. Prior to starting development of the Sage implementation of cryptosystems de- scribed in Chapters 3 to 6, I submitted a patch to ticket #5529 [77] in order to enhance the documentation of the Sage cryptography module. Associate Professor v John Palmieri of the University of Washington, USA, is the technical reviewer of that patch. His comments and reviewer patch for ticket #5529 have contributed to improving the overall quality of the documentation for the Sage cryptography module. I wish to acknowledge Professor Robert A. Beezer of the University of Puget Sound, USA, for bringing to my attention both the chi-square and squared-differences statistical measures and our subsequent discussion on using those measures for crypt- analysis of the shift and affine cryptosystems. Professor Beezer is the technical re- viewer of my implementation of the shift [84, 82, 78] and affine [76] cryptosystems. His feedback have contributed to considerably enhancing my original implementa- tions. Professor Beezer also reviewed a draft of the thesis and provided comments on typographical and stylistic errors. I would like to extend my gratitude to Professor Bernhard Esslinger, leader of the CrypTool [37] project, for inviting me to join the project’s documentation team. Since joining the documentation team of CrypTool, I have had ample opportunities to enhance the CrypTool tutorial with Sage code for learning cryptography. Some of the cryptography implementations described in the thesis have made their way into the CrypTool tutorial as examples showing the working of particular cryptosystems. Professor Esslinger also made numerous comments on a draft of the thesis that help to clarify many issues. Finally, I wish to thank Brett Robertson of Victoria University, Australia, and two anonymous reviewers for reading a draft of the thesis. Mr Robertson made numerous comments that help to improve the organization of the thesis and the exposition of Chapters 1 and 7. One of the two anonymous reviewers reminded me that Sage also supports the PyCrypto library, an observation which helps to improve my exposition of Chapter 2. The anonymous reviewers, and many people who read a draft of the thesis, pointed out numerous grammatical, spelling and stylistic errors. Any errors that remain are solely my responsibility. Minh Van Nguyen Victoria University December 2009 vi Contents Abstract ..................................... iv Acknowledgements .............................. v List of Tables .................................. ix List of Figures ................................. x List of Algorithms ............................... xi 1 Introduction ................................. 1 1.1 Cryptography and computer security . 2 1.2 Thesisoutline ............................... 3 2 A Survey of CAS for Cryptography Education ........... 5 2.1 Computeralgebrasystems . 6 2.2 CASincryptographyeducation . 7 2.3 Sagemathematicssoftwaresystem . 9 2.4 CAS functionalities for cryptography education . ...... 10 2.5 TheRSAalgorithminSage . 16 2.6 Extending Sage’s cryptographic functionalities . ........ 17 3 The Shift Cryptosystem ......................... 19 3.1 Congruence and congruence classes . 19 3.2 Plaintext and ciphertext alphabets . .. 22 3.3 Encryption and decryption functions . .. 22 3.4 Cryptanalysis ............................... 23 3.5 ExampleSageusage ........................... 26 4 The Affine Cryptosystem ........................ 31 4.1 Greatestcommondivisors . 31 4.2 Multiplicativegroups . .. .. 33 4.3 Encryption and decryption functions . .. 36 4.4 Cryptanalysis ............................... 37 4.5 ExampleSageusage ........................... 38 5 Simplified Data Encryption Standard ................. 43 5.1 TheS-DESsecretkeys .......................... 44 5.2 Encryption and decryption functions . .. 46 5.3 ExampleSageusage ........................... 50 vii 6 Mini Advanced Encryption Standard ................. 55 6.1 Structureoffinitefields. 56 6.2 The Mini-AES irreducible polynomial . .. 57 6.3 ComponentsofMini-AES . 58 6.4 Encryption and decryption functions . .. 63 6.5 ExampleSageusage ........................... 64 7 Conclusions and Future Work ...................... 71 Appendix A Sage Manual for Shift Cryptosystem ........... 73 A.1 Classdocumentation . 73 A.2 Publicmethods .............................. 77 A.3 Privatemethods.............................. 91 Appendix B Sage Manual for Affine Cryptosystem .......... 95 B.1 Classdocumentation . .. .. 95 B.2 Publicmethods .............................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    190 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us