Cryptography

Total Page:16

File Type:pdf, Size:1020Kb

Cryptography Cryptography Prof. Dr. Carsten Damm Dr. Henrik Brosenne University of Goettingen Institut of Computer Science Winter 2013/2014 Table of Contents Classical Cryptography Substitution Ciphers Transposition Ciphers Elementary Cryptanalysis Published Worksheet Published worksheet 02 substitution ciphers. Classical cryptosystems Classical cryptosystems act on characters (not bits or bytes). The main building blocks Substitution of characters by others. Transpositions, i.e. rearranging of character positions. Sometimes combinations of Substitutions and Transpositions. Notation Notation plaintext alphabet A ciphertext alphabet A0 0 ai denotes i-th letter from plaintext alphabet in its natural order (similarily ai ) m = m1m2 ::: sequence of plaintext letters c = c1c2 ::: sequence of ciphertext letters enciphering keys K or k deciphering keys K 0 or k0 enciphering map EK deciphering map DK 0 We will consider 4 types of substitution ciphers. Each of them easily seen to be symmetric ciphers: there is an efficient algorithm producing the deciphering key from the enciphering key. Simple substitution ciphers this is a monographic (substitution of single characters by single characters) and monoalphabetic substitution (each occurence of some ai is replaced by 0 0 the same ciphertext letter aj ): key = mapping A!A key = list of substitutions under the ordering of the plaintext alphabet, in case A = A0 it specifies a permutation π for A = A0 = the classical alphabet a key could be specified like this: K = ULOIDTGKXYCRHBPMZJQVWNFSAE keyspace is as large as 26!, nevertheless simple substitutions ciphers are easy to break formula: ci = π(mi ) Example Plaintext (paragraph from Kohel's book after passing it through the map π): SUPPOSETHATWEFIRSTENCODEAMESSAGEBYPURGINGALLNONALPHABETI CCHARACTERSEGNUMBERSSPACESANDPUNCTUATIONANDCHANGINGALLCH ARACTERSTOUPPERCASETHENTHEKEYSIZEWHICHBOUNDSTHESECURITYO FTHESYSTEMISALPHABETICCHARACTERSTHEREFORETHETOTALNUMBERO FKEYSISOFENORMOUSSIZENEVERTHELESSWEWILLSEETHATSIMPLESUBS TITUTIONISVERYSUSCEPTIBLETOCRYPTANALYTICATTACKS Key: ULOIDTGKXYCRHBPMZJQVWNFSAE simple substitution ciphertext: QWMMPQDVKUVFDTXJQVDBOPIDUHDQQUGDLAMWJGXBGURRBPBURMKULDVX OOKUJUOVDJQDGBWHLDJQQMUODQUBIMWBOVWUVXPBUBIOKUBGXBGURROK UJUOVDJQVPWMMDJOUQDVKDBVKDCDAQXEDFKXOKLPWBIQVKDQDOWJXVAP TVKDQAQVDHXQURMKULDVXOOKUJUOVDJQVKDJDTPJDVKDVPVURBWHLDJP TCDAQXQPTDBPJHPWQQXEDBDNDJVKDRDQQFDFXRRQDDVKUVQXHMRDQWLQ VXVWVXPBXQNDJAQWQODMVXLRDVPOJAMVUBURAVXOUVVUOCQ Easy statistical attack based on observation that frequencies of ciphertext symbols correspond to frequencies of plaintext letters under the above key, D is most frequent in ciphertext Special cases Affine ciphers numerically encode letters A, B,..., Z as elements f0,1,. ,25g = Z26 := Z=26Z then operate on letters by transformations of the form x 7! ax + b for any a coprime to 26 key = (a; b) ci = a ∗ mi + b (mod 26)) Translation ciphers special case of affine cipher with a = 1, also called shift cipher) or additive cipher (e.g. Caesar's cipher) Exercise 6 1 How many affine ciphers are there on the classical alphabet? 2 Read about ROT13 cipher and it's uses. 3 Vzcyrzrag gur EBG13 pvcure va Fntr. 4 Someone says: \OK, let's agree on this substitution system. But to improve it, we better double the key size and double-encrypt messages (encipher plaintext by first key, and afterwards encipher result by second key)." Good idea? 5 Consider a cryptosystem with plaintext alphabet = ciphertext alphabet. A key in that system is called involutoric if double-encryption with same key gives the plaintext. ROT13 is an example. Involutoric keys are convenient, but also weak in some sense. I How many involutoric keys are there for the translation ciphers? I How many involutoric keys are there for affine ciphers? I Find some involutoric but non-affine keys for general substitution ciphers on the classical alphabet. Try to estimate the number of such keys by constructing as many as possible involutions. Homophonic ciphers Homophonic ciphers precondition: #A0 > #A advanced variant of substitution ciphers: each plaintext letter can be replaced by any one of a set of ciphertext letters still monographic (single letters replaced by single characters from A0) thus: key = partition of A0 into #A sets for the classical alphabet: partition A0 into 26 blocks, key = ordered list of blocks enciphering: ai is replaced by random element from ith block 8i : ci 2 fπ1(mi ); π2(mi )g depending on choice, same plaintext can result in several ciphertexts! deciphering: element from ith block is deciphered as ith plaintext letter Example A0 = Klingonian alphabet, which contains 52 characters, as we all know The font is not available, so we represent each Klingonian letter simply by a pair of classical letters (corresponding to the pronunciation . ) and we arrange them in two rows, that specify our homophonic key: ABCDEFGHIJKLMNOPQRSTUVWXYZ LV MJ CW XP QO IG EZ NB YH UA DS RK TF MJ XO SL PE NU FV TC QD RK YH GW AB ZI UD PY KG JN SH MC FT LX BQ EI VR ZA OW XP HO DJ CY RN ZV WT LA SF BM GU QK IE To encipher the π-encoded message ALWAYSLOOKONTHEBRIGHTSIDEOFLIFE, we replace occurrences of ai by either the lower or the upper Klingonian pair in the ith key column The following are legal encipherings of the message: 1 LVRKYHLVABZVRKHOHOVRHOXPWTLXQOMJNUYHFTNBTCFVYHJNQOHOMCZABQMCSH 2 UDZAYHUDQKZVZAHOXODSXOMJTCLXSHMJRNBQFTNBWTZVBQXPQOHOIGZABQMCSH 3 LVRKYHUDQKZVRKXOXODSHOXPTCLXQOPYRNBQEZNBTCFVBQXPSHHOIGZAYHMCSH 4 LVZABMUDABFVRKHOHODSHOXPWTLXQOPYRNBQEZNBTCZVBQXPQOXOIGZABQMCQO The high frequency of E in plaintext is distributed among several ciphertext letters Polyalphabetic substitution ciphers Polyalphabetic substitution ciphers in a way similar to homphonic ciphers (several keys) but choice of key is not random but based on the position of the character in the plaintext ci = πf (i)(mi ) special case are periodic substitution ciphers: substitute the i-th plaintext letter using the (i (mod t))-th key ci = πf (i (mod t))(mi ) t is called the period: each t-th character is enciphered by the same simple substitution cipher the shorter the period, the weaker the system Example: Vigen`erecipher The Vigen`erecipher is a periodic translation cipher. each key specifies an affine translation identify the standard alphabet with Z=26Z = f0; 1; :::; 25g ci = (mi + k(i (mod t))) (mod 26) Message \Human salvation lies in the hands of the creatively maladjusted." Gives the encoded plaintext HUMANSALVATIONLIESINTHEHANDSOFTHECREATIVELYMALADJUSTED With key UVLOID enciphering performs the column additions. HUMANS ALVATI ONLIES INTHEH ANDSOF THECRE ATIVEL YMALAD JUSTED UVLOID UVLOID UVLOID UVLOID UVLOID UVLOID UVLOID UVLOID UVLOID -------------------------------------------------------------- BPXOVV UGGOBL IIWWMV CIEVMK UIOGWI NCPQZH UOTJMO SHLZIG DPDHMG Example: Running Key Cipher and Auto Key Cipher Running key cipher key K = k1k2::: is a long stream of letters 2 f0; 1; :::; 25g, non-periodic ci = mi + ki best would be completely random letters in the key stream (Vernam cipher to be talked about later), but makes key exchange inconvenient popular key agreements like this: Alice in Wonderland, start reading at page 5, bottom line ciphertext C = c1c2 ::: is defined by ci = mi + ki (mod 26) Autokey cipher, similar but the key stream consists of a short keyword k1k2:::k` with the plaintext(!) appended: k1k2:::kt m1m2::: ci = mi + ki (mod 26) for i ≤ ` else ci = mi + mi−` (mod 26) History polyalphabetic substitutions were suggested by Alberti mid of the 15th century tool: slide rules or adjustable metal discs containing the alphabet in unshifted and shifted version: ...XYZABCDEFGHIJKLMNOPQRSTUVWXYZABC... ...ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF... Vigen`ere'scipher was first described by Bellaso a cryptologist in the service of the pope in the 16th century idea: specify key by a single word it was later misattributed to Vigen`ere,who instead invented the autokey cipher Vigen`ereciphers are reported to have been in military use until about 1940 (Wikipedia) this type of ciphers was successful for a long time Example: Rotor machine an electro-mechanical device for stream enciphering the plaintext implements a sophisticated polyalphabetic substitution cipher, main ideas: I each rotor defines a simple substitution I after substituting a single character the rotor moves one cycle step, thus giving a period of 26 I the next rotor applies another substitution but the cycle step is performed only after the previous one cycled for 26 steps 2 3 I thus two, three, . rotors give a period of 26 ; 26 ; ::: in use between 1920{1970 after its invention the design got to be known (some systems where patented, some where perhaps analyzed by secret service acitivities) the key consists of the sequence of rotor substitutions and the initial state of the system The Enigma starting substitution P (an arbitrary permutation of the alphabet!) defined by a plugboard 3 rotors: after being substituted by right, middle and left rotors (R; M; L) the symbol was “reflected” by a special rotor U in fixed position after passing the reflector U the symbol went again through rotors 3, 2, 1 doing their inverse substitutions L−1; M−1; R−1 and finally through the inverse plugboard substitution P−1 (see Wikipedia http://en.wikipedia.org/wiki/Enigma machine) if ρ is the cyclic permutation (A! B! C ! ... ! A) and if i; j; k are the actual cycle positions of the rotors the overall substitution in this situation reads as i −i j −j k −k EP;i;j;k =P(ρ Rρ )(ρ Mρ )(ρ Lρ )U (ρk L−1ρ−k )(ρj M−1ρ−j )(ρi R−1ρ−i )P−1 The Enigma Some details omitted. there where
Recommended publications
  • Enhancing the Security of Caesar Cipher Substitution Method Using a Randomized Approach for More Secure Communication
    International Journal of Computer Applications (0975 – 8887) Volume 129 – No.13, November2015 Enhancing the Security of Caesar Cipher Substitution Method using a Randomized Approach for more Secure Communication Atish Jain Ronak Dedhia Abhijit Patil Dept. of Computer Engineering Dept. of Computer Engineering Dept. of Computer Engineering D.J. Sanghvi College of D.J. Sanghvi College of D.J. Sanghvi College of Engineering Engineering Engineering Mumbai University, Mumbai, Mumbai University, Mumbai, Mumbai University, Mumbai, India India India ABSTRACT communication can be encoded to prevent their contents from Caesar cipher is an ancient, elementary method of encrypting being disclosed through various techniques like interception plain text message into cipher text protecting it from of message or eavesdropping. Different ways include using adversaries. However, with the advent of powerful computers, ciphers, codes, substitution, etc. so that only the authorized there is a need for increasing the complexity of such people can view and interpret the real message correctly. techniques. This paper contributes in the area of classical Cryptography concerns itself with four main objectives, cryptography by providing a modified and expanded version namely, 1) Confidentiality, 2) Integrity, 3) Non-repudiation for Caesar cipher using knowledge of mathematics and and 4) Authentication. [1] computer science. To increase the strength of this classical Cryptography is divided into two types, Symmetric key and encryption technique, the proposed modified algorithm uses Asymmetric key cryptography. In Symmetric key the concepts of affine ciphers, transposition ciphers and cryptography a single key is shared between sender and randomized substitution techniques to create a cipher text receiver. The sender uses the shared key and encryption which is nearly impossible to decode.
    [Show full text]
  • Simple Substitution Cipher Evelyn Guo
    Simple Substitution Cipher Evelyn Guo Topic: Data Frequency Analysis, Logic Curriculum Competencies: • Develop thinking strategies to solve puzzles and play games • Think creatively and with curiosity and wonder when exploring problems • Apply flexible and strategic approaches to solve problems • Solve problems with persistence and a positive disposition Grade Levels: G3 - G12 Resource: University of Cambridge Millennium Mathematics Project - NRICH https://nrich.maths.org/4957 Cipher Challenge Toolkit https://nrich.maths.org/7983 Practical Cryptography website http://practicalcryptography.com/ciphers/classical-era/simple- substitution/ Materials: Ipad and Laptop which could run excel spreadsheet. Flip Chart with tips and hints for different levels of players Booklet flyers for anyone taking home. Printed coded message and work sheet (help sheet) with plain alphabet and cipher alphabet (leave blank) Pencils Extension: • Depends on individual player’s interest and math abilities, introduce easier (Atbash Cipher, Caesar Cipher) or harder ways ( AutoKey Cipher) to encrypt messages. • Introduce students how to use the practical cryptography website to create their own encrypted message instantly. • Allow players create their own cipher method. • Understand in any language some letters tend to appear more often than other letters Activity Sheet for Substitution Cipher Opening Question: Which Letters do you think are the most common in English? Start by performing a frequency analysis on some selected text to see which letters appear most often. It is better to use longer texts, as a short text might have an unusual distribution of letters, like the "quick brown fox jumps over the lazy dog" Introduce the Problem: In the coded text attached, every letter in the original message was switched with another letter.
    [Show full text]
  • Simple Substitution and Caesar Ciphers
    Spring 2015 Chris Christensen MAT/CSC 483 Simple Substitution Ciphers The art of writing secret messages – intelligible to those who are in possession of the key and unintelligible to all others – has been studied for centuries. The usefulness of such messages, especially in time of war, is obvious; on the other hand, their solution may be a matter of great importance to those from whom the key is concealed. But the romance connected with the subject, the not uncommon desire to discover a secret, and the implied challenge to the ingenuity of all from who it is hidden have attracted to the subject the attention of many to whom its utility is a matter of indifference. Abraham Sinkov In Mathematical Recreations & Essays By W.W. Rouse Ball and H.S.M. Coxeter, c. 1938 We begin our study of cryptology from the romantic point of view – the point of view of someone who has the “not uncommon desire to discover a secret” and someone who takes up the “implied challenged to the ingenuity” that is tossed down by secret writing. We begin with one of the most common classical ciphers: simple substitution. A simple substitution cipher is a method of concealment that replaces each letter of a plaintext message with another letter. Here is the key to a simple substitution cipher: Plaintext letters: abcdefghijklmnopqrstuvwxyz Ciphertext letters: EKMFLGDQVZNTOWYHXUSPAIBRCJ The key gives the correspondence between a plaintext letter and its replacement ciphertext letter. (It is traditional to use small letters for plaintext and capital letters, or small capital letters, for ciphertext. We will not use small capital letters for ciphertext so that plaintext and ciphertext letters will line up vertically.) Using this key, every plaintext letter a would be replaced by ciphertext E, every plaintext letter e by L, etc.
    [Show full text]
  • Cryptography in Modern World
    Cryptography in Modern World Julius O. Olwenyi, Aby Tino Thomas, Ayad Barsoum* St. Mary’s University, San Antonio, TX (USA) Emails: [email protected], [email protected], [email protected] Abstract — Cryptography and Encryption have been where a letter in plaintext is simply shifted 3 places down used for secure communication. In the modern world, the alphabet [4,5]. cryptography is a very important tool for protecting information in computer systems. With the invention ABCDEFGHIJKLMNOPQRSTUVWXYZ of the World Wide Web or Internet, computer systems are highly interconnected and accessible from DEFGHIJKLMNOPQRSTUVWXYZABC any part of the world. As more systems get interconnected, more threat actors try to gain access The ciphertext of the plaintext “CRYPTOGRAPHY” will to critical information stored on the network. It is the be “FUBSWRJUASLB” in a Caesar cipher. responsibility of data owners or organizations to keep More recent derivative of Caesar cipher is Rot13 this data securely and encryption is the main tool used which shifts 13 places down the alphabet instead of 3. to secure information. In this paper, we will focus on Rot13 was not all about data protection but it was used on different techniques and its modern application of online forums where members could share inappropriate cryptography. language or nasty jokes without necessarily being Keywords: Cryptography, Encryption, Decryption, Data offensive as it will take those interested in those “jokes’ security, Hybrid Encryption to shift characters 13 spaces to read the message and if not interested you do not need to go through the hassle of converting the cipher. I. INTRODUCTION In the 16th century, the French cryptographer Back in the days, cryptography was not all about Blaise de Vigenere [4,5], developed the first hiding messages or secret communication, but in ancient polyalphabetic substitution basically based on Caesar Egypt, where it began; it was carved into the walls of cipher, but more difficult to crack the cipher text.
    [Show full text]
  • Amy Bell Abilene, TX December 2005
    Compositional Cryptology Thesis Presented to the Honors Committee of McMurry University In partial fulfillment of the requirements for Undergraduate Honors in Math By Amy Bell Abilene, TX December 2005 i ii Acknowledgements I could not have completed this thesis without all the support of my professors, family, and friends. Dr. McCoun especially deserves many thanks for helping me to develop the idea of compositional cryptology and for all the countless hours spent discussing new ideas and ways to expand my thesis. Because of his persistence and dedication, I was able to learn and go deeper into the subject matter than I ever expected. My committee members, Dr. Rittenhouse and Dr. Thornburg were also extremely helpful in giving me great advice for presenting my thesis. I also want to thank my family for always supporting me through everything. Without their love and encouragement I would never have been able to complete my thesis. Thanks also should go to my wonderful roommates who helped to keep me motivated during the final stressful months of my thesis. I especially want to thank my fiancé, Gian Falco, who has always believed in me and given me so much love and support throughout my college career. There are many more professors, coaches, and friends that I want to thank not only for encouraging me with my thesis, but also for helping me through all my pursuits at school. Thank you to all of my McMurry family! iii Preface The goal of this research was to gain a deeper understanding of some existing cryptosystems, to implement these cryptosystems in a computer programming language of my choice, and to discover whether the composition of cryptosystems leads to greater security.
    [Show full text]
  • Affine Cipher Project 1 Introduction
    Affine Cipher Project 141KECBZ0H5CRK1HUZK1CGPCR.5PUGUZU1WCU.CM1CUBHUCAK.6.Z5WCP1RK1UCH5 WC0EPU1KECU.C141KEC.UB1KXC,,RBHKV1PCWGRQ15P7CHCUHV1C.6CU9.CRGUG1P Directions: • Answer all numbered questions completely. • Show non-trivial work, and put your final answer in the box provided. • Questions without boxes should be answered in complete sentences in the space provided. 1 Introduction Cryptography is the study of secret codes, or the secure transmission of information that nobody except the desired recipient can read. By the end of this project, you will be able to decipher the quote printed above. The mathematical study of ciphers will lead us through a world in which the number line is a closed curve, and fractions do not exist. This project is designed to help you to: • read and understand definitions and notation • observe patterns and generalize • think logically, analytically, and abstractly • express problems and solutions precisely • follow examples • combine ideas to solve problems and create applications 1 2 Caesar Cipher A cipher is a function or algorithm for translating plaintext into encrypted ciphertext. Throughout history, governments and merchants have used ciphers to safely transmit sensitive information. Julius Caesar is said to have use a simple system of substituting each letter with the letter 3 spots over, wrapping around the alphabet if necessary. Here is the mapping: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z # # # # # # # # # # # # # # # # # # # # # # # # # # D E F G H I J K L M N O P Q R S T U V W X Y Z A B C Space and punctuation are discarded.
    [Show full text]
  • Codebusters Coaches Institute Notes
    BEING COVER AGENT FIXED DELAY, PILOT RIGHT PLANE, CATCH SMALL RADIO (CODEBUSTERS) This is the first year CodeBusters will be a National event. A few changes have been made since the North Carolina trial event last year. 1. The Atbash Cipher has been added. 2. The running key cipher has been removed. 3. K2 alphabets have been added in addition to K1 alphabets 4. Hill Cipher decryption has been added with a given decryption matrix. 5. The points scale has been doubled, but the timing bonus has been increased by only 50% in order to further balance the test. 1 TYPES OF PROBLEMS 1.1 ARISTOCRAT (EASY TO HARD DIFFICULTY) http://www.cryptograms.org/tutorial.php An Aristocrat is the typical Crypto-quote you see in the newspaper. Word spaces are preserved. No letter will stand for itself and the replacement table is given as a guide (but doesn’t need to be filled in by the team to get credit). FXP PGYAPYF FIKP ME JAKXPT AY FXP GTAYFMJTGF THE EASIEST TYPE OF CIPHER IS THE ARISTOCRAT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Frequency 4 1 6 3 1 2 2 2 6 3 3 4 Replacement I F T A Y C P O E R H S 1.2 ARISTOCRATS WITH SPELLING AND/OR GRAMMAR ERRORS (MEDIUM TO VERY HARD DIFFICULTY) For these, either words will be misspelled or grammatical errors introduced. From a student perspective, it is what they might expect when someone finger fumbles a text message or has a bad voice transcription.
    [Show full text]
  • A Cipher Based on the Random Sequence of Digits in Irrational Numbers
    https://doi.org/10.48009/1_iis_2016_14-25 Issues in Information Systems Volume 17, Issue I, pp. 14-25, 2016 A CIPHER BASED ON THE RANDOM SEQUENCE OF DIGITS IN IRRATIONAL NUMBERS J. L. González-Santander, [email protected], Universidad Católica de Valencia “san Vicente mártir” G. Martín González. [email protected], Universidad Católica de Valencia “san Vicente mártir” ABSTRACT An encryption method combining a transposition cipher with one-time pad cipher is proposed. The transposition cipher prevents the malleability of the messages and the randomness of one-time pad cipher is based on the normality of "almost" all irrational numbers. Further, authentication and perfect forward secrecy are implemented. This method is quite suitable for communication within groups of people who know one each other in advance, such as mobile chat groups. Keywords: One-time Pad Cipher, Transposition Ciphers, Chat Mobile Groups Privacy, Forward Secrecy INTRODUCTION In cryptography, a cipher is a procedure for encoding and decoding a message in such a way that only authorized parties can write and read information about the message. Generally speaking, there are two main different cipher methods, transposition, and substitution ciphers, both methods being known from Antiquity. For instance, Caesar cipher consists in substitute each letter of the plaintext some fixed number of positions further down the alphabet. The name of this cipher came from Julius Caesar because he used this method taking a shift of three to communicate to his generals (Suetonius, c. 69-122 AD). In ancient Sparta, the transposition cipher entailed the use of a simple device, the scytale (skytálē) to encrypt and decrypt messages (Plutarch, c.
    [Show full text]
  • The Mathemathics of Secrets.Pdf
    THE MATHEMATICS OF SECRETS THE MATHEMATICS OF SECRETS CRYPTOGRAPHY FROM CAESAR CIPHERS TO DIGITAL ENCRYPTION JOSHUA HOLDEN PRINCETON UNIVERSITY PRESS PRINCETON AND OXFORD Copyright c 2017 by Princeton University Press Published by Princeton University Press, 41 William Street, Princeton, New Jersey 08540 In the United Kingdom: Princeton University Press, 6 Oxford Street, Woodstock, Oxfordshire OX20 1TR press.princeton.edu Jacket image courtesy of Shutterstock; design by Lorraine Betz Doneker All Rights Reserved Library of Congress Cataloging-in-Publication Data Names: Holden, Joshua, 1970– author. Title: The mathematics of secrets : cryptography from Caesar ciphers to digital encryption / Joshua Holden. Description: Princeton : Princeton University Press, [2017] | Includes bibliographical references and index. Identifiers: LCCN 2016014840 | ISBN 9780691141756 (hardcover : alk. paper) Subjects: LCSH: Cryptography—Mathematics. | Ciphers. | Computer security. Classification: LCC Z103 .H664 2017 | DDC 005.8/2—dc23 LC record available at https://lccn.loc.gov/2016014840 British Library Cataloging-in-Publication Data is available This book has been composed in Linux Libertine Printed on acid-free paper. ∞ Printed in the United States of America 13579108642 To Lana and Richard for their love and support CONTENTS Preface xi Acknowledgments xiii Introduction to Ciphers and Substitution 1 1.1 Alice and Bob and Carl and Julius: Terminology and Caesar Cipher 1 1.2 The Key to the Matter: Generalizing the Caesar Cipher 4 1.3 Multiplicative Ciphers 6
    [Show full text]
  • With Answers
    Module 10.4: Exploring Some Historical Ciphers Gregory V. Bard January 30, 2020 • This is a practice workbook the Affine Cipher, touching on some shift ciphers (such as the Caesar cipher, the ROT-13 cipher), the Atbash cipher, and the Vigen`ereCipher. • The Affine Cipher was introduced in Module 10-2: The Basics of Modular Arithmetic, and some skills from Module 10-3: Modular Inverses are needed. • There is a with-answers version, and a without-answers version. • In the with-answers version of this workbook, the black ink represents the question, and the blue ink represents the answer. Question 10-4-1 Suppose Boris normally communicates with his handlers in Moscow using the affine cipher, and the encryption function c = fB(p) = 7p + 20 mod 26, while Natasha normally uses c = fN (p) = 11p + 8 mod 26. They have a very secret message to send back to Moscow, so they're going to encrypt the message twice, for added security. As you can probably guess, this is equivalent to using the affine cipher only once, but with a different function. • If Boris encrypts the plaintext first, followed by Natasha second, then what would BAT encrypt to? (B, A, T) becomes (1, 0, 19) and encrypts to (fB(1); fB(0); fB(19)) ≡ (1; 20; 23). We encrypt again to (fN (1); fN (20); fN (23)) ≡ (19; 20; 1), which becomes (T, U, B) or TUB. • If Natasha encrypts the plaintext first, followed by Boris second, then what would BAT encrypt to? (B, A, T) becomes (1, 0, 19) and encrypts to (fN (1); fN (0); fN (19)) ≡ (19; 8; 9).
    [Show full text]
  • MAT 302: LECTURE SUMMARY Last Class We Discussed Two Classical Ciphers, Both of Which Turned out to Be Rather Insecure (As Evide
    MAT 302: LECTURE SUMMARY Last class we discussed two classical ciphers, both of which turned out to be rather insecure (as evidenced by your cracking them manually during lecture): • The Scytale cipher • The Caesar (aka shift) cipher We began today’s lecture by writing the latter down in mathematical notation. To this end, it is convenient to use the set A = f0; 1; 2;:::; 25g to represent the English alphabet, i.e. 0 represents A, 1 represents B, etc. The Caesar Cipher. The Caesar cipher (or shift cipher) consists of a key k 2 Z, an encryption function ek : A −! A x 7−! x + k (mod 26) and a decryption function dk : A −! A x 7−! x − k (mod 26): The Caesar cipher is insecure because the space of all possible keys is rather small (how many are there?), so it is a trivial matter for Oscar to check all possible keys. We next discussed a variant of this, whose key space is somewhat larger: the affine cipher. The Affine Cipher. The affine cipher consists of a key (a; b) 2 Z2, an encryption function e(a;b) : A −! A x 7−! ax + b (mod 26) and a decryption function d(a;b) : A −! A x 7−! a−1(x − b) (mod 26) Actually, as stated this isn’t well-defined: a−1 doesn’t always exist (mod 26). Recall that a−1 is the element of A satisfying a−1a ≡ 1 (mod 26): For example, 0 has no (multiplicative) inverse (mod 26). Less trivially, 2 has no multiplicative inverse.
    [Show full text]
  • Index-Of-Coincidence.Pdf
    The Index of Coincidence William F. Friedman in the 1930s developed the index of coincidence. For a given text X, where X is the sequence of letters x1x2…xn, the index of coincidence IC(X) is defined to be the probability that two randomly selected letters in the ciphertext represent, the same plaintext symbol. For a given ciphertext of length n, let n0, n1, …, n25 be the respective letter counts of A, B, C, . , Z in the ciphertext. Then, the index of coincidence can be computed as 25 ni (ni −1) IC = ∑ i=0 n(n −1) We can also calculate this index for any language source. For some source of letters, let p be the probability of occurrence of the letter a, p be the probability of occurrence of a € b the letter b, and so on. Then the index of coincidence for this source is 25 2 Isource = pa pa + pb pb +…+ pz pz = ∑ pi i=0 We can interpret the index of coincidence as the probability of randomly selecting two identical letters from the source. To see why the index of coincidence gives us useful information, first€ note that the empirical probability of randomly selecting two identical letters from a large English plaintext is approximately 0.065. This implies that an (English) ciphertext having an index of coincidence I of approximately 0.065 is probably associated with a mono-alphabetic substitution cipher, since this statistic will not change if the letters are simply relabeled (which is the effect of encrypting with a simple substitution). The longer and more random a Vigenere cipher keyword is, the more evenly the letters are distributed throughout the ciphertext.
    [Show full text]