/
Discrete Structures for Computer Science Discrete Structures for Computer Science

Discrete Structures for Computer Science - PowerPoint Presentation

aaron
aaron . @aaron
Follow
375 views
Uploaded On 2018-09-21

Discrete Structures for Computer Science - PPT Presentation

Presented by Andrew F Conn Lecture 12 Solving Congruences and Cryptography October 10 th 2016 Today s Topics More on divisibility and remainders Modulo Inverse Chinese Remainder Theorem ID: 673417

ciphers key modulo public key ciphers public modulo yields cipher cryptography inverse substitution prime alice bob find theorem keys

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Discrete Structures for Computer Science" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Discrete Structures for Computer Science

Presented by: Andrew F. Conn

Lecture #12: Solving Congruence's and Cryptography

October 10

th

, 2016Slide2

Today’s Topics

More on divisibility and remainders.

Modulo Inverse

Chinese Remainder Theorem

Classical Cryptography

Shift Ciphers

Affine Ciphers

Modern Cryptography

Public-Private Key Concept

RSA Cryptosystem

Applications of Public Key CryptographySlide3

Modulo Inverses

When working in “normal” arithmetic we say that

is the inverse of

since

Is there a similar concept in Modulo Arithmetic?

Consider:

 Slide4

Is there always an inverse?

Theorem:

If

and

are relatively prime integers and

, then an inverse of a modulo exists. Furthermore this inverse is unique modulo .Intuitively: If a number does not have a common divisor with your “clock” then one can find a multiple of it that will get to 1.Mathematically:

Question:

Why do we need

?

 Slide5

How can we find the inverse quickly?

With Euclid’s GCD algorithm! Consider the first example

First we need to know if

and

are coprime

Now we can work backwards to find

Bézout

coefficients

.

 

 

Note:

 Slide6

Solving Multiple Congruences

The Chinese Remainder Theorem:

Let

be pairwise relatively prime integers greater than one and

arbitrary integers. Then the system

has a unique solution modulo

.

I will not prove this in lecture. Consult page 278 for the proof.

 Slide7

Chinese Remainder Theorem Example

Solve the system:

Let

, and

and

.

Then find

such that

. In this case

.

Then the solution to the system is:

 Slide8

Back substitution

Apply

modulo definition to the first congruence:

Use the result from the first congruence in the second:

Use the result from the second congruence in the third:

Lastly, solve the congruence for

:

 Slide9

Congruencies With Large Powers

Often in Computer Science we need to solve congruencies where terms have very large powers.

Fermat’s Little Theorem:

If

is prime and

is an integer with , then: Furthermore, for every integer we have:

Example:

 Slide10

Cryptography!!!

This is quite possibly the most used application for number theory in Computer Science.

Cryptography’s applications date back to thousands of years ago.

Ancient Egyptians used different hieroglyphics to possibly hide information or entertain

Ancient Greeks and Spartans used the Scytale transposition cipher to communicate during military campaigns

The Ancient Romans perhaps were the classical masters of cryptographySlide11

Substitution Ciphers

Substitution Ciphers generally replace one character for another

Keys can be a table of the replacement characters or a modulo function

Example:

Let

Then So encoding “ATTACK” yields: DWWDFN.Decrypting DWWDFN yields: ATTACK Slide12

Affine Ciphers

The previous cipher is an example of a

Caeser

Cipher

Another common substitution cipher that is used is an Affine Cipher

Example: Let Then So encoding “ATTACK” yields: DGGDRVAnd decoding “DGGDQV” yields: ATTACK Slide13

Block Ciphers

Works by scrambling a block of text instead of substituting one letter for another

The keys describe the movements of the

indicies

.

Example: Let Then So “PIRA TEAT TACK” yields: RPAI ATTE CTKAAnd decoding yields: PIRA TEAT TACK Slide14

Aren’t these ciphers good enough?

What are some advantages to substitution ciphers?

The cipher text is easy to compute by hand

Encryption and decryption keys are easy to generate

What are some obvious weaknesses of substitution ciphers?

The same letter will always map to the same cipher textThe key needs to be sharedHow can we address the key sharing issue???Slide15

Public Key cryptography

This is the idea that there can be two keys, one public and one private such that:

But:

So, the public and private keys are inverses of each other. But they are not inverses of themselves!

The trick is to make it hard to find the inverse of (at least) the public key.

 Slide16

RSA Cryptosystem

The first (and only?) known public key cryptosystem

Uses modulus and large exponents to make inverses that meet the requirements from the previous page

Uses the fact that multiplication is easy and factorization is hard for computers (today)

I will explain the algorithm here, but to learn the basis of the algorithm you need more math that we have coveredSlide17

RSA Algorithm

Choose two different large random prime numbers

and

.

Calculate

.Calculate Choose such that

Compute

such that

Then the public key is the pair and the public key function is:

The private key is the pair

and

 Slide18

Worked Example

Choose

and

.

Calculate

.Calculate Choose Compute Then encoding “ATTACK” using the numbers 0019 1900 0311 yields: 0615 0874 1129Decoding yields: 0019 1900 0311 Slide19

Key Exchange

Alice and Bob agree to use a prime modulus

and a base

that is a primitive root of

Alice chooses a secret integer

and sends Bob Bob chooses a secret integer and sends Alice Alice computes

Bob computes

Now Alice and Bob both share the secret s and can use it as an encryption key for future communication

 Slide20

Digital SignaturesSlide21