15-251 Great Theoretical Ideas in Computer Science.

Slides:



Advertisements
Similar presentations
RSA and Public Key Cryptography Oct Nathanael Paul.
Advertisements

RSA COSC 201 ST. MARY’S COLLEGE OF MARYLAND FALL 2012 RSA.
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
7. Asymmetric encryption-
Great Theoretical Ideas in Computer Science.
Foundations of Network and Computer Security J J ohn Black Lecture #10 Sep 18 th 2009 CSCI 6268/TLEN 5550, Fall 2009.
CNS2010handout 8 :: introduction to number theory1 computer and network security matt barrie.
RSA ( Rivest, Shamir, Adleman) Public Key Cryptosystem
Cryptography Lecture 11: Oct 12. Cryptography AliceBob Cryptography is the study of methods for sending and receiving secret messages. adversary Goal:
CS470, A.SelcukPublic Key Cryptography1 CS 470 Introduction to Applied Cryptography Instructor: Ali Aydin Selcuk.
Cryptography & Number Theory
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
Introduction to Modern Cryptography Lecture 7 1.RSA Public Key CryptoSystem 2.One way Trapdoor Functions.
Theory I Algorithm Design and Analysis (9 – Randomized algorithms) Prof. Dr. Th. Ottmann.
Public Key Algorithms 4/17/2017 M. Chatterjee.
ELECTRONIC PAYMENT SYSTEMSFALL 2001COPYRIGHT © 2001 MICHAEL I. SHAMOS Electronic Payment Systems Lecture 6 Epayment Security II.
CSCI 172/283 Fall 2010 Public Key Cryptography. New paradigm introduced by Diffie and Hellman The mailbox analogy: Bob has a locked mailbox Alice can.
Lecture 6: Public Key Cryptography
Public Key Model 8. Cryptography part 2.
The RSA Algorithm Based on the idea that factorization of integers into their prime factors is hard. ★ n=p . q, where p and q are distinct primes Proposed.
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
Page 1 Secure Communication Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Great Theoretical Ideas in Computer Science.
Network and Communications Network Security Department of Computer Science Virginia Commonwealth University.
1 Network Security Lecture 6 Public Key Algorithms Waleed Ejaz
Lecture 7b: The Diffie-Hellman Secret Sharing Scheme Wayne Patterson SYCS 653 Fall 2009.
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.
1 Lecture 9 Public Key Cryptography Public Key Algorithms CIS CIS 5357 Network Security.
Cryptography Lecture 7: RSA Primality Testing Piotr Faliszewski.
Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 31.
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
CS461/ECE422 Spring 2012 Nikita Borisov — UIUC1.  Text Chapters 2 and 21  Handbook of Applied Cryptography, Chapter 8 
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
Scott CH Huang COM 5336 Cryptography Lecture 6 Public Key Cryptography & RSA Scott CH Huang COM 5336 Cryptography Lecture 6.
Public Key Cryptosystems RSA Diffie-Hellman Department of Computer Engineering Sharif University of Technology 3/8/2006.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
CS Modular Division and RSA1 RSA Public Key Encryption To do RSA we need fast Modular Exponentiation and Primality generation which we have shown.
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
Elliptic Curves Number Theory and Cryptography. A Pile of Cannonballs A Square of Cannonballs.
Great Theoretical Ideas in Computer Science for Some.
Modular Arithmetic and the RSA Cryptosystem Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 9Sept 27, 2005Carnegie.
Great Theoretical Ideas In Computer Science Anupam GuptaCS Fall 2006 Lecture 15Oct 17, 2006Carnegie Mellon University Algebraic Structures: Groups,
Week 4 - Wednesday.  What did we talk about last time?  Finished DES  AES.
1 Diffie-Hellman (Key Exchange) Protocol Rocky K. C. Chang 9 February 2007.
Great Theoretical Ideas in Computer Science.
Great Theoretical Ideas In Computer Science COMPSCI 102 Fall 2010 Lecture 16October 27, 2010Duke University Modular Arithmetic and the RSA Cryptosystem.
Introduction to Elliptic Curve Cryptography CSCI 5857: Encoding and Encryption.
RSA Pubic Key Encryption CSCI 5857: Encoding and Encryption.
Chapter 1 Algorithms with Numbers. Bases and Logs How many digits does it take to represent the number N >= 0 in base 2? With k digits the largest number.
Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2014.
RSA Cryptosystem Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006 Lecture 8Feb. 09, 2006Carnegie Mellon University.
CSEN 1001 Computer and Network Security Amr El Mougy Mouaz ElAbsawi.
Intro to Cryptography ICS 6D Sandy Irani. Cryptography Intro Alice wants to send a message to Bob so that even if Eve can see the transmitted information,
Great Theoretical Ideas in Computer Science.
Modular Arithmetic and the RSA Cryptosystem Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2005 Lecture 8Feb 3, 2005Carnegie.
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
Modular Arithmetic and the RSA Cryptosystem
RSA Slides by Kent Seamons and Tim van der Horst
Number Theory and Modular Arithmetic
Number Theory and Euclidean Algorithm
Foundations of Network and Computer Security
Modular Arithmetic and the RSA Cryptosystem
CSE 321 Discrete Structures
Practical Aspects of Modern Cryptography
Practical Aspects of Modern Cryptography
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Presentation transcript:

Great Theoretical Ideas in Computer Science

Clarifications of some of the homework Problems. Problem 1 Problem 5 Problem 6

Lecture 14 (February 25, 2010) Raising numbers to powers, Cyrptography and RSA, p-1 pp 1

It’s all done with splay trees. QED. Class Dismissed.

Not

How do you compute… 5858 First idea: = 5*5 = 5 2 *5 using few multiplications?

How do you compute… 5858 Better idea: = 5*5 = 5 2 *5 2 = 5 4 *5 4 Used only 3 mults instead of 7 !!!

Repeated squaring calculates a 2 k in k multiply operations compare with (2 k – 1) multiply operations used by the naïve method

How do you compute… too high! what now? assume no divisions allowed… Use repeated squaring again?

How do you compute… 5 13 Use repeated squaring again? Note that 13 = So a 13 = a 8 * a 4 * a 1 Two more multiplies! = (1101) 2

To compute a m Suppose 2 k ≤ m < 2 k+1 a a2a2 a4a4 a8a8 This takes k multiplies Now write m as a sum of distinct powers of 2 a m = a 2 k * a 2 i1 * … * a 2 it a2ka2k... say, m = 2 k + 2 i i 2 … + 2 i t at most k more multiplies

Hence, we can compute a m while performing at most 2  log 2 m  multiplies

How do you compute… 5 13 (mod 11) First idea: Compute 5 13 using 5 multiplies = 5 8 *5 4 = 5 12 *5 then take the answer mod 11 = (mod 11) = 4

How do you compute… 5 13 (mod 11) Better idea: keep reducing the answer mod ´ 11 3 ´ 11 9 ´ ´ ´ ´ 11 4 ´ 11 3 ´

Hence, we can compute a m (mod n) while performing at most 2  log 2 m  multiplies where each time we multiply together numbers with  log 2 n  + 1 bits

How do you compute… (mod 11) The current best idea would still need about 54 calculations answer = 4 Can we exponentiate any faster?

OK, need a little more number theory for this one…

Z n = {0, 1, 2, …, n-1} Z n * = {x  Z n | GCD(x,n) =1} First, recall…

Fundamental lemmas mod n: If (x  n y) and (a  n b). Then 1) x + a  n y + b 2) x * a  n y * b 3) x - a  n y – b 4) cx  n cy  a  n b i.e., if c in Z n *

Euler Phi Function Á (n) Á (n) = size of Z n * p prime  Á (p) = p-1 p, q distinct primes  Á (pq) = (p-1)(q-1)

Fundamental lemma of powers? If (x  n y) Then a x  n a y ? NO! (2  3 5), but it is not the case that: 2 2  3 2 5

(Correct) Fundamental lemma of powers. Equivalently, for a  Z n *, a x  n a x mod Á (n) If a  Z n * and x  Á (n) y then a x  n a y

How do you compute… (mod 11) (mod 10) = (mod 11) = 125 mod 11 = 4 Why did we take mod 10?

Hence, we can compute a m (mod n) while performing at most 2  log 2 Á (n)  multiplies where each time we multiply together numbers with  log 2 n  + 1 bits for a  Z n *, a x  n a x mod Á (n)

mod 39 Step 1: reduce the base mod 39 Step 2: reduce the exponent mod Á (39) = 24 Step 3: use repeated squaring to compute 3 4, taking mods at each step NB: you should check that gcd(343280,39)=1 to use lemma of powers

(Correct) Fundamental lemma of powers. Equivalently, for a  Z n *, a x  n a x mod Á (n) If a  Z n * and x  Á (n) y then a x  n a y

Use Euler’s Theorem For a  Z n *, a Á (n)  n 1 Corollary: Fermat’s Little Theorem For p prime, a  Z p *  a p-1  p 1 How do you prove the lemma for powers?

Proof of Euler’s Theorem: for a  Z n *, a Á (n)  n 1 Define a Z n * = {a * n x | x  Z n * } for a  Z n * By the cancellation property, Z n * = aZ n *  x  n  ax [as x ranges over Z n * ]  x  n  x (a size of Zn* ) [Commutativity] 1 = n a size of Zn* [Cancellation] a Á (n) = n 1

Euler’s Theorem For a  Z n *, a Á (n)  n 1 Corollary: Fermat’s Little Theorem For p prime, a  Z p *  a p-1  p 1 Please remember

Basic Cryptography

One Time Pads

they give perfect security!

But reuse is bad XOR = Can do other attacks as well

Agreeing on a secret One time pads rely on having a shared secret! Alice and Bob have never talked before but they want to agree on a secret… How can they do this?

A couple of small things A value g in Z n * “generates” Z n * if g, g 2, g 3, g 4, …, g Á (n) contains all elements of Z n *

Diffie-Hellman Key Exchange Alice: Picks prime p, and a generator g in Z p * Picks random a in Z p * Sends over p, g, g a (mod p) Bob: Picks random b in Z p *, and sends over g b (mod p) Now both can compute g ab (mod p)

What about Eve? If Eve’s just listening in, she sees p, g, g a, g b It’s believed that computing g ab (mod p) from just this information is not easy… Alice: Picks prime p, and a value g in Z p * Picks random a in Z p * Sends over p, g, g a (mod p) Bob: Picks random b in Z p *, and sends over g b (mod p) Now both can compute g ab (mod p)

also, discrete logarithms seem hard Discrete-Log: Given p, g, g a (mod p), compute a How fast can you do this? If you can do discrete-logs fast, you can solve the Diffie-Hellman problem fast. How about the other way? If you can break the DH key exchange protocol, do discrete logs fast?

Diffie Hellman requires both parties to exchange information to share a secret can we get rid of this assumption?

The RSA Cryptosystem

Our dramatis personae Rivest Shamir Adleman Euler Fermat

Pick secret, random large primes: p,q Multiply n = p*q “Publish”: n  (n) =  (p)  (q) = (p-1)*(q-1) Pick random e  Z *  (n) “Publish”: e Compute d = inverse of e in Z *  (n) Hence, e*d = 1 [ mod  (n) ] “Private Key”: d

n,e is my public key. Use it to send me a message. p,q random primes e random  Z *  (n) n = p*q e*d = 1 [ mod  (n) ]

n, e p,q prime, e random  Z *  (n) n = p*q e*d = 1 [ mod  (n) ] message m m e [mod n] (m e ) d  n m

Extended gcd on ocaml. (egcd a b) returns a triple (x,y,g) such That g is the gcd(a,b) and g=ax+by. let rec egcd a b = if a = 0 then (0,1,b) else let (x,y,g) = egcd (b mod a) a in (y-(b/a)*x, x, g)

How hard is cracking RSA? If we can factor products of two large primes, can we crack RSA? If we know n and Á (n), can we crack RSA? How about the other way? Does cracking RSA mean we must do one of these two? We don’t know (yet)…

Fast exponentiation Fundamental lemma of powers Euler phi function  (n) = |Z n * | Euler’s theorem Fermat’s little theorem Diffie-Hellman Key Exchange RSA algorithm Here’s What You Need to Know…