• No results found

Modular or “clock” arithmetic

N/A
N/A
Protected

Academic year: 2022

Share "Modular or “clock” arithmetic"

Copied!
78
0
0

Loading.... (view fulltext now)

Full text

(1)

CS 207m: Discrete Structures (Minor)

Abstract algebra and Number theory –

Applications to Cryptography

Lecture 24 Apr 20 2018

(2)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

(3)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a &bmay not be same, but modulom, they are the same:

(4)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

(5)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

I What other properties does this “congruence” have?

(6)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

I What other properties does this “congruence” have?

I Equivalence?

I Ifab modm,cd modm, thena+cb+d modm andacbd modm.

I cab modmiffc(a(b modm)) modm

(7)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

I What other properties does this “congruence” have?

I Equivalence?

I Ifab modm,cd modm, thena+cb+d modm andacbd modm.

I cab modmiffc(a(b modm)) modm iffc(a modm)(b modm) mod m.

I Corollary: Modular exponentiation is easy!

I What is 515 mod 23?

(8)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

I What other properties does this “congruence” have?

I Equivalence?

I Ifab modm,cd modm, thena+cb+d modm andacbd modm.

I cab modmiffc(a(b modm)) modm iffc(a modm)(b modm) mod m.

I Corollary: Modular exponentiation is easy!

I What is 515 mod 23?

I = (5 mod 23)(52 mod 23)(54 mod 23)(58 mod 23)

(9)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

I What other properties does this “congruence” have?

I Equivalence?

I Ifab modm,cd modm, thena+cb+d modm andacbd modm.

I cab modmiffc(a(b modm)) modm

I Corollary: Modular exponentiation is easy!

I What is 515 mod 23?

I = (5 mod 23)(52 mod 23)(54 mod 23)(58 mod 23) mod 23 = (5·2·4·16) mod 23 = 65 mod 23 = 19.

I What is the worst case no. of steps?

(10)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

I What other properties does this “congruence” have?

I Equivalence?

I Ifab modm,cd modm, thena+cb+d modm andacbd modm.

I cab modmiffc(a(b modm)) modm

A math application: Fermat’s little theorem

I For any prime p, ifgcd(a, p) = 1, thenp|(ap−1−1).

(11)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

I What other properties does this “congruence” have?

I Equivalence?

I Ifab modm,cd modm, thena+cb+d modm andacbd modm.

I cab modmiffc(a(b modm)) modm

A math application: Fermat’s little theorem

I For any prime p, ifgcd(a, p) = 1, thenp|(ap−1−1).

I For any prime p, ifgcd(a, p) = 1, thenap−1 ≡1 mod p.

(12)

Modular or “clock” arithmetic

Definition

For integersa, band positive integer m, we say ais congruent to bmodulo m, denoted a≡b mod m, ifm|(a−b).

i.e.,a&bmay not be same, but modulom, they are the same:

I Formally,a≡b mod miff a mod m=b mod m.

I What other properties does this “congruence” have?

I Equivalence?

I Ifab modm,cd modm, thena+cb+d modm andacbd modm.

I cab modmiffc(a(b modm)) modm

A math application: Fermat’s little theorem

I For any prime p, ifgcd(a, p) = 1, thenp|(ap−1−1).

I For any prime p, ifgcd(a, p) = 1, thenap−1 ≡1 mod p.

(13)

Sharing secrets in plain sight!

I Suppose two of you want to share a secret...

I But you can only shout messages.. can you still get something private?

I which others will not be able to figure out at once?

(14)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(15)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(16)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(17)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(18)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(19)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(20)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(21)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(22)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(23)

A game of spies...

Start by choosing a prime 13, a generator for (Z13\ {0},×13)=6.

I A and B pick two secret numbers from 1 to 13, saya,b.

I A computes 6a mod 13 =M.

I B computes 6b mod 13 =N.

I Shout/send M and N over.

I A computes Na mod 13 =s.

I B computes Mb mod 13 =t.

I s=t!

Why does this work?

I Because Mb mod 13 = 6ab mod 13 =Na mod 13.

I And computing this from just 6, 13, 6a mod 13 and 6b mod 13 is hard without knowing aand b.

(24)

A game of spies...

1. Choose a prime p and a generatorg from (Zp\ {0},×p).

2. Alice fixes a private keyα andBob fixes β.

3. Alice computesM =gα mod p and shouts/sends it.

4. Bob computes N =gβ mod p and sends/shouts it.

5. Alice computesMα mod pand Bob computes Nβ mod p.

Shared Key: gαβ mod p

I Others know p, g, gα mod p, gβ mod p.

I But computing gαβ modp from ONLYthis info, without knowing aand bis hard!! How hard?

I Does there exist a poly-time (in size of digits) algorithm?

I This is called the Diffie-Hellmanproblem. Still open...

I In practice, choose large primes with∼300 digits.

(25)

A game of spies...

1. Choose a prime p and a generatorg from (Zp\ {0},×p).

2. Alice fixes a private keyα andBob fixes β.

3. Alice computesM =gα mod p and shouts/sends it.

4. Bob computes N =gβ mod p and sends/shouts it.

5. Alice computesMα mod pand Bob computes Nβ mod p.

Shared Key: gαβ mod p

I Others know p, g, gα mod p, gβ mod p.

I But computing gαβ modp from ONLYthis info, without knowing aand bis hard!! How hard?

I Does there exist a poly-time (in size of digits) algorithm?

I This is called the Diffie-Hellmanproblem. Still open...

I In practice, choose large primes with∼300 digits.

(26)

A game of spies...

1. Choose a prime p and a generatorg from (Zp\ {0},×p).

2. Alice fixes a private keyα andBob fixes β.

3. Alice computesM =gα mod p and shouts/sends it.

4. Bob computes N =gβ mod p and sends/shouts it.

5. Alice computesMα mod pand Bob computes Nβ mod p.

Shared Key: gαβ mod p

I Others know p, g, gα mod p, gβ mod p.

I But computing gαβ modp from ONLYthis info, without knowing aand bis hard!! How hard?

I Does there exist a poly-time (in size of digits) algorithm?

I This is called the Diffie-Hellmanproblem. Still open...

I In practice, choose large primes with∼300 digits.

(27)

A game of spies...

1. Choose a prime p and a generatorg from (Zp\ {0},×p).

2. Alice fixes a private keyα andBob fixes β.

3. Alice computesM =gα mod p and shouts/sends it.

4. Bob computes N =gβ mod p and sends/shouts it.

5. Alice computesMα mod pand Bob computes Nβ mod p.

Shared Key: gαβ mod p

I Others know p, g, gα mod p, gβ mod p.

I But computing gαβ modp from ONLYthis info, without knowing aand bis hard!!

How hard?

I Does there exist a poly-time (in size of digits) algorithm?

I This is called the Diffie-Hellmanproblem. Still open...

I In practice, choose large primes with∼300 digits.

(28)

A game of spies...

1. Choose a prime p and a generatorg from (Zp\ {0},×p).

2. Alice fixes a private keyα andBob fixes β.

3. Alice computesM =gα mod p and shouts/sends it.

4. Bob computes N =gβ mod p and sends/shouts it.

5. Alice computesMα mod pand Bob computes Nβ mod p.

Shared Key: gαβ mod p

I Others know p, g, gα mod p, gβ mod p.

I But computing gαβ modp from ONLYthis info, without knowing aand bis hard!! How hard?

I Does there exist a poly-time (in size of digits) algorithm?

I This is called the Diffie-Hellmanproblem. Still open...

I In practice, choose large primes with∼300 digits.

(29)

A game of spies...

1. Choose a prime p and a generatorg from (Zp\ {0},×p).

2. Alice fixes a private keyα andBob fixes β.

3. Alice computesM =gα mod p and shouts/sends it.

4. Bob computes N =gβ mod p and sends/shouts it.

5. Alice computesMα mod pand Bob computes Nβ mod p.

Shared Key: gαβ mod p

I Others know p, g, gα mod p, gβ mod p.

I But computing gαβ modp from ONLYthis info, without knowing aand bis hard!! How hard?

I Does there exist a poly-time (in size of digits) algorithm?

I This is called the Diffie-Hellmanproblem. Still open...

I In practice, choose large primes with∼300 digits.

(30)

A game of spies...

1. Choose a prime p and a generatorg from (Zp\ {0},×p).

2. Alice fixes a private keyα andBob fixes β.

3. Alice computesM =gα mod p and shouts/sends it.

4. Bob computes N =gβ mod p and sends/shouts it.

5. Alice computesMα mod pand Bob computes Nβ mod p.

Shared Key: gαβ mod p

I Others know p, g, gα mod p, gβ mod p.

I But computing gαβ modp from ONLYthis info, without knowing aand bis hard!! How hard?

I Does there exist a poly-time (in size of digits) algorithm?

I This is called the Diffie-Hellmanproblem. Still open...

I In practice, choose large primes with∼300 digits.

(31)

A game of spies...

1. Choose a prime p and a generatorg from (Zp\ {0},×p).

2. Alice fixes a private keyα andBob fixes β.

3. Alice computesM =gα mod p and shouts/sends it.

4. Bob computes N =gβ mod p and sends/shouts it.

5. Alice computesMα mod pand Bob computes Nβ mod p.

Shared Key: gαβ mod p

I Others know p, g, gα mod p, gβ mod p.

I But computing gαβ modp from ONLYthis info, without knowing aand bis hard!! How hard?

I Does there exist a poly-time (in size of digits) algorithm?

I This is called the Diffie-Hellmanproblem. Still open...

I In practice, choose large primes with∼300 digits.

(32)

More generally...

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Of course, if we know modular logarithm we could do it!

I i.e., if ga=g0 and g andg0 are given, what is a?

I Called thediscrete logarithm problem and it is also open!

I What is a naive algorithm? Why does it not work?

I But there exists aquantum algorithm which runs in poly time!

(33)

Sending messages with Diffie-Hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Alice encrypts messagemasmgab and sends it.

I So to decrypt it Bob needs to compute (gab)−1.

I So Bob computes:

(ga)|G|−b=ga|G|−ab= (g|G|)a(g−ab) =ea(g−ab) = (gab)−1 – Application of Lagrange’s theorem!

I Then Bob just applies this on msg received.

I That is, mgab(gab)−1=m·e=m.

(34)

Sending messages with Diffie-Hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Alice encrypts messagem asmgab and sends it.

I So to decrypt it Bob needs to compute (gab)−1.

I So Bob computes:

(ga)|G|−b=ga|G|−ab= (g|G|)a(g−ab) =ea(g−ab) = (gab)−1 – Application of Lagrange’s theorem!

I Then Bob just applies this on msg received.

I That is, mgab(gab)−1=m·e=m.

(35)

Sending messages with Diffie-Hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Alice encrypts messagem asmgab and sends it.

I So to decrypt it Bob needs to compute (gab)−1.

I So Bob computes:

(ga)|G|−b=ga|G|−ab= (g|G|)a(g−ab) =ea(g−ab) = (gab)−1 – Application of Lagrange’s theorem!

I Then Bob just applies this on msg received.

I That is, mgab(gab)−1=m·e=m.

(36)

Sending messages with Diffie-Hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Alice encrypts messagem asmgab and sends it.

I So to decrypt it Bob needs to compute (gab)−1.

I So Bob computes:

(ga)|G|−b=ga|G|−ab= (g|G|)a(g−ab) =ea(g−ab) = (gab)−1 – Application of Lagrange’s theorem!

I Then Bob just applies this on msg received.

I That is, mgab(gab)−1=m·e=m.

(37)

Sending messages with Diffie-Hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Alice encrypts messagem asmgab and sends it.

I So to decrypt it Bob needs to compute (gab)−1.

I So Bob computes:

(ga)|G|−b=

ga|G|−ab= (g|G|)a(g−ab) =ea(g−ab) = (gab)−1 – Application of Lagrange’s theorem!

I Then Bob just applies this on msg received.

I That is, mgab(gab)−1=m·e=m.

(38)

Sending messages with Diffie-Hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Alice encrypts messagem asmgab and sends it.

I So to decrypt it Bob needs to compute (gab)−1.

I So Bob computes:

(ga)|G|−b=ga|G|−ab= (g|G|)a(g−ab) =ea(g−ab) = (gab)−1 – Application of Lagrange’s theorem!

I Then Bob just applies this on msg received.

I That is, mgab(gab)−1=m·e=m.

(39)

Sending messages with Diffie-Hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Alice encrypts messagem asmgab and sends it.

I So to decrypt it Bob needs to compute (gab)−1.

I So Bob computes:

(ga)|G|−b=ga|G|−ab= (g|G|)a(g−ab) =ea(g−ab) = (gab)−1 – Application of Lagrange’s theorem!

I Then Bob just applies this on msg received.

I That is, mgab(gab)−1=m·e=m.

(40)

Sending messages with Diffie-Hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Alice encrypts messagem asmgab and sends it.

I So to decrypt it Bob needs to compute (gab)−1.

I So Bob computes:

(ga)|G|−b=ga|G|−ab= (g|G|)a(g−ab) =ea(g−ab) = (gab)−1 – Application of Lagrange’s theorem!

I Then Bob just applies this on msg received.

I That is, mgab(gab)−1=m·e=m.

(41)

Diffie-Hellman Key Exchange protocol

I This was discovered by Diffie & Hellman in 1976.

I Considered to be first cryptographic protocol.

I Variants of this are still used everywhere!

I Digital signatures for Sony Playstations.

I GNU Privacy guard, PGP (pretty good privacy)...

I Which cyclic group?

I Replace (Zp\ {0},×p) by cyclic group of points ofelliptic curves.

– Elliptic Curve Diffie-HellmanCyptography.

(42)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements? Zp\ {0}={1,2, . . . , p1}

I What is the order of this group? p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1) because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1. Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)| is denoted φ(n) – called theEuler totient no./function.

(43)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements?

Zp\ {0}={1,2, . . . , p1}

I What is the order of this group? p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1) because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1. Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)| is denoted φ(n) – called theEuler totient no./function.

(44)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements? Zp\ {0}={1,2, . . . , p1}

I What is the order of this group?

p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1) because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1. Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)| is denoted φ(n) – called theEuler totient no./function.

(45)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements? Zp\ {0}={1,2, . . . , p1}

I What is the order of this group? p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1) because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1. Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)| is denoted φ(n) – called theEuler totient no./function.

(46)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements? Zp\ {0}={1,2, . . . , p1}

I What is the order of this group? p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1) because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1. Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)| is denoted φ(n) – called theEuler totient no./function.

(47)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements? Zp\ {0}={1,2, . . . , p1}

I What is the order of this group? p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1)

because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1. Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)| is denoted φ(n) – called theEuler totient no./function.

(48)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements? Zp\ {0}={1,2, . . . , p1}

I What is the order of this group? p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1) because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1.

Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)| is denoted φ(n) – called theEuler totient no./function.

(49)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements? Zp\ {0}={1,2, . . . , p1}

I What is the order of this group? p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1) because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1.

Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)| is denoted φ(n) – called theEuler totient no./function.

(50)

More properties of modular arithmetic & group theory

Definition

For integersa, b and positive integerm, ifm|(a−b), then we say thatais congruent to bmodulo m, denoted a≡b mod m.

I (Zp\ {0},×p) is a group.

I What are its elements? Zp\ {0}={1,2, . . . , p1}

I What is the order of this group? p1.

I What about (Zn\ {0},×n)? Which elements have inverses?

I Only those co-prime to n(i.e.,a|gcd(a, n) = 1) because,

I ifgcd(a, n) = 1 then∃r, ss.t., ar+ns=gcd(a, n) = 1.

Again impliesar1 modn, i.e., ris inverse ofa modn.

I Thus, numbers co-prime to n, denoted Coprime(Zn) form a group under ×n. Check!

I The number of elements co-prime ton, i.e., |Coprime(Zn)|

(51)

Properties of the Euler Totient function

I ∀n∈Z+,Coprime(Zn) denotes numbers coprime ton.

I (Coprime(Zn),×n)is a group, where a×nb=ab mod n.

I Order of this group is

(52)

Properties of the Euler Totient function

I ∀n∈Z+,Coprime(Zn) denotes numbers coprime ton.

I (Coprime(Zn),×n)is a group, where a×nb=ab mod n.

I Order of this group is φ(n), no. of elements co-prime to n.

(53)

Properties of the Euler Totient function

I ∀n∈Z+,Coprime(Zn) denotes numbers coprime ton.

I (Coprime(Zn),×n)is a group, where a×nb=ab mod n.

I Order of this group is φ(n), no. of elements co-prime to n.

Exercises

1. Supposep is a prime, what is (Coprime(Zp),×p)?

2. What is φ(p)?

3. Supposen=pq is a product of primes, what is φ(pq), i.e., how many numbers are there co-prime topq in{1, . . . , pq}?

(54)

Properties of the Euler Totient function

I ∀n∈Z+,Coprime(Zn) denotes numbers coprime ton.

I (Coprime(Zn),×n)is a group, where a×nb=ab mod n.

I Order of this group is φ(n), no. of elements co-prime to n.

Exercises

1. Supposep is a prime, what is (Coprime(Zp),×p)?

2. What is φ(p)?

3. Supposen=pq is a product of primes, what is φ(pq), i.e., how many numbers are there co-prime topq in{1, . . . , pq}?

4. (Euler’s theorem) Ifgcd(a, n) = 1, then aφ(n)≡1 mod n.

(55)

Properties of the Euler Totient function

I ∀n∈Z+,Coprime(Zn) denotes numbers coprime ton.

I (Coprime(Zn),×n)is a group, where a×nb=ab mod n.

I Order of this group is φ(n), no. of elements co-prime to n.

Exercises

1. Supposep is a prime, what is (Coprime(Zp),×p)?

– the usual (Zpp) 2. What is φ(p)? p−1

3. Supposen=pq is a product of primes, what is φ(pq), i.e., how many numbers are there co-prime topq in{1, . . . , pq}?

φ(pq) = (p−1)(q−1)

4. (Euler’s theorem) Ifgcd(a, n) = 1, then aφ(n)≡1 mod n.

(56)

Properties of the Euler Totient function

I ∀n∈Z+,Coprime(Zn) denotes numbers coprime ton.

I (Coprime(Zn),×n)is a group, where a×nb=ab mod n.

I Order of this group is φ(n), no. of elements co-prime to n.

Exercises

1. Supposep is a prime, what is (Coprime(Zp),×p)?

2. What is φ(p)?

3. Supposen=pq is a product of primes, what is φ(pq), i.e., how many numbers are there co-prime topq in{1, . . . , pq}?

φ(pq) = (p−1)(q−1)

4. (Euler’s theorem) Ifgcd(a, n) = 1, then aφ(n)≡1 mod n.

I Letgcd(a, n) = 1,φ(n) =|(Coprime(Zn),×n)|

(57)

Properties of the Euler Totient function

I ∀n∈Z+,Coprime(Zn) denotes numbers coprime ton.

I (Coprime(Zn),×n)is a group, where a×nb=ab mod n.

I Order of this group is φ(n), no. of elements co-prime to n.

Exercises

1. Supposep is a prime, what is (Coprime(Zp),×p)?

2. What is φ(p)?

3. Supposen=pq is a product of primes, what is φ(pq), i.e., how many numbers are there co-prime topq in{1, . . . , pq}?

φ(pq) = (p−1)(q−1)

4. (Euler’s theorem) Ifgcd(a, n) = 1, then aφ(n)≡1 mod n.

I Letgcd(a, n) = 1,φ(n) =|(Coprime(Zn),×n)|

I By Lagrange’s theorem, order of elementadivides order of this group, i.e.,a(ord.of grp)=(idof this grp).

(58)

Properties of the Euler Totient function

I ∀n∈Z+,Coprime(Zn) denotes numbers coprime ton.

I (Coprime(Zn),×n)is a group, where a×nb=ab mod n.

I Order of this group is φ(n), no. of elements co-prime to n.

Exercises

1. Supposep is a prime, what is (Coprime(Zp),×p)?

2. What is φ(p)?

3. Supposen=pq is a product of primes, what is φ(pq), i.e., how many numbers are there co-prime topq in{1, . . . , pq}?

φ(pq) = (p−1)(q−1)

4. (Euler’s theorem) Ifgcd(a, n) = 1, then aφ(n)≡1 mod n.

I Letgcd(a, n) = 1,φ(n) =|(Coprime(Zn),×n)|

I By Lagrange’s theorem, order of elementadivides order of

(59)

Sharing secrets in plain sight! Part 2: Redux

I Alice wants to send a message M (a number, lets say between 1 and 20000) to Bob that only he can figure out.

I But any message can be intercepted (hacker: Carol!)

I How can Bob ensure privacy of messages?

Bob starts by choosing two large primesp, q

Also chooses numbersDand E such thatED≡1 mod φ(pq) (i.e.,φ(pq)|(ED−1)).

1. Bob shouts outN =pqand E (encryptor!)... 2. But he keepsp, q and the decryptorD secret.

3. Alice wants to send messageM < p, q that onlyBob understands. What does she send?

4. Alice sendsX =ME mod N

5. Bob can decrypt it by: XD =MED mod N =M1+mφ(pq) mod pq=M (byEuler’s theorem)

(60)

Sharing secrets in plain sight! Part 2: Redux

I Alice wants to send a message M (a number, lets say between 1 and 20000) to Bob that only he can figure out.

I But any message can be intercepted (hacker: Carol!)

I How can Bob ensure privacy of messages?

Bob starts by choosing two large primesp, q

Also chooses numbersDand E such thatED≡1 mod φ(pq) (i.e.,φ(pq)|(ED−1)).

1. Bob shouts outN =pqand E (encryptor!)... 2. But he keepsp, q and the decryptorD secret.

3. Alice wants to send messageM < p, q that onlyBob understands. What does she send?

4. Alice sendsX =ME mod N

5. Bob can decrypt it by: XD =MED mod N =M1+mφ(pq) mod pq=M (byEuler’s theorem)

(61)

Sharing secrets in plain sight! Part 2: Redux

I Alice wants to send a message M (a number, lets say between 1 and 20000) to Bob that only he can figure out.

I But any message can be intercepted (hacker: Carol!)

I How can Bob ensure privacy of messages?

Bob starts by choosing two large primesp, q

Also chooses numbersDand E such thatED≡1 mod φ(pq) (i.e.,φ(pq)|(ED−1)).

1. Bob shouts outN =pqand E (encryptor!)...

2. But he keepsp, q and the decryptorD secret.

3. Alice wants to send messageM < p, q that onlyBob understands. What does she send?

4. Alice sendsX =ME mod N

5. Bob can decrypt it by: XD =MED mod N =M1+mφ(pq) mod pq=M (byEuler’s theorem)

(62)

Sharing secrets in plain sight! Part 2: Redux

I Alice wants to send a message M (a number, lets say between 1 and 20000) to Bob that only he can figure out.

I But any message can be intercepted (hacker: Carol!)

I How can Bob ensure privacy of messages?

Bob starts by choosing two large primesp, q

Also chooses numbersDand E such thatED≡1 mod φ(pq) (i.e.,φ(pq)|(ED−1)).

1. Bob shouts outN =pqand E (encryptor!)...

2. But he keepsp, q and the decryptorD secret.

3. Alice wants to send messageM < p, q that onlyBob understands. What does she send?

4. Alice sendsX =ME mod N

5. Bob can decrypt it by: XD =MED mod N =M1+mφ(pq) mod pq=M (byEuler’s theorem)

(63)

Sharing secrets in plain sight! Part 2: Redux

I Alice wants to send a message M (a number, lets say between 1 and 20000) to Bob that only he can figure out.

I But any message can be intercepted (hacker: Carol!)

I How can Bob ensure privacy of messages?

Bob starts by choosing two large primesp, q

Also chooses numbersDand E such thatED≡1 mod φ(pq) (i.e.,φ(pq)|(ED−1)).

1. Bob shouts outN =pqand E (encryptor!)...

2. But he keepsp, q and the decryptorD secret.

3. Alice wants to send messageM < p, q that onlyBob understands. What does she send?

4. Alice sendsX =ME mod N

5. Bob can decrypt it by: XD =MED mod N =M1+mφ(pq) mod pq=M (byEuler’s theorem)

(64)

Sharing secrets in plain sight! Part 2: Redux

I Alice wants to send a message M (a number, lets say between 1 and 20000) to Bob that only he can figure out.

I But any message can be intercepted (hacker: Carol!)

I How can Bob ensure privacy of messages?

Bob starts by choosing two large primesp, q

Also chooses numbersDand E such thatED≡1 mod φ(pq) (i.e.,φ(pq)|(ED−1)).

1. Bob shouts outN =pqand E (encryptor!)...

2. But he keepsp, q and the decryptorD secret.

3. Alice wants to send messageM < p, q that onlyBob understands. What does she send?

4. Alice sendsX =ME mod N

XD =MED mod N =M1+mφ(pq) mod pq=M (byEuler’s theorem)

(65)

Sharing secrets in plain sight! Part 2: Redux

I Alice wants to send a message M (a number, lets say between 1 and 20000) to Bob that only he can figure out.

I But any message can be intercepted (hacker: Carol!)

I How can Bob ensure privacy of messages?

Bob starts by choosing two large primesp, q

Also chooses numbersDand E such thatED≡1 mod φ(pq) (i.e.,φ(pq)|(ED−1)).

1. Bob shouts outN =pqand E (encryptor!)...

2. But he keepsp, q and the decryptorD secret.

3. Alice wants to send messageM < p, q that onlyBob understands. What does she send?

4. Alice sendsX =ME mod N

5. Bob can decrypt it by: XD =MED mod N =M1+mφ(pq) mod pq=M (byEuler’s theorem)

(66)

RSA cryptography

Why does this work?

I Because Carol knows only X, N, Eand has to solve ED≡1 mod φ(N) to obtain Dafter computing φ(N).

I But there is no known fastway to get φ(N) fromN.

I Only known way is to factorize N and finding a poly-time algo for this is open!

Figure:Rivest, Shamir, Addleman, 1977 - Turing Award in 2002

(67)

RSA cryptography

Why does this work?

I Because Carol knows only X, N, Eand has to solve ED≡1 mod φ(N) to obtain Dafter computing φ(N).

I But there is no known fastway to get φ(N) fromN.

I Only known way is to factorize N and finding a poly-time algo for this is open!

Figure:Rivest, Shamir, Addleman, 1977 - Turing Award in 2002

(68)

RSA cryptography

Why does this work?

I Because Carol knows only X, N, Eand has to solve ED≡1 mod φ(N) to obtain Dafter computing φ(N).

I But there is no known fastway to get φ(N) fromN.

I Only known way is to factorize N and finding a poly-time algo for this is open!

Figure:Rivest, Shamir, Addleman, 1977 - Turing Award in 2002

(69)

Compare this to Diffie-hellman

Start with any finite cyclic groupG and generator g ∈G 1. Alice picks a randoma∈Nand sends ga toBob.

2. Bob picks a random b∈Nand sends gb toAlice.

3. Alice computes (gb)a andBob computes (ga)b. 4. Shared key is gab.

I Of course, we know modular logarithm we could do it!

I i.e., if ga=g0 and g andg0 are given, what is a?

I Called thediscrete logarithm problem and it is also open!

(70)

Summary

What we covered in this course 1. Mathematical proofs and structures 2. Counting and combinatorics

3. Introduction to graph theory

4. Elements of group theory and applications to number theory

References

Related documents

input sampled on the falling edge of the clock is held stable when clock is low (or high) - hold mode. ❑

The Fundamental Theorem of Arithmetic states that every composite number can be expressed (factorized) as a product of its primes and this factorization is unique, apart from the

I SEMESTER Diploma in Secretarial Practice, Univ.. of

As expected, snow leopard predation on livestock was greater in KWS than in PVNP, suggesting that the relative density of livestock vis-à-vis wild prey may be a reasonable

The CSIR-Ins tute of Genomics and Integra ve Biology (CSIR-IGIB, New Delhi) has been at the fron er of genomics research ever since. IGIB is a part of the Indian Genome Varia

highest for yoga due to its ability to offer health and wellbeing to the practitioners, this study aims to study the way in which yoga practitioners are motivated and how

This chapter deals with modular system and helps in finding cohesion and coupling of the modular system using the help of Information theory Approach...

Rajesh Bishi, (Roll No: 411MA2071.) student of Master of Science in Mathematics at National Institute of Technology, Rourkela, during the year 2013.. In partial fulfilment of