Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Codes, Ciphers, and Cryptography-Ch 1 Michael A. Karls Ball State University.

Similar presentations


Presentation on theme: "1 Codes, Ciphers, and Cryptography-Ch 1 Michael A. Karls Ball State University."— Presentation transcript:

1 1 Codes, Ciphers, and Cryptography-Ch 1 Michael A. Karls Ball State University

2 2 Introduction Throughout history, people have had the need to send messages to other people in secret! Methods have been developed to disguise and break secret messages.

3 3 Introduction (cont.) Simon Singh has written The Code Book with two goals:  Chart the evolution of codes throughout history—just like an organism, codes evolve, with new ones being developed as old ones are broken! (Think of bacteria and antibiotics!)  Show the relevance of cryptography in the world today— the world relies on secure transmission of data to run smoothly ( , phone, cable TV, internet, online shopping, banking, military communication, law enforcement, intelligence gathering, etc.).

4 4 Introduction (cont.) In this course we will read and discuss Chapters 1-8 of Singh’s book and look at some of the mathematics related to cryptography, codes and ciphers! Let’s start with some terminology.

5 5 Definitions and Terminology A code is a form of secret communication in which a word or phrase is replaced with a word, number, or symbol. Example 1: A simple code for an army.  “Attack at dawn”  Jupiter.  “The coast is clear”  Tippy-toe.  Each commander and soldier would have a copy of the codes in some sort of codebook.

6 6 Definitions and Terminology (cont.) A cipher is a form of secret communication in which letters are replaced with a letter, number, or symbol. Example 2: One example of a cipher is to replace each letter using the following scheme:  Plaintext:“attack at dawn”  Ciphertext:“ZGGZXP ZG WZDM  Send ciphertext as ZGG ZXP ZGW ZDM.  Recipient would need to know how message was created. Plaintextabcdefghijklmnopqrstuvwxyz CiphertextZYXWVUTSRQPONMLKJIHGFEDCBA

7 7 Definitions and Terminology (cont.) Cryptography is the science of concealing the meaning of a message. It is also used to mean the science of anything connected with ciphers—an alternative to cryptology, which is the science of secret writing. To encrypt a message, one conceals the meaning of the message via a code or cipher. Similar definitions hold for encode and encipher. To decrypt a message, one turns an ecrypted message back into the original message. Similar definitions hold for decode and decipher.

8 8 Definitions and Terminology (cont.) Remark: The words “cryptography” and “cryptology” come from the Greek words   (kryptos)  “hidden”   (logos)  “word” or “reason”   (graphia)  “writing”

9 9 Definitions and Terminology (cont.) Steganography is the science of hiding the existence of a message. “Steganography” also comes from Greek:   (steganos)  “covered” Both steganography and cryptography were developed in parallel—examples of both have been found in the 5 th century B.C.

10 10 Examples of Steganography Invisible ink (1 st century A.D. – present):  Use organic fluid such as lemon juice or milk to write a message on paper.  Heat the paper and the writing will turn brown. Hard-boiled eggs (16 th century Italy):  Mix alum and vinegar to make ink.  Write on hard-boiled egg.  Writing will penetrate shell and leave message on hardened egg white surface!

11 11 Examples of Steganography (cont.) Square grid (grille) method (16 th century Italy – 20 th century)  Invented by Girolamo Cardano.  Text is placed on a grid.  Add in random letters to fill grid.  To read message, put cover with correct openings onto the grid.  Variant: Use words instead of letters and add in random words to fill in grid.  See Edgar Allen Poe’s article “A Few Words on Secret Writing’, Graham’s Magazine, July 1841, pp me s s a ge rcme wsto skpa bgea rcme wsto skpa bgea

12 12 Examples of Steganography (cont.) Computer files (20 th century – present)  Add data to a file, such as a JPEG image (picture).  Send via or post to the internet on a web page.  Message undetectable without appropriate software.  Related idea: Watermarking is the addition of identifying information into items such as checks.  Digital watermarking is used to embed copyright information into video, music, and text data. Note: Steganography is a great way to send a message in secret—provided it is not found—then anyone can read the message!

13 13 Cryptography! We now look at cryptography—the main topic of Singh’s book (and of this course)! Cryptography can be split into two branches— transposition ciphers and substitution ciphers. A transposition cipher is a system of encryption in which the letters in a message are rearranged. A substitution cipher is a system of encryption in which letters in a message are replaced with other letters or symbols.

14 14 Examples of Transposition Ciphers Scytale (“SITalee) (Sparta – 5 th century) Sender and receiver have batons of equal circumference. Wrap a strip of leather around baton and write message along length of the baton. Unroll the strip and carry! Question: How would one decipher an intercepted scytale message?

15 15 Examples of Transposition Ciphers (cont.) Turning Grille Method (Variant of Cardano’s method above—used by German intelligence in South America in WWII).  Put text in an 8 x 8 grid, with 16 openings cut in an overlay grid.  When rotated 90 o, 180 o, 270 o, all 64 spaces will be exposed exactly once.  Example from article by Stephen Fratini, Mathematics Magazine, Volume 75, #5, December 2002, pp (Handout).

16 16 Examples of Substitution Ciphers Caesar Cipher (1 st Century B.C. – used by Julius Caesar to encrypt letters sent to Cicero).  Basic Idea: The cipher alphabet is the plain alphabet shifted n spaces right.  For example, if we take n = 14, we get:  Plaintext:“attack at dawn”  Ciphertext:“OHHOQY OH ROKB” Plaintextabcdefghijklmnopqrstuvwxyz CiphertextOPQRSTUVWXYZABCDEFGHIJKLMN

17 17 Examples of Substitution Ciphers (cont.) Keyword Cipher  Use a keyword or phrase as the basis of the encryption scheme.  For example, let MATHEMATICS be the keyword.  Remove repeated letters in the keyword and add in remaining letters of alphabet in order.  MATHEMATICS  MATHEICS Plaintextabcdefghijklmnopqrstuvwxyz CiphertextMATHEICSBDFGJKLNOPQRUVWXYZ

18 18 Examples of Substitution Ciphers (cont.) Rearrangement Cipher  Rearrange letters of alphabet in any order.  Thus, the Caesar and keyword ciphers are special cases of the rearrangement cipher!  Question: How many different rearrangement ciphers are there?  To answer this question, we need the Fundamental Principle of Counting!

19 19 Examples of Substitution Ciphers (cont.) Fundamental Principle of Counting (FPC):  If there are  n 1 choices for item 1  n 2 choices for item 2 ……  n m choices for item m  then the number of ways to choose one of each item is n1 x n2 x... x n m.

20 20 Examples of Substitution Ciphers (cont.) Example 3: How many outfits can I make with 4 shirts, 3 pairs of pants, and 5 pairs of shoes?  # shirt choices:4  # pants choices:3  # shoe choices:5  FPC => 4 x 3 x 5 = 60 outfits

21 21 Examples of Substitution Ciphers (cont.) To figure out how many different rearrangement ciphers there are, we can use FPC:  # choices for ciphertext letter for a:26  # choices for ciphertext letter for b:25 ……  # choices for ciphertext letter for y:2  # choices for ciphertext letter for z:1  FPC => 26 x 25 x … x 2 x 1 = 26!, or about 4.03 x different ciphers

22 22 Examples of Substitution Ciphers (cont.) Additive Cipher  Using the idea of modular arithmetic, we can create a cipher! For any non-negative integers a and n, we define a mod n to be the remainder when a is divided by n. Example 4:  18 mod 5 = 3, since 18 = 3 x  4 mod 7 = 4, since 4 = 0 x  28 mod 26 = 2, since 28 = 1 x  26 mod 13 = 0, since 26 = 2 x

23 23 Examples of Substitution Ciphers (cont.) We can add and multiply numbers mod n too! Example 5: Find (27+15) mod 26 and (27 x 15) mod 26.  = 42 and 42 mod 26 = 16,  so (27+15) mod 26 = 16  or  27 mod 26 = 1 and 15 mod 26 = 15,  so (27+15) mod 26 = (1+15) mod 26 = 16 mod 26 = 16  27 x 15 = 405 and 405 mod 26 = 15,  so (27 x 15) mod 26 = 15  or  (27 x 15) mod 26 = (1 x 15) mod 26 = 15 mod 26 = 15

24 24 Examples of Substitution Ciphers (cont.) To find (a+b) mod n:  Add a to b, then find the resulting sum mod n,  Or find a mod n, find b mod n, and add the results mod n.  Multiplication works in a similar fashion! Now we are ready to make an additive cipher!

25 25 Examples of Substitution Ciphers (cont.) First, assign 1, 2, …, 26 mod 26 to a, b, …, z. Next, choose a fixed integer m between 0 and 25. To get the ciphertext y from plaintext x, add m mod 26, i.e., y = (x+m) mod 26. As an example, here is the additive cipher alphabet for m=14. Plaintextabcdefghijklm Plaintext # Ciphertext # CiphertextOPQRSTUVWXYZA Plaintextnopqrstuvwxyz Plaintext # Ciphertext # CiphertextBCDEFGHIJKLMN

26 26 Examples of Substitution Ciphers (cont.) Continuing the additive cipher example with m = 14, to encipher the plaintext letter e, we do the following:  e  5  (5+14) mod 26 = 19 mod 26 = 19  19  S  Thus, plaintext e is enciphered as ciphertext S. To decipher ciphertext S, we add the additive inverse of 14 mod 26, which is 12:  S  19  (19+12) mod 26 = 5  5  e  Thus, ciphertext S is deciphered as plaintext e. Question: What does the additive cipher look like? Answer: Caesar cipher! (The Caesar cipher is also called the additive cipher!)

27 27 Notes on Ciphers For any cipher there is an algorithm, which is a general encrypting method, and a key which specifies the exact details of the algorithm. Example 6: For the Caesar cipher,  Algorithm—shift the alphabet,  Key—how many places to shift!  Thus, there are 26 keys for this cipher.

28 28 Notes on Ciphers (cont.) The key must remain secure!  If the key is found, the code will be broken.  If the algorithm is known, the code can still be secure!  For a code or cipher, the greater the number of keys, the greater the security!

29 29 Notes on Ciphers (cont.) The examples of substitution ciphers we’ve seen are called monoalphabetic substitution ciphers. The systems we’ve seen are symmetric because sender and receiver must both know (have) the key.


Download ppt "1 Codes, Ciphers, and Cryptography-Ch 1 Michael A. Karls Ball State University."

Similar presentations


Ads by Google