Vigvisual: a Visualization Tool for the Vigenère Cipher
Total Page:16
File Type:pdf, Size:1020Kb
VIGvisual: A Visualization Tool for the Vigenère Cipher Can Li, Jun Ma, Jun Tao, Melissa Keranen Chaoli Wang Jean Mayo, Ching-Kuang Department of Mathematical Department of Computer Shene Sciences Science & Engineering Department of Computer Michigan Technological University of Notre Dame Science University Notre Dame, IN Michigan Technological Houghton, MI [email protected] University [email protected] Houghton, MI {canli,junm,junt,jmayo,shene}@mtu.edu ABSTRACT Well designed pedagogical tools are very useful in help- This paper describes a visualization tool VIGvisual that helps ing students understand concepts and practice needed skills. students learn and instructors teach the Vigen`ere cipher. While there are tools available [1, 2, 9], most of them only The software allows the user to visualize both encryption provide interfaces for encryption and decryption without showing the process, and very few include cryptanalysis. and decryption through a variety of cipher tools. The demo VIGvisual mode is useful and efficient for classroom presentation. The is designed to address this issue by providing an practice mode allows the user to practice encryption and environment so that it can be used in the classroom and decryption. VIGvisual is quite versatile, providing support for self-study. It is able to animate the Vigen`ere cipher for both beginners learning how to encrypt and decrypt, with a variety of cipher tools, all of which are available for and also for the more advanced users wishing to practice students to practice encryption and decryption with error checking. Furthermore, VIGvisual also helps students learn cryptanalysis in the attack mode. Classroom evaluation of VIGvisual the tool was positive. how to break the Vigen`ere cipher. uses Kasiski’s method and the Index of Coincidence method for keyword length estimation, and the χ2 method with frequency graphs Categories and Subject Descriptors for keyword recovery. To the best of our knowledge, only [2] K.3.2 [Computers and Education]: Computer and In- offers a similar capability; however, it is just an interactive formation Science Education—Computer science education, cryptanalysis environment. VIGvisual goes one step further information systems education by offering a more comprehensive visualization component with tools and animation not only for cryptanalysis but also for beginners to learn and practice the Vigen`ere cipher. General Terms In the following, Section 2 discusses the course in which Algorithms, Security VIGvisual was used and evaluated, Section 3 presents an overview of VIGvisual, Section 4 has our findings from a class- Keywords room evaluation, and Section 5 is our conclusion. Cryptography; visualization 2. COURSE INFORMATION VIGvisual was used in a cryptography course, MA3203 In- 1. INTRODUCTION troduction to Cryptography, that is offered out of the De- The Vigen`ere cipher appeared in the 1585 book Traict´e partment of Mathematical Sciences at Michigan Technolog- des Chiffres by Blaise de Vigen`ere. It is a simple cipher, ical University. It is a junior level course that gives a basic but for nearly three centuries the Vigen`ere cipher had not introduction to the field of cryptography. This course cov- been broken until Friedrich W. Kasiski published his 1863 ers classical cryptography, the Data Encryption Standard book [7]. Charles Babbage also broke the cipher with a (DES), the Advanced Encryption Standard (AES), the RSA similar technique in 1846, although he never published his algorithm, discrete logarithms, hash functions, and elliptic work. Currently, the Vigen`ere cipher has become a standard curve cryptography. For each cryptosystem, we study how it topic in many textbooks [4, 8, 10]. was designed, why it works, how one may attack the system, and how it has been used in practice. Understanding classical cryptography is essential to any Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee providedthat copies are not made or distributed introductory cryptography course, and one of the major clas- for profit or commercial advantage and that copies bear this notice and the full cita- sical cryptosystems is the Vigen`ere cipher. The Vigen`ere ci- tion on the first page. Copyrights for componentsof this work owned by others than pher is a generalization of the monoalphabetic shift cipher, ACM must be honored. Abstracting with credit is permitted. To copyotherwise, or re- which has a keyword length of one. This cipher is very dif- publish, to post on servers or to redistribute to lists, requires prior specific permission ficult to present in class because of the long pieces of text and/or a fee. Request permissions from [email protected]. that need to be used in order to illustrate the algorithm in a ITiCSE’15, July 6–8, 2015, Vilnius, Lithuania. VIGvisual Copyright c 2015 ACM 978-1-4503-3440-2/15/07...$15.00. meaningful way. Because was used in the course, DOI: http://dx.doi.org/10.1145/2729094.2742589. students were able to see the encryption algorithm demon- strated quickly. This allowed for a more thorough study of the most interesting aspects of the cipher, which are the decryption techniques and attacks. The attack component covers Kasiski’s method, the index of coincidence method, and the χ2 method. 3. SOFTWARE DESCRIPTION VIGvisual supports Linux, MacOS and Windows and has three modes, Demo, Practice and Attack. The Demo mode helps the user visualize the process of encryption and decryp- tion with animation. The Practice mode allows the user to practice encryption and decryption with error checking. The Attack mode offers a chance for the user to learn how (a) Vigen`ere Table to break the Vigen`ere cipher with Kasiski’s and the Index of Coincidence (IOC) methods, followed by the χ2 method to recover the unknown keyword. 3.1 The Demo Mode VIGvisual starts with the Demo mode (Figure 1). The top portion has input fields for plaintext, keyword and cipher- (c) Saint Cyr Slide text. The user starts a new session with New and enters a plaintext-keyword pair or a ciphertext-keyword pair, or uses RandPT and RandCT to automatically generate a random plaintext-keyword pair and a random ciphertext-keyword (b) Cipher Disk pair. This is followed by clicking Encrypt or Decrypt to encrypt or decrypt the entered message. By default, the key- Figure 2: Cipher Tools word is repeated and aligned with the original word struc- ture. Clicking Align switches to the view of breaking the can be moved left or right. The table rows and columns, plaintext/ciphertext to align with the keyword length. the movable disk and the bottom slide change according to the triplet of plaintext letter, keyword letter and ciphertext letter. Thus, the instructor has a demo tool for classroom use and the students have a clear view of how the Vigen`ere cipher performs encryption and decryption. 3.2 The Practice Mode Click the Practice tab to enter the Practice mode (Fig- ure 3). All three tools are available. The user clicks Encrypt or Decrypt to start a new session, and uses Random to gener- ate a random plaintext-keyword or ciphertext-keyword pair, New to start a new session, Redo to redo the current session, and Align to align the plaintext or ciphertext using the key- word length. Then, the user enters a keyword (if Random is Figure 1: Screenshot of the Demo Mode not chosen) followed by the expected ciphertext or plaintext. The user may stop at anywhere and click the Check button The user uses Start and Stop to start and stop an anima- to check the result. Incorrect letters are marked in red or tion, the slider to select an animation speed, and Pre and with question marks if the positions are left as blank. The Next to move to the previous and next position. The cor- Answer field shows the correct answer. responding plaintext letter, keyword letter and ciphertext letter are shown in different colors in an animation. The user may bring up one or more tools with buttons Ta- ble, Disk and Slide. Figure 2(a) shows the Vigen`ere table. The plaintext letter under consideration and its column use one color, the corresponding keyword letter and its row use a different one, and the ciphertext letter is at the intersec- tion of the plaintext column and keyword row. The cipher disk has two concentric disks stacked together (Figure 2(b)). The bottom (resp., top) disk, the stationary (resp., movable) one, represents the plaintext (resp., ciphertext) letters and is fixed (resp., rotatable). The user rotates the movable disk so that the keyword letter aligns with the letter A of the stationary disk. Then, the corresponding plaintext and ci- phertext letters align together. Figure 2(c) has the Saint Cyr Slide. The upper part is fixed while the lower part Figure 3: Screenshot of the Practice Mode 3.3 The Attack Mode Click the Attack button to enter the Attack mode. The user clicks Random to randomly generate a ciphertext or New to start a new session and enter a new ciphertext (Fig- ure 4). The process of breaking a message has two steps: keyword length estimation and keyword recovery. This pro- cess may not always be successful, and several iterations may be needed. VIGvisual has several Hint buttons in all windows under the Attack tab, each of which brings up a hint win- dow to either explain what the window and/or algorithm is or provide a chance for the user to do simple exercises. (a) Top Portion (b) Bottom Portion Figure 5: Screenshot of the Kasiski Window by the same letter with an IOC close to 0.068. To apply this idea, for each 1 ≤ k ≤ n, we may divide the ciphertext into k cosets, calculate the IOC of each coset, and calculate the average of the k IOC values.