Introduction to Modular Arithmetic and Public Key Cryptography - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to Modular Arithmetic and Public Key Cryptography

Description:

Introduction to Modular Arithmetic and Public Key Cryptography What is modular arithmetic? Modular arithmetic is arithmetic with the remainders upon division by a ... – PowerPoint PPT presentation

Number of Views:201
Avg rating:3.0/5.0
Slides: 21
Provided by: csKentEd88
Learn more at: https://www.cs.kent.edu
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Modular Arithmetic and Public Key Cryptography


1
  • Introduction to Modular Arithmetic and Public Key
    Cryptography

2
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 n5,
  • (317)5 385 3, and
  • (31575)5 123

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.

4
Some examples, mod n 6.
  • 4 3 7 - 6 1
  • 3 5 -2 6 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

5
Some examples, mod n 6.
  • 4 3 7 - 6 1
  • 3 5 -2 6 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.

6
Some examples, mod n 6.
  • 4 3 7 - 6 1
  • 3 5 -2 6 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 6anything 0!!!

7
Some examples, mod n 6.
  • 4 3 7 - 6 1
  • 3 5 -2 6 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 6anything 0!!!
  • So 1 0 ?!?!?!?!?!?!?!?!?

8
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.

9
Elementary Euclidean Algorithm
10
Extended Euclidean Algorithm
11
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).

12
Some more, strange, results.
13
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)?

14
Proof of Chinese Remainder Theorem
  • Suffices to take k2 by induction. Thus, need to
    prove that, for 0 lt a lt m and 0 lt b lt 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.

15
The RSA Theorem
16
Proof of the RSA Theorem
17
How RSA works
  • Take two primes, p, q, let npq
  • 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 1k(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.

18
Efficient powering to compute an
19
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 sa 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.

20
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 sk and y Ek x mod p
  • We decrypt by computing t(-e) y x mod p
Write a Comment
User Comments (0)
About PowerShow.com