Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to Cryptology

Similar presentations


Presentation on theme: "An Introduction to Cryptology"— Presentation transcript:

1 An Introduction to Cryptology

2 Cryptology Is defined as the science of making communication incomprehensible to all people except those who have a right to read it and understand it.

3 Two parts of Cryptology
Cryptography – which concerns itself with the secrecy system itself and its design. Cryptanalysis – which concerns itself with the breaking of the secrecy system above.

4 History Cryptography mainly started out for military, secret agents, and war. Computer communications via Internet, wireless and mobile devices.

5 Terms Code- a set of information that will allow words to be changed to other s or symbols Plaintext – the message that you wish to put into secret form. Plaintext is usually written in all lowercase letters without spaces. Example: “I will meet you at 5 PM in the mall” Plaintext: “iwillmeetyouatfivepminthemall” Cipher – the method for altering the plaintext

6 Terms Ciphertext – the secret version of the plaintext.
Encipher – changing from plaintext to ciphertext. Decipher – changing from ciphertext to plaintext Key – information that will allow someone to encipher the plaintext and also decipher the ciphertext.

7 Monoalphabetic Substitution Ciphers
Every character in the plaintext message is replaced with a unique alternative character in the ciphertext message. Aka cryptogram

8 The Additive (Shift) Cipher System
Where each letter in the plaintext is replaced by a certain letter whose position is the same value away from each letter. Also known as a shift

9 An Introduction Caesar Ciphers

10 Cryptography Cryptography is the study and practice of hiding information. Caesar’s cipher is just one way to encrypt and decrypt information. It is too weak for real-world applications. There are many methods of cryptography that are much more foolproof than Caesar’s Cipher! Caesar is a Monoalphabetic Substitution Cipher also known as an Additive Cipher or Shift Cipher

11 Classic Cryptography Cryptography
“art or science concerning the principles, means and methods for rendering plain information unintelligible and for restoring encrypted information to intelligible form.” National Information System Security Glossary (NSTISSC) MESSAGE plaintext MESSAGE plaintext encode/encipher ciphertext decode/decipher ZXYCTHI algorithm algorithm

12 Basic Terminology plaintext - the original message
ciphertext - the coded message cipher - algorithm for transforming plaintext to ciphertext key - info used in cipher known only to sender/receiver encipher (encrypt) - converting plaintext to ciphertext decipher (decrypt) - recovering ciphertext from plaintext cryptography - study of encryption principles/methods cryptanalysis (codebreaking) - the study of principles/ methods of deciphering ciphertext without knowing key cryptology - the field of both cryptography and cryptanalysis Briefly review some terminology used throughout the course.

13 Caesar Cipher earliest known substitution cipher by Julius Caesar
first attested use in military affairs replaces each letter by 3rd letter later example: meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB Substitution ciphers form the first of the fundamental building blocks. The core idea is to replace one basic unit (letter/byte) with another. Whilst the early Greeks described several substitution ciphers, the first attested use in military affairs of one was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). Still call any cipher using a simple letter shift a caesar cipher, not just those with shift 3. Note: when letters are involved, the following conventions are used in this course: Plaintext is always in lowercase; ciphertext is in uppercase; key values are in italicized lowercase.

14 Caesar Wheel

15 Caesar Cipher can define transformation as:
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 mathematically give each letter a number 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 then have Caesar cipher as: C = E(p) = (p + k) mod (26) p = D(C) = (C – k) mod (26) This mathematical description uses modulo arithmetic (ie clock arithmetic). Here, when you reach Z you go back to A and start again. Mod 26 implies that when you reach 26, you use 0 instead (ie the letter after Z, or goes to A or 0). Example: howdy (7,14,22,3,24) encrypted using key f (5) is MTBID

16 Cryptanalysis of Caesar Cipher
only have 26 possible ciphers A maps to A,B,..Z could simply try each in turn a brute force search given ciphertext, just try all shifts of letters do need to recognize when have plaintext eg. break ciphertext “ERE L ORYH BRX DOLFH" With a caesar cipher, there are only 26 possible keys, of which only 25 are of any use, since mapping A to A etc doesn't really obscure the message! cf. basic rule of cryptanalysis "check to ensure the cipher operator hasn't goofed and sent a plaintext message by mistake"! Can try each of the keys (shifts) in turn, until can recognise the original message. See Stallings Fig 2.3 for example of search. Note: as mentioned before, do need to be able to recognise when have an original message (ie is it English or whatever). Usually easy for humans, hard for computers. Though if using say compressed data could be much harder. Example "GCUA VQ DTGCM" when broken gives "easy to break", with a shift of 2 (key C).

17 Symmetric Encryption or conventional / secret-key / single-key
sender and recipient share a common key all classical encryption algorithms are private-key was only type prior to invention of public-key in 1970’s All traditional schemes are symmetric / single key / private-key encryption algorithms, with a single key, used for both encryption and decryption, since both sender and receiver are equivalent, either can encrypt or decrypt messages using that common key.

18 The language of cryptography
Alice’s encryption key Bob’s decryption key K A K B encryption algorithm plaintext ciphertext decryption algorithm plaintext symmetric key crypto: sender, receiver keys identical public-key crypto: encryption key public, decryption key secret (private)

19 Two Types of Keyed Encryption
Symmetric Encryption plaintext ciphertext encryption algorithm decryption algorithm Asymmetric Encryption plaintext ciphertext encryption algorithm decryption algorithm

20 What is a Caesar Cipher? Caesar used to encrypt his messages using a very simple algorithm, which could be easily decrypted if you know the key. He would take each letter of the alphabet and replace it with a letter a certain distance away from that letter. When he got to the end, he would wrap back around to the beginning. Example with a shift of 3: I’m so sneaky! 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

21 The Problem with Caesar’s Cipher
It’s too easy to break! Let’s go back to our five letter alphabet. Say you had the word DBCA, but didn’t know the key. It would be easy to make a list of all possible keys. If you expected the unencrypted text to be in English, you could easily figure out which word was right: If you were using the full English alphabet, this would take longer, but for someone trying to find our your secret, it’s a small price to pay! Shift of 1 CABE Shift of 2 BEAD  The clear winner! Shift of 3 ADEC Shift of 4 ECDB How dare you insult my cipher! Though, you have a good point…

22 How Would You Program This?
It’s unbelievably simple! The mod function is one of the most basic components of a lot of programming languages. You’ll learn the mod function for python early on. That means all we have to deal with is indexing the letters. Believe it or not, this also is no problem. The solution lies in ASCII.

23 Numbers associated with letters? This sounds strangely familiar…
Wait, What’s ASCII? Computers have to represent everything as numbers, including things as basic as text. ASCII is the standard character encoding scheme, where each symbol is assigned a number. These symbols range from upper and lower case letters to numbers to things like punctuation and arrows. There are many tables online that allow you to look up the number associated with each symbol. Numbers associated with letters? This sounds strangely familiar…

24 The ASCII Table

25 Using ASCII for Caesar’s Cipher
You probably noticed that the letter A is associated with the number 65, B with 66, C with 67, and so on. Most programming languages have a function that can take a letter and find out it’s ASCII value. What would you need to do to make the ASCII encoded letters usable for Caesar’s Cipher? Subtract 65 from each letter! Since it’s really simple to code for a computer to use mod and assign the correct index for each letter, you can probably see how programming a simple encoder/decoder would be a cinch!

26 But I Don’t Want to Make a Table!
That’s fine! If you know what the shift is, you can use something called modulo, which is commonly shortened to mod. Let’s say we wanted to find 8 mod 5. We would divide 8 by 5 and find the remainder. So in this case, 8 mod 5 = 3. In this case, 5 is called the modulus. Can you solve these? 19 mod 5 2 mod mod 5

27 How Is That Helpful? When using a Caesar cipher, you assign each letter to an index starting from 0. You would then compute the following. (plain letter index + key) mod (total number of letters) This will give you the index of the encrypted letter! As you can see, the modulus is the total number of letters in the alphabet. For English, this modulus is 26. 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 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

28 A Simple Example Let’s say we have a 5 letter alphabet with only the letters A-E First, we assign each letter an index, starting from 0. We then have to choose a key. For this example, we’ll use 2. Let’s try encoding the word BEAD using the formula for the previous slide. The index of the letter B is 1. The key is 2. The modulus is 5, since the alphabet is 5 letters. Let’s use the algorithm: (1+2) = mod 5 = 3. The index of D is 3, so B would become the letter D. Using algorithm on each letter, can you encode the full word? DBCA A B C D E 1 2 3 4

29 Why Does Mod-ing Work? The mod accounts for wrapping back around once you reach the end of the alphabet. When converting the letter E using the key 2, you first add 4 + 2, which gives you 6. As you can see, the index 6 is beyond the scope of this alphabet. When you do 6 mod 5, you get the remainder of 1, which is how much you need to go back and count from the beginning of the alphabet. A B C D E 1 2 3 4

30 Caesar Cipher can define transformation as:
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 mathematically give each letter a number 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 then have Caesar cipher as: C = E(p) = (p + k) mod (26) p = D(C) = (C – k) mod (26) This mathematical description uses modulo arithmetic (ie clock arithmetic). Here, when you reach Z you go back to A and start again. Mod 26 implies that when you reach 26, you use 0 instead (ie the letter after Z, or goes to A or 0). Example: howdy (7,14,22,3,24) encrypted using key f (5) is MTBID

31 Keys Simple Caesar Cipher E(Lp) = (Lp + 3) mod 26
Generalized Caesar Cipher ECaesar(Lp, k) = (Lp + k) mod 26 Key “a sequence of random or pseudorandom bits used initially to set up and periodically change the operations performed in crypto-equipment for the purpose of encrypting or decrypting electronic signals...” -- National Information System Security Glossary (NSTISSC)

32 Encode Is the Caesar Cipher (keyed version) symmetric or asymmetric?
rot13(Lp) = ECaesar(Lp, 13) Note that rot13 = rot (i.e. rot13 decodes any message encoded with rot13) In general, what is DCaesar(Ln, k) in terms of ECaesar(Ln, k) ? Encode ECaesar(Lp, k) = (Lp + k) mod 26 Decode DCaesar(Lc, k) = code breaker Symmetric encryption is also known as key encryption, because the key must be kept private from…

33 A historical example of substitution cipher – shift (or Caesar) cipher
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 Choose k Shift all letters by k For example, if k = 5 A becomes F, B becomes G, C becomes H, and so on… What will replace X?

34 Modular arithmetic In the Caesar cipher, the following algorithm is used If n is the number of a letter in the alphabet, this letter is replaced by another letter, whose number is (n+k) modulo 26 (shortly (n+k) mod 26) This is a remainder of division of (n+k) by 26 For example, take k=5 and take letter X Its number n = 24 (n+k) mod 26 = mod 26 = 3 So X is replaced with C

35 Exercise Use shift cipher with k=7 to encrypt the text “TOP SECRET” (ignore space) Answer: TVW ZLJYLA

36 code breaker Cryptanalysis “operations performed in converting encrypted messages to plain text without initial knowledge of the crypto-algorithm and/or key employed in the encryption.” -- National Information System Security Glossary (NSTISSC) Common Cryptanalysis Attacks Attack Type Cryptanalysis Knowledge ciphertext only • encryption algorithm (less the key) • ciphertext to be deciphered known plaintext • encryption algorithm (less the key) • ciphertext to be deciphered • a segment of plaintext with corresponding ciphertext chosen plaintext • encryption algorithm (less the key) • ciphertext to be deciphered • a segment of plaintext selected by cryptanalyst with corresponding ciphertext How difficult is cryptanalysis on a keyed Caesar cipher?

37 What About Decoding? To decode, you do the following:
(cipher letter index – key + total number of letters) mod (total number of letters) Does anyone know why we can’t just do: (cipher letter index – key) mod (total number of letters)? By adding the total number of letters, you don’t have to end up taking the mod of a negative number. See if you can decode DBCA to get back to the word BEAD.

38 Cryptanalysis of Caesar Cipher
only have 26 possible ciphers A maps to A,B,..Z could simply try each in turn a brute force search given ciphertext, just try all shifts of letters do need to recognize when have plaintext eg. break ciphertext "GCUA VQ DTGCM" With a caesar cipher, there are only 26 possible keys, of which only 25 are of any use, since mapping A to A etc doesn't really obscure the message! cf. basic rule of cryptanalysis "check to ensure the cipher operator hasn't goofed and sent a plaintext message by mistake"! Can try each of the keys (shifts) in turn, until can recognise the original message. See Stallings Fig 2.3 for example of search. Note: as mentioned before, do need to be able to recognise when have an original message (ie is it English or whatever). Usually easy for humans, hard for computers. Though if using say compressed data could be much harder. Example "GCUA VQ DTGCM" when broken gives "easy to break", with a shift of 2 (key C).

39


Download ppt "An Introduction to Cryptology"

Similar presentations


Ads by Google