Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth...

115
Upcoming: Distinguished Lecturer!

Transcript of Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth...

Page 1: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 2: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 3: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 4: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author:

(three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 5: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 6: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix

: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 7: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 8: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 9: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 10: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.

Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 11: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 12: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 13: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 14: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Upcoming: Distinguished Lecturer!

Lecture: Self-Reference and Ucomputability.

Christos Papadimitriou.

Book Author: (three novels!)

Logicomix: An epic search for Truth

Amazon

Its beautiful.

Browse it here.Scribd

Christos says its fine.

But buy the book.

Its beautiful.

Page 15: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

CS70: Lecture 10. Outline.

1. Cryptography

2. Public Key Cryptography

3. RSA system

3.1 Efficiency: Repeated Squaring.3.2 Correctness: Fermat’s Theorem.3.3 Construction.

4. Warnings.

Page 16: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 17: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 18: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 19: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message mE(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 20: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 21: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 22: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:

One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 23: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.

E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 24: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.

D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 25: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.

Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 26: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!

...and totally secure!

...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 27: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!

...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 28: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 29: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 30: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 31: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..

or less and less secure.

Page 32: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Cryptography ...

BobAliceEve

Secret s

Message m

E(m,s)

E(m,s)

m = D(E(m,s),s)

Example:One-time Pad: secret s is string of length |m|.E(m,s) – bitwise m⊕s.D(x ,s) – bitwise x⊕s.Works because m⊕s⊕s = m!...and totally secure!...given E(m,s) any message m is equally likely.

Disadvantages:

Shared secret!

Uses up one time pad..or less and less secure.

Page 33: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 34: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: K

Private: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 35: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k

Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 36: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 37: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message mE(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 38: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 39: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 40: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !

Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 41: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve

and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 42: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me

and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 43: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you

and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 44: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.

Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 45: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .

(Only?) Alice can decode with k .

Page 46: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Public key crypography.

BobAlice

Eve

Public: KPrivate: k Message m

E(m,K )

E(m,K )

m = D(E(m,K ),k)

Everyone knows key K !Bob (and Eve and me and you and you ...) can encode.Only Alice knows the secret key k for public key K .(Only?) Alice can decode with k .

Page 47: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know.

...but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 48: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 49: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)

Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 50: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.

Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 51: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 52: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).

Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 53: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 54: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 55: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 56: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 57: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Is public key crypto possible?

We don’t really know....but we do it every day!!!

RSA (Rivest, Shamir, and Adleman)Pick two large primes p and q. Let N = pq.Choose e relatively prime to (p−1)(q−1).1

Compute d = e−1 mod (p−1)(q−1).Announce N(= p ·q) and e: K = (N,e) is my public key!

Encoding: mod (xe,N).

Decoding: mod (yd ,N).

Does D(E(m)) = med = m mod N?

Yes!

1Typically small, say e = 3.

Page 58: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 59: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.

(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 60: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60

Choose e = 7, since gcd(7,60) = 1.egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 61: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 62: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 63: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 60

7(1)+60(0) = 77(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 64: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 65: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 4

7(9)+60(−1) = 37(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 66: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 67: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 68: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 69: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm:

−119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 70: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 71: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Example: p = 7, q = 11.

N = 77.(p−1)(q−1) = 60Choose e = 7, since gcd(7,60) = 1.

egcd(7,60).

7(0)+60(1) = 607(1)+60(0) = 7

7(−8)+60(1) = 47(9)+60(−1) = 3

7(−17)+60(2) = 1

Confirm: −119+120 = 1

d = e−1 =−17 = 43 = (mod 60)

Page 72: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 73: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)

Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 74: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.

Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 75: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 76: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2)

= 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 77: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e

= 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 78: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27

≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 79: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77)

= 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 80: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)

D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 81: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)

uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 82: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 83: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 84: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Encryption/Decryption Techniques.

Public Key: (77,7)Message Choices: {0, . . . ,76}.Message: 2!

E(2) = 2e = 27 ≡ 128 (mod 77) = 51 (mod 77)D(51) = 5143 (mod 77)uh oh!

Obvious way: 43 multiplcations. Ouch.

In general, O(N) multiplications!

Page 85: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 86: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143

= 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 87: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1

= 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 88: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).

4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 89: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...

Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 90: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?

511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 91: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)

512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 92: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)

514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 93: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)

518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 94: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)

5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 95: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)

5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 96: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 97: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 98: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 99: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 100: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications

versus 43.

Page 101: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated squaring.

5143 = 5132+8+2+1 = 5132 ·518 ·512 ·511 (mod 77).4 multiplications sort of...Need to compute 5132 . . .511.?511 ≡ 51 (mod 77)512 = (51)∗ (51) = 2601≡ 60 (mod 77)514 = (512)∗ (512) = 60∗60 = 3600≡ 58 (mod 77)518 = (514)∗ (514) = 58∗58 = 3364≡ 53 (mod 77)5116 = (518)∗ (518) = 53∗53 = 2809≡ 37 (mod 77)5132 = (5116)∗ (5116) = 37∗37 = 1369≡ 60 (mod 77)

5 more multiplications.

5132 ·518 ·512 ·511 = (60)∗ (53)∗ (60)∗ (51)≡ 2 (mod 77).

Decoding got the message back!

Repeated Squaring took 9 multiplications versus 43.

Page 102: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated Squaring: xy

Repeated squaring O(logy) multiplications versus y !!!

1. xy : Compute x1,x2,x4, . . . ,x2blogyc.

2. Multiply together x i where the (log(i))th bit of y is 1.

Page 103: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated Squaring: xy

Repeated squaring O(logy) multiplications versus y !!!

1. xy : Compute x1,

x2,x4, . . . ,x2blogyc.

2. Multiply together x i where the (log(i))th bit of y is 1.

Page 104: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated Squaring: xy

Repeated squaring O(logy) multiplications versus y !!!

1. xy : Compute x1,x2,

x4, . . . ,x2blogyc.

2. Multiply together x i where the (log(i))th bit of y is 1.

Page 105: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated Squaring: xy

Repeated squaring O(logy) multiplications versus y !!!

1. xy : Compute x1,x2,x4,

. . . ,x2blogyc.

2. Multiply together x i where the (log(i))th bit of y is 1.

Page 106: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated Squaring: xy

Repeated squaring O(logy) multiplications versus y !!!

1. xy : Compute x1,x2,x4, . . . ,

x2blogyc.

2. Multiply together x i where the (log(i))th bit of y is 1.

Page 107: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated Squaring: xy

Repeated squaring O(logy) multiplications versus y !!!

1. xy : Compute x1,x2,x4, . . . ,x2blogyc.

2. Multiply together x i where the (log(i))th bit of y is 1.

Page 108: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Repeated Squaring: xy

Repeated squaring O(logy) multiplications versus y !!!

1. xy : Compute x1,x2,x4, . . . ,x2blogyc.

2. Multiply together x i where the (log(i))th bit of y is 1.

Page 109: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Always decode correctly?

Fermat’s Little Theorem: For prime p, and a 6≡ 0 (mod p),

ap−1 ≡ 1 (mod p).Proof: Consider S = {a ·1, . . . ,a · (p−1)}.All different modulo p since a has an inverse modulo p. S containsrepresentative of {1, . . . ,p−1} modulo p.

(a ·1) · (a ·2) · · ·(a · (p−1))≡ 1 ·2 · · ·(p−1) mod p,

Since multiplication is commutative.

a(p−1)(1 · · ·(p−1))≡ (1 · · ·(p−1)) mod p.

Each of 2, . . .(p−1) has an inverse modulo p, solve to get...

a(p−1) ≡ 1 mod p.

Page 110: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Always decode correctly?

Fermat’s Little Theorem: For prime p, and a 6≡ 0 (mod p),

ap−1 ≡ 1 (mod p).Proof: Consider S = {a ·1, . . . ,a · (p−1)}.

All different modulo p since a has an inverse modulo p. S containsrepresentative of {1, . . . ,p−1} modulo p.

(a ·1) · (a ·2) · · ·(a · (p−1))≡ 1 ·2 · · ·(p−1) mod p,

Since multiplication is commutative.

a(p−1)(1 · · ·(p−1))≡ (1 · · ·(p−1)) mod p.

Each of 2, . . .(p−1) has an inverse modulo p, solve to get...

a(p−1) ≡ 1 mod p.

Page 111: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Always decode correctly?

Fermat’s Little Theorem: For prime p, and a 6≡ 0 (mod p),

ap−1 ≡ 1 (mod p).Proof: Consider S = {a ·1, . . . ,a · (p−1)}.All different modulo p since a has an inverse modulo p.

S containsrepresentative of {1, . . . ,p−1} modulo p.

(a ·1) · (a ·2) · · ·(a · (p−1))≡ 1 ·2 · · ·(p−1) mod p,

Since multiplication is commutative.

a(p−1)(1 · · ·(p−1))≡ (1 · · ·(p−1)) mod p.

Each of 2, . . .(p−1) has an inverse modulo p, solve to get...

a(p−1) ≡ 1 mod p.

Page 112: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Always decode correctly?

Fermat’s Little Theorem: For prime p, and a 6≡ 0 (mod p),

ap−1 ≡ 1 (mod p).Proof: Consider S = {a ·1, . . . ,a · (p−1)}.All different modulo p since a has an inverse modulo p. S containsrepresentative of {1, . . . ,p−1} modulo p.

(a ·1) · (a ·2) · · ·(a · (p−1))≡ 1 ·2 · · ·(p−1) mod p,

Since multiplication is commutative.

a(p−1)(1 · · ·(p−1))≡ (1 · · ·(p−1)) mod p.

Each of 2, . . .(p−1) has an inverse modulo p, solve to get...

a(p−1) ≡ 1 mod p.

Page 113: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Always decode correctly?

Fermat’s Little Theorem: For prime p, and a 6≡ 0 (mod p),

ap−1 ≡ 1 (mod p).Proof: Consider S = {a ·1, . . . ,a · (p−1)}.All different modulo p since a has an inverse modulo p. S containsrepresentative of {1, . . . ,p−1} modulo p.

(a ·1) · (a ·2) · · ·(a · (p−1))≡ 1 ·2 · · ·(p−1) mod p,

Since multiplication is commutative.

a(p−1)(1 · · ·(p−1))≡ (1 · · ·(p−1)) mod p.

Each of 2, . . .(p−1) has an inverse modulo p, solve to get...

a(p−1) ≡ 1 mod p.

Page 114: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Always decode correctly?

Fermat’s Little Theorem: For prime p, and a 6≡ 0 (mod p),

ap−1 ≡ 1 (mod p).Proof: Consider S = {a ·1, . . . ,a · (p−1)}.All different modulo p since a has an inverse modulo p. S containsrepresentative of {1, . . . ,p−1} modulo p.

(a ·1) · (a ·2) · · ·(a · (p−1))≡ 1 ·2 · · ·(p−1) mod p,

Since multiplication is commutative.

a(p−1)(1 · · ·(p−1))≡ (1 · · ·(p−1)) mod p.

Each of 2, . . .(p−1) has an inverse modulo p, solve to get...

a(p−1) ≡ 1 mod p.

Page 115: Upcoming: Distinguished Lecturer!cs70/fa15/slides/lec-11.pdfLogicomix: An epic search for Truth Amazon Its beautiful. Browse it here. Scribd Christos says its fine. But buy the book.

Always decode correctly?

Fermat’s Little Theorem: For prime p, and a 6≡ 0 (mod p),

ap−1 ≡ 1 (mod p).Proof: Consider S = {a ·1, . . . ,a · (p−1)}.All different modulo p since a has an inverse modulo p. S containsrepresentative of {1, . . . ,p−1} modulo p.

(a ·1) · (a ·2) · · ·(a · (p−1))≡ 1 ·2 · · ·(p−1) mod p,

Since multiplication is commutative.

a(p−1)(1 · · ·(p−1))≡ (1 · · ·(p−1)) mod p.

Each of 2, . . .(p−1) has an inverse modulo p, solve to get...

a(p−1) ≡ 1 mod p.