Cryptography Kinder Garden Number theory and Classical Cryptosystems Dr. Monther Aldwairi New York Institute of Technology- Amman Campus 10/10/2010 INCS.

Slides:



Advertisements
Similar presentations
Cryptology  Terminology  plaintext - text that is not encrypted.  ciphertext - the output of the encryption process.  key - the information required.
Advertisements

Fubswrjudskb Frxuvh qxpehu: / Lqvwuxfwru:Lyrqd Ehcdnryd Wrgdb’v Wrslfv: 1.Orjlvwlfv: -Fodvv olvw -Vboodexv 2. Wkh Pdwk 3. Zkdw lv Fubswrjudskb.
CSE331: Introduction to Networks and Security Lecture 19 Fall 2002.
The Integers and Division. Outline Division: Factors, multiples Exercise 2.3 Primes: The Fundamental Theorem of Arithmetic. The Division Algorithm Greatest.
22C:19 Discrete Structures Integers and Modular Arithmetic
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
ENGG2013 Unit 11 Row-Rank Feb,
EEC 688/788 Secure and Dependable Computing Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
1 Day 04- Cryptography Acknowledgements to Dr. Ola Flygt of Växjö University, Sweden for providing the original slides.
Introduction to Symmetric Block Cipher Jing Deng Based on Prof. Rick Han’s Lecture Slides Dr. Andreas Steffen’s Security Tutorial.
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering.
Overview of Cryptography and Its Applications Dr. Monther Aldwairi New York Institute of Technology- Amman Campus INCS741: Cryptography.
Chapter 2 Basic Encryption and Decryption (part B)
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
CS526Topic 2: Classical Cryptography1 Information Security CS 526 Topic 2 Cryptography: Terminology & Classic Ciphers.
Section 2.9 The Hill Cipher; Matrices
L1.1. An Introduction to Classical Cryptosystems Rocky K. C. Chang, February 2013.
3.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 3 Traditional Symmetric-Key Ciphers.
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
CS555Spring 2012/Topic 61 Cryptography CS 555 Topic 6: Number Theory Basics.
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
Integers Number Theory = Properties of Integers
Classical Monoalphabetic Ciphers Day 2. Keyword cipher Select a keyword, if the keyword has any repeated letters, drop all but the first occurrence. Write.
Chapter 2 Basic Encryption and Decryption. csci5233 computer security & integrity 2 Encryption / Decryption encrypted transmission AB plaintext ciphertext.
Section 2.2: Affine Ciphers; More Modular Arithmetic Practice HW (not to hand in) From Barr Textbook p. 80 # 2a, 3e, 3f, 4, 5a, 7, 8 9, 10 (Use affinecipherbreaker.
Mathematics of Cryptography Part I: Modular Arithmetic
3.4/3.5 The Integers and Division/ Primes and Greatest Common Divisors Let each of a and b be integers. We say that a divides b, in symbols a | b, provided.
MATH 224 – Discrete Mathematics
1 University of Palestine Information Security Principles ITGD 2202 Ms. Eman Alajrami 2 nd Semester
Computer System Security CSE 5339/7339
Section 2.1: Shift Ciphers and Modular Arithmetic The purpose of this section is to learn about modular arithmetic, which is one of the fundamental mathematical.
Lec. 5 : History of Cryptologic Research II
Topic 21 Cryptography CS 555 Topic 2: Evolution of Classical Cryptography CS555.
Section 2.1: Shift Ciphers and Modular Arithmetic Practice HW from Barr Textbook (not to hand in) p.66 # 1, 2, 3-6, 9-12, 13, 15.
Chapter The Integers and Division Division
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
Rather than just shifting the alphabet Could shuffle (jumble) the letters arbitrarily Each plaintext letter maps to a different random cipher text letter.
Symmetric-Key Cryptography
9/03/15UB Fall 2015 CSE565: S. Upadhyaya Lec 2.1 CSE565: Computer Security Lecture 2 Basic Encryption & Decryption Shambhu Upadhyaya Computer Science &
Cryptography Lecture 2: Classic Ciphers Piotr Faliszewski.
1 University of Palestine Information Security Principles ITGD 2202 Ms. Eman Alajrami.
Part 9, Basic Cryptography 1. Introduction A cryptosystem is a tuple: ( M,K,C, E,D) where M is the set of plaintexts K the set of keys C the set of ciphertexts.
Introduction to Ciphers Breno de Medeiros. Cipher types From “Cipher”, Wikipedia article.
Some Number Theory Modulo Operation: Question: What is 12 mod 9?
Cryptography Part 1: Classical Ciphers Jerzy Wojdyło May 4, 2001.
1 Cryptanalysis Four kinds of attacks (recall) The objective: determine the key ( Herckhoff principle ) Assumption: English plaintext text Basic techniques:
Part 9, Basic Cryptography 1. Introduction A cryptosystem is a tuple: ( M,K,C, E,D) where M is the set of plaintexts K the set of keys C the set of ciphertexts.
Traditional Symmetric-Key Ciphers
Section 2.2: Affine Ciphers; More Modular Arithmetic Shift ciphers use an additive key. To increase security, we can add a multiplicative parameter. –For.
Chapter 2 (Part 1): The Fundamentals: Algorithms, the Integers & Matrices The Integers and Division (Section 2.4)
22C:19 Discrete Structures Integers and Modular Arithmetic Fall 2014 Sukumar Ghosh.
Lecture 23 Symmetric Encryption
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Network Security Lecture 13 Presented by: Dr. Munam Ali Shah.
CS526Topic 2: Classical Cryptography1 Information Security CS 526 Topic 2 Cryptography: Terminology & Classic Ciphers.
1 Classical Encryption Techniques. 2 Symmetric cipher model –Cryptography –Cryptanalysis Substitution techniques –Caesar cipher –Monoalphabetic cipher.
Ch04-Number Theory and Cryptography 1. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic.
Introduction to Cryptography Hyunsung Kim, PhD University of Malawi, Chancellor College Kyungil University February, 2016.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 4. Traditional and Modern.
Chapter 3 The Fundamentals: Algorithms, the integers, and matrices Section 3.4: The integers and division Number theory: the part of mathematics involving.
Revision. Cryptography depends on some properties of prime numbers. One of these is that it is rather easy to generate large prime numbers, but much harder.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
Substitution Ciphers.
Chapter 2 Basic Encryption and Decryption
Introduction to Cryptography
Cryptography and Network Security
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Classical Ciphers – 2 CSCI284 Spring 2004 GWU
Presentation transcript:

Cryptography Kinder Garden Number theory and Classical Cryptosystems Dr. Monther Aldwairi New York Institute of Technology- Amman Campus 10/10/2010 INCS 741: Cryptography 10/4/20091Dr. Monther Aldwairi

Basic Number Theory 10/4/20092Dr. Monther Aldwairi

Divisibly Definition Let a and b be integers with a≠0 a divides b if there is an integer q such that b=aq a divides b is denoted by a|b, Proposition 1.For every a≠0, a|0, a|a and 1|b 2.If a|b and b|c, then a|c 3.If a|b and a|c, then a|(sb+tc) for all integers s, t. 10/4/20093Dr. Monther Aldwairi

Prime Numbers Definition A number a >1 is a prime number if it is only divisible by 1 and itself. Examples: 2, 3, 5, 7, 11, 13 ―Numbers that are not prime are composites = (ab) Theorem Every positive integer can be expressed as a unique multiplication of prime numbers raised to different powers Example 504= Corollary Assuming p is prime, If p|abc…z then p must divide one of the factors a, b, c, …, z 10/4/20094Dr. Monther Aldwairi

Greatest Common Divisor (GCD) Definition The greatest common divisor of a and b is the largest positive integer dividing both a and b and is denoted by gcd(a,b) Examples: gcd(12,15)=3, gcd(13,7)=1 ―a and b are relatively prime if the gcd(a,b) =1 Euclidean Algorithm Suppose a>b a =q 1 b + r 1 b =q 2 r 1 + r 2 r 1 =q 3 r 2 + r 3,until r k-1 =q k+1 r k,then gcd(a,b)=r k 10/4/20095Dr. Monther Aldwairi

Congruence Modulo operation 6 mod 4 = 2 or 6 ≡ 2 (mod 4) read 6 is congruent to 2 mod 4 Definition Let a, r, m ∈ Ζ (where Ζ is a set of all integers) and m≠0. a ≡ r (mod m), if m|(a – r) m is called the modulus. r is called the remainder ‒ In other words, a and r differ by multiple of m a = q · m + r 0 ≤ r < m 10/4/20096Dr. Monther Aldwairi

Congruence /cont. Propositions 1.a ≡ a (mod m) 2.a ≡ 0 (mod m) if and only if m|a 3.a ≡ r (mod m) if and only if r ≡ a (mod m) 4. If a ≡ r and r ≡ c (mod m), then a ≡ c (mod m) Examples 12 ≡ 7 mod 5 9 ≡ 3 (mod 6) if and only if 3 ≡ 9 (mod 6) 14 ≡ 8 and 8 ≡ 2 (mod 6), then 14 ≡ 2 (mod m) 10/4/20097Dr. Monther Aldwairi

Modular Arithmetic Work on the set of integers mod m, denoted as Z m ={0,1,2,…, m-1} and perform addition, subtraction and multiplication with congruencies Proposition Let a,b,c,d,m ∈ Ζ with m≠0. and suppose a ≡ b (mod m), and c ≡ d (mod m), then a+c ≡ b+d (mod m), a ‒ c ≡ b ‒ d (mod m), ac ≡ bd (mod m) If the result of addition or multiplication is larger than m ‒ 1 take the Modula Example: m = 9  Ζ 9 = {0, 1, 2, 3, 4, 5, 6, 7, 8} = 14 ≡ 5 mod 9 6 × 8 = 48 ≡ 3 mod 9 10/4/20098Dr. Monther Aldwairi

Modular Arithmetic Properties Z m 1. The additive identity is 0: a + 0 = a 2. The additive inverse of a is -a = m – a s.t. a + (-a) ≡ 0 mod m 3. Addition is closed i.e if a, b ∈ Ζ m then a + b ∈ Ζ m 4. Addition is commutative a + b = b + a 5. Addition is associative (a + b) + c = a + (b + c) 6. Multiplicative identity is 1: a × 1 ≡ a mod m 7. The multiplicative inverse of a exists if gcd(a, m) = 1 and denoted as a -1 s.t. a -1 × a ≡ 1 mod m 8. Multiplication is closed i.e if a, b ∈ Ζ m then a × b ∈ Ζ m 9. Multiplication is commutative a × b = b × a 10. Multiplication is associative (a × b) × c = a × (b × c) 10/4/20099Dr. Monther Aldwairi

Division If a and m are relatively prime we can divide both sides of the congruence by a. If gcd(a,m) =1 then their exist a multiplicative inverse for a mod m denoted as a -1. Example: What does the division 4/5 mod 7 mean? 4/5 mod 7 ≡ 4 × 5 -1 mod 7 Does 5 -1 mod 7 exist ? It exists because gcd(5,7) = mod 7 = 3 therefore, 4/5 mod 7= 4 × 3 = 12 mod 7 ≡ 5 mod 7 10/4/200910Dr. Monther Aldwairi

Linear Equations Proposition Let a,b,c,m ∈ Ζ with m≠0 If ab ≡ ac (mod m), Then b ≡ c (mod m) only if gcd(a,m)=1 Example: Solve 2x+11 ≡ 5 (mod 15) 2x ≡ ‒ 6 (mod 15) gcd(2,15)=1 then division is allowed x ≡ ‒ 3 ≡ 12(mod 15) 10/4/200911Dr. Monther Aldwairi

Exponentiation Proposition The modulo operation can be applied whenever we want (a + b) mod m = [(a mod m) + (b mod m) ] mod m (a × b) mod m = [(a mod m) × (b mod m) ] mod m Exponentiation Example Example: 3 8 mod 7 = ? 3 8 mod 7 = 6561 mod 7 = 2 since 6561 = 937 × Or 3 8 = 3 4 × 3 4 = 3 2 × 3 2 × 3 2 × mod 7 = [(3 2 mod 7)×(3 2 mod 7)×(3 2 mod 7)×(3 2 mod 7)] mod mod 7 = 2 × 2 × 2 × 2 mod 7 = 16 mod 7 = 2 10/4/200912Dr. Monther Aldwairi

Substitution Ciphers Monoalphabetic Ciphers Classical Crypto Systems 10/4/200913Dr. Monther Aldwairi

Conventions plaintext in lowercase and CIPHERTEXT in caps Letters of the alphabet and assigned number as follows Spaces and punctuation are omitted Makes decryption easier Gives information about the structure of the message Spaces would dominate the leter fequency counts 10/4/200914Dr. Monther Aldwairi

Shift Cipher Shift each letter by k places, k is the key Let P = C = K= Ζ 26 and x ∈ P, y ∈ C, k ∈ K Encryption: y=E k (x) = x + k mod 26. Decryption: x=D k (y) = x ‒ k mod 26. When k = 3 the shift cipher is called Caesar Cipher. Example Let the key k = 3 Plaintext : x = A T T A C K = (0, 19, 19, 0, 2, 10). Ciphertext : y = (0+3 mod 26, 19+3 mod 26, …) y = (3, 22, 22, 3, 5, 13) = D W W D F N 10/4/200915Dr. Monther Aldwairi

Attacks on Shift Cipher Known plaintext, chosen plain text or ciphertext easily break the Shift Cipher Ciphertext only; Eve has two choice 1.Exhaustive search, only 25 possible keys 2.Frequency count if the message is long enough – In english e is by far the most common letter, then T,A,R,N,I,O, S. 10/4/200916Dr. Monther Aldwairi

Affine Cipher The key k = (α, β) and α, β ∈ Ζ 26 – Assume gcd(α,26)=1 – α ∈ {1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25} Encryption: E k (x) = y = α · x + β (mod 26). Example: k = (α, β) = (3, 2)  y = 3x +2 Plaintext : X = A T T A C K = (0, 19, 19, 0, 2, 10). Ciphertext : Y = (3×0 + 2 mod 26, 3×19+2 mod 26, …) Y = (2, 7, 7, 2, 8, 6) = C H H C I G Decryption: Dk(y) = x = α -1 ( y – β) (mod 26). 10/4/200917Dr. Monther Aldwairi

Attacks on Affine Cipher 12 choice of α and 26 choices for β  312 keys. Ciphertext only: exhaustive search or frequency analysis Known plaintext: two letters in the plaintext and corresponding ciphertext letters would suffice to find the key. Example : plaintext: IF=(8, 5) and ciphertext PQ=(15, 16) 8 · α + β ≡ 15 mod 26 5 · α + β ≡ 16 mod 26 ⇒ α = 17 and β = 9 Chosen plaintext ab  y 1 = α · 0 + β  y 2 = α + β Chosen ciphertext AB yields the decryption function 10/4/200918Dr. Monther Aldwairi

Frequency Count Cryptanalysis key concept - monoalphabetic substitution ciphers do not change relative letter frequencies calculate letter frequencies for ciphertext compare counts/plots against known values 10/4/200919Dr. Monther Aldwairi

English Letters Frequencies 10/4/200920Dr. Monther Aldwairi

Ployalphabetic Ciphers Substitution Ciphers Classical Crypto Systems 10/4/200921Dr. Monther Aldwairi

Ployalphabetic Ciphers Designed to flatten the frequency distribution by using multiple encryption functions Example E 1 (x)= 3x (mod 26), E 2 (x)=5x+13 (mod 26) Encrypt odd positioned letters using E 1 and even positioned letters using E 2 Ultimately, have 26 different functions Use a keyword to know what function to use 10/4/200922Dr. Monther Aldwairi

Vigenère Cipher Multiple caesar ciphers Use a key to select which alphabet is used for each letter of the message – key is multiple letters long K = k 1 k 2... K d 1.write the plaintext out 2.write the keyword repeated above it with numeral values 3.use each key letter as a caesar cipher key 4.encrypt the corresponding plaintext letter 5.keyword deceptive (3,4,2,4,15,19,8,21,4) k: deceptivedeceptivedeceptive p: wearediscoveredsaveyourself c: ZICVTWQNGRZGVTWAVZHCQYGLMGJ 10/4/200923Dr. Monther Aldwairi

10/4/2009Dr. Monther Aldwairi24

Attacks on Vigenère Cipher Chosen plaintext will easily yield the key – Try aaaaaaa…. – With enough known plaintext k=y-x Chosen ciphertext try AAAAA… results in key negative Known ciphertext only – Find the key length – Find the key 10/4/200925Dr. Monther Aldwairi

Finding The Key Write the ciphertext twice (under each other) with one shifted by the potential key length. Mark repeated letters (matching the letter below) and count the number of coincidences The shift with the most repeated coincidences is the best guess for the key length Now examine the frequencies for 1 st, 10 th, 19 th … and 2 nd, 11 th,20 th … 10/4/200926Dr. Monther Aldwairi

Shift Shift of 4 ZICVTWQNGRZGVTWAVZHCQYGLMGJ 2 Shift 9 ZICVTWQNGRZGVTWAVZHCQYGLMGJ 3 10/4/2009Dr. Monther Aldwairi27

Letter Frequencies in Cryptanalysis Most common letters in English e, t, a, o, i, n, s, h, r Other letters are fairly rare: z, q, x, j, k, v Guess the most common such as E and use it to figure the key Verify the key is correct by making sure rare letters have low frequencies Tables of common pairs/triple letters?! 10/4/200928Dr. Monther Aldwairi

Letter Pairs Tables Entry 12 in row WR column means that combination appears 12 times Entry 14 in N row and W column means NW appears 14 times 10/4/200929Dr. Monther Aldwairi

Letter Pairs (Digrams) Most common was W, B, R, S, I  W=e The vowels a, i, o tend to avoid each other ‒ S, I, P 80% of letters that precede n are vowels (WSIP) ‒ R, A The letter h often appears before e and rarely after it ‒ N=h Most common combination is th ‒ B=t Continue the analysis 10/4/200930Dr. Monther Aldwairi

Transportation Ciphers An encryption in which the letters of the plaintext are rearranged. Columnar Transportation as an example The plaintext are arranged into n rows The resulting ciphertext is formed by traversing the columns x 1 x 4 x 7 x 2 x 1 … Use key to rearrange columns 10/4/200931Dr. Monther Aldwairi

Block Ciphers In Stream ciphers every letter plaintext corresponds to a letter in CIPHERTEXT such as shift and Affine Block ciphers encrypt a block of letters to overcome this problem. – DES operates on 64 bit and AES on 128 bit blocks Electronic Codebook (ECB) mode converts a block of plaintext to a block of CIPHERTEXT independently and at onetime. Cipher Block Chaining (CBC) and Cipher Feedback (CFB) modes use feedback from cipher block to encrypt subsequent blocks. 10/4/200932Dr. Monther Aldwairi

Playfair Cipher /Key The key is a word with repeated letters removed – Schoolbus  Scholbu A 5 × 5 matrix based on the key is constructed with the remaining alphabets with( i and j) treated as one letter. 10/4/200933Dr. Monther Aldwairi

Playfair Cipher/E k (x) Remove spaces and divide plaintext into groups of two letters. – If double letters insert x and regroup – Add extra x to complete the last group?! – dinner is ready  di nx ne ri sr ea dy 1.If both letters fall in the same row, replace each with letter to right – “ea" becomes“BD“ 2.If both letters fall in the same column, replace each with the letter below it – “dy" encrypts as “KO“ 3.Otherwise each letter is replaced by the one in its row in the column of the other letter of the pair – “di" encrypts as “AK“ 10/4/200934Dr. Monther Aldwairi

Playfair Cipher Security Susceptible to frequency count attacks – Count common digrams! 26 × 26 = 676 digrams table – Corresponds to the English most common digrams such as: th, he, an, in, re, es Each letter has only 5 possible corresponding ciphertext letters (4 in row and one below) Common pairs XY and YX giveup corners of rectangles with er and re (most common digrams) 10/4/200935Dr. Monther Aldwairi

Hill Cipher/E k (x) Example: Let n=3 and the key is an n × n matrix whose entries are integers in Ζ 26. and the plaintext be ABC = (0, 1, 2) then the encryption operation is a vector-matrix multiplication  AXW 10/4/200936Dr. Monther Aldwairi

Hill Cipher/D k (y) In order to decrypt we need the inverse of key matrix M, which is Multiple the encrypted text by the inverse N  ABC 10/4/200937Dr. Monther Aldwairi

Matrix Inverse in mod m For a matrix M to have in Inverse mod m. gdc(Determinant(M), m) = 1 ? 10/4/200938Dr. Monther Aldwairi

Hill Cipher Security CIPHERTEXT only is difficult! – Changing one letter in plaintext changes n letters in CIPHERTEXT making frequency count less effective. Known plaintext attack can easily find M given n Chosen plaintext of baa.., abaa...,…, aa…b – i.e. chosentext = I – CIPHERTEXT=M Chosen CIPHERTEXT of BAA.., ABAA…,…, AA…B – i.e. CIPHERTEXT = I – plaintext=N 10/4/200939Dr. Monther Aldwairi

Shannon Properties of a Good Cryptosystem Diffusion – Changing one character in plaintext results in several ciphertext changing and visa versa. – Hill Cipher has that property Confusion – The key doesn’t relate in a simple way to ciphertext. Each character of the ciphertext should depend on several parts of the key. – In Hill Cipher one character in ciphertext depends on a key matrix column 10/4/200940Dr. Monther Aldwairi

One-Time Pads Unbreakable cryptosystem! Represent the message as binary (ASCII) – E k (x)=K+x mod 2 – E k (x)=K x – Decryption uses the same key D k (y)=K y – Key is used once and discarded Unbreakable for a ciphertext only attack. Known plain and cipher texts reveal the one time key only. Which is never used again 10/4/200941Dr. Monther Aldwairi

One-Time Pad Issues Keys generation and exchange – Long and expensive to transmit – Pseudo random number generators are not secure One way functions such as DES and SHA – x j =f(s+j) for j =1,2,3… – b j is the least significant bit of x j. 10/4/200942Dr. Monther Aldwairi

One-Time Pad Issues Keys generation and exchange – Long and expensive to transmit – Pseudo random number generators are not secure One way functions such as DES and SHA – x j =f(s+j) for j =1,2,3… – b j is the least significant bit of x j. 10/4/200943Dr. Monther Aldwairi