Introduction to Modular Arithmetic and Public Key Cryptography.

Slides:



Advertisements
Similar presentations
Number Theory Algorithms and Cryptography Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms.
Advertisements

RSA COSC 201 ST. MARY’S COLLEGE OF MARYLAND FALL 2012 RSA.
COMP 170 L2 Page 1 L06: The RSA Algorithm l Objective: n Present the RSA Cryptosystem n Prove its correctness n Discuss related issues.
Primality Testing Patrick Lee 12 July 2003 (updated on 13 July 2003)
22C:19 Discrete Structures Integers and Modular Arithmetic
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
Basic properties of the integers
Number Theory(L5) Number Theory Number Theory(L5).
1 The RSA Algorithm Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
The Algebra of Encryption CS 6910 Semester Research and Project University of Colorado at Colorado Springs By Cliff McCullough 20 July 2011.
Cryptography Lecture 11: Oct 12. Cryptography AliceBob Cryptography is the study of methods for sending and receiving secret messages. adversary Goal:
CSE115/ENGR160 Discrete Mathematics 03/17/11 Ming-Hsuan Yang UC Merced 1.
Theory of Computation Transparency No. 1-1 Chapter 2 Introduction to Number Theory and Its applications Cheng-Chia Chen October 2002.
Public Key Cryptography
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
Theory of Computation Transparency No. 1-1 Chapter 2 Introduction to Number Theory and Its applications Cheng-Chia Chen October 2005.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
Lecture 3.2: Public Key Cryptography II CS 436/636/736 Spring 2012 Nitesh Saxena.
Codes, Ciphers, and Cryptography-RSA Encryption
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
1 Introduction to Codes, Ciphers, and Cryptography Michael A. Karls Ball State University.
MATH 224 – Discrete Mathematics
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
CPSC 3730 Cryptography and Network Security
1 Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown Chapter 4 – Finite Fields.
Section 4.3: Fermat’s Little Theorem Practice HW (not to hand in) From Barr Text p. 284 # 1, 2.
Discrete Mathematics CS 2610 March 17, Number Theory Elementary number theory, concerned with numbers, usually integers and their properties or.
Great Theoretical Ideas in Computer Science.
RSA Ramki Thurimella.
Prelude to Public-Key Cryptography Rocky K. C. Chang, February
Cryptography Dec 29. This Lecture In this last lecture for number theory, we will see probably the most important application of number theory in computer.
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
Cryptography and Network Security Chapter 9 - Public-Key Cryptography
MA/CSSE 473 Day 10 Primality testing summary Data Encryption RSA.
Chapter 4 – Finite Fields
22C:19 Discrete Structures Integers and Modular Arithmetic Fall 2014 Sukumar Ghosh.
1 Network and Computer Security (CS 475) Modular Arithmetic and the RSA Public Key Cryptosystem Jeremy R. Johnson.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
What use are prime numbers? ?. o All the primes, apart from 2, are odd numbers. o 1 is not a prime number. Why? o There are infinitely many prime numbers!
Network and Computer Security (CS 475) Modular Arithmetic
David Kauchak CS52 – Spring 2015
1 Section Congruences In short, a congruence relation is an equivalence relation on the carrier of an algebra such that the operations of the algebra.
CS Modular Division and RSA1 RSA Public Key Encryption To do RSA we need fast Modular Exponentiation and Primality generation which we have shown.
Public Key Cryptosystem Introduced in 1976 by Diffie and Hellman [2] In PKC different keys are used for encryption and decryption 1978: First Two Implementations.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
Tuesday’s lecture: Today’s lecture: One-way permutations (OWPs)
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
Great Theoretical Ideas in Computer Science for Some.
Public Key Cryptography 2 RSA. Lemma 1 Let s and t be relatively prime. Then Proof: Let be given by First we show that  actually maps Then we show 
The Euclidean Algorithm That’s right, it’s real..
Week 4 - Wednesday.  What did we talk about last time?  Finished DES  AES.
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2012 Nitesh Saxena.
Introduction to Number Theory
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena.
Introduction to Elliptic Curve Cryptography CSCI 5857: Encoding and Encryption.
RSA Cryptosystem Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006 Lecture 8Feb. 09, 2006Carnegie Mellon University.
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
RSA Algorithm Date: 96/10/17 Wun-Long Yang. Outline Introduction to RSA algorithm RSA efficient implementation & profiling.
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
Number-Theoretic Algorithms
Chapter Applications of Number Theory Some Useful Results
Introduction to Cryptography
Prelude to Public-Key Cryptography
Advanced Algorithms Analysis and Design
Number-Theoretic Algorithms (UNIT-4)
Systems Architecture I
Lecture 3.1: Public Key Cryptography I
Presentation transcript:

Introduction to Modular Arithmetic and Public Key Cryptography

What is modular arithmetic? Modular arithmetic is arithmetic with the remainders upon division by a fixed number n. It is based upon the idea that the remainder of the sum/difference/product of two numbers is the remainder of the sum/difference/product of the remainders. For example, if n=5, (31+7)%5 = 38%5 = 3, and (31%5+7%5)%5 = 1+2=3

So, what is arithmetic mod n? Our “numbers” are 0, 1, 2,... (n-1). We add, subtract as usual, but subtract or add n as necesary to get an answer between 0 and n-1. For multiplication, the process is similar; multiply the two numbers together, and then take the remainder dividing by n.

Some examples, mod n = = = 1 3 – 5 = = 4 4 * 5 = 20 % 6 = 2 WHAT ABOUT DIVISION????? Let us say there is an x such that x * 2 = 1. Let us also say there is a y such that y * 3 = 1

Some examples, mod n = = = 1 3 – 5 = = 4 4 * 5 = 20 % 6 = 2 WHAT ABOUT DIVISION????? Let us say there is an x such that x * 2 = 1. Let us also say there is a y such that y * 3 = 1 Then x * y * 2 * 3 = 6 xy = 1.

Some examples, mod n = = = 1 3 – 5 = = 4 4 * 5 = 20 % 6 = 2 WHAT ABOUT DIVISION????? Let us say there is an x such that x * 2 = 1. Let us also say there is a y such that y * 3 = 1 Then x * y * 2 * 3 = 6 xy = 1. But 6*anything = 0!!!

Some examples, mod n = = = 1 3 – 5 = = 4 4 * 5 = 20 % 6 = 2 WHAT ABOUT DIVISION????? Let us say there is an x such that x * 2 = 1. Let us also say there is a y such that y * 3 = 1 Then x * y * 2 * 3 = 6 xy = 1. But 6*anything = 0!!! So 1 = 0 ?!?!?!?!?!?!?!?!?

Can we divide if n is a prime? Yes, but From now on, our modulus will be a prime p. We will show how to divide in arithmetic mod p. Devious method! We will need a result, called the “extended euclidean algorithm” to pull this off. But first, we need the euclidean algorithm to understand what is going on. The euclidean algorithm computes the greatest common divisor of two positive integers.

Elementary Euclidean Algorithm

Extended Euclidean Algorithm

What can we do with the egcd? Given two numbers a,b, the extended euclidean algorithm finds their gcd g and two numbers s and t such that as + bt = g. In particular, if a and b have no common factors (aside from 1) (i.e. they are “relatively prime”), we can find two numbers s,t such that as + bt = 1 For modular division, if p is prime, given a, we can find s and t such that as +tp = 1. s is then the “multiplicative inverse” of a (suitably reduced, if necesary).

Some more, strange, results.

Another result Chinese remainder theorem: Given m1, m2, m3,.... mk and a1, a2 a3, ak, where The mi, mj are positive, pairwise relatively prime The ai are positive integers less than mi respectively. Then, there exists a b such that mi divides b-ai for each i. If we require that b be less than the product of the mi, then this b is unique. (Proof in next slide)‏

Proof of Chinese Remainder Theorem Suffices to take k=2 by induction. Thus, need to prove that, for 0 < a < m and 0 < b < n if m and n are relatively prime, there exists a unique u between 0 and mn such that u % m = a; u % n = b Since m and n are relatively prime, there exist p,q such that pm + qn = 1. Then bpm + aqn % mn = u satisfies all the conditions.

The RSA Theorem

Proof of the RSA Theorem

How RSA works Take two primes, p, q, let n=pq Chose an e, relatively prime to (p-1)(q-1). Find a d such that de – k(p-1)(q-1) = 1 with the extended euclidean algorithm: then de = 1+k(p-1)(q-1)‏ “Publish”, n, e as public key. Encryption: raise a to the e-th power Decryption: raise result to the d-th power.

“Efficient” powering to compute a^n

Another Crypto-system: Diffie- Hellman key exchange Let p be a large prime, s a number between 2 and p-2; p and s are “publicly known”. Each person has a private key a. Whenever two people want to exchange messages, they send each other s^a mod p They raise the number they receive to their private key power mod p, and have an exchange key for a symmetric crypto-system.

Another Crypto System: El-Gamal As before, let p be a large (publicly known) prime number, s some number between 2 and p-2. Each person chooses a private key e and “publishes” E = s raised to the e-th power mod p. To send message x, we first generate a “session key” k, and send t = s^k and y = E^k x mod p We decrypt by computing t^(-e) y = x mod p