Top Banner
An Application of Number Theory, the RSA Cryptosystem Ngày 10 tháng 12 năm 2010 An Application of Number Theory, the RSA Cryptosystem
102

An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Mar 13, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

An Application of Number Theory, the RSACryptosystem

Ngày 10 tháng 12 năm 2010

An Application of Number Theory, the RSA Cryptosystem

Page 2: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Securing Transactions

QuestionMr. Nguyen sells expensive jewelry. He has an interesting ideafor a business model. Each customer will have access to boxeswith a combination lock. Once a person grabs a box he can sethis own private combination lock. An open box can be closedby anyone, but only the owner knows the combination and canopen it. The content of any open box sent between persons willbe stolen.You wish to buy an expensive gift for your significant other’sbirthday. This means money will have to be sent to Mr. Nguyen(who is honest and trustworthy) and the gift delivered to you.Transaction details, such as item, price etc. can be discussedby phone.

How can we accomplish this?

An Application of Number Theory, the RSA Cryptosystem

Page 3: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Securing Transactions

QuestionMr. Nguyen sells expensive jewelry. He has an interesting ideafor a business model. Each customer will have access to boxeswith a combination lock. Once a person grabs a box he can sethis own private combination lock. An open box can be closedby anyone, but only the owner knows the combination and canopen it. The content of any open box sent between persons willbe stolen.You wish to buy an expensive gift for your significant other’sbirthday. This means money will have to be sent to Mr. Nguyen(who is honest and trustworthy) and the gift delivered to you.Transaction details, such as item, price etc. can be discussedby phone.

How can we accomplish this?

An Application of Number Theory, the RSA Cryptosystem

Page 4: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Securing Transactions

QuestionMr. Nguyen sells expensive jewelry. He has an interesting ideafor a business model. Each customer will have access to boxeswith a combination lock. Once a person grabs a box he can sethis own private combination lock. An open box can be closedby anyone, but only the owner knows the combination and canopen it. The content of any open box sent between persons willbe stolen.You wish to buy an expensive gift for your significant other’sbirthday. This means money will have to be sent to Mr. Nguyen(who is honest and trustworthy) and the gift delivered to you.Transaction details, such as item, price etc. can be discussedby phone.

How can we accomplish this?

An Application of Number Theory, the RSA Cryptosystem

Page 5: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

DiscussionThis is exactly how business transactions are being conductedon the internet today, except that the boxes are virtual boxes.Closing a box is accomplished by encrypting the message. Sowhile the message is traveling on the internet, being exposed tohackers and others, it is encrypted using a “key”. Only theowner of the key knows how to open the box and retrieve itscontent.

QuestionThe question faced scientists was how to design a system withthe following properties:

1 A group of particpants can securely communicate witheach other over an open system.

2 How can anyone send a message to bob so no one exceptBob will be able to understand the message.

3 Can messages be “signed’?.

An Application of Number Theory, the RSA Cryptosystem

Page 6: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

DiscussionThis is exactly how business transactions are being conductedon the internet today, except that the boxes are virtual boxes.Closing a box is accomplished by encrypting the message. Sowhile the message is traveling on the internet, being exposed tohackers and others, it is encrypted using a “key”. Only theowner of the key knows how to open the box and retrieve itscontent.

QuestionThe question faced scientists was how to design a system withthe following properties:

1 A group of particpants can securely communicate witheach other over an open system.

2 How can anyone send a message to bob so no one exceptBob will be able to understand the message.

3 Can messages be “signed’?.

An Application of Number Theory, the RSA Cryptosystem

Page 7: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

DiscussionThis is exactly how business transactions are being conductedon the internet today, except that the boxes are virtual boxes.Closing a box is accomplished by encrypting the message. Sowhile the message is traveling on the internet, being exposed tohackers and others, it is encrypted using a “key”. Only theowner of the key knows how to open the box and retrieve itscontent.

QuestionThe question faced scientists was how to design a system withthe following properties:

1 A group of particpants can securely communicate witheach other over an open system.

2 How can anyone send a message to bob so no one exceptBob will be able to understand the message.

3 Can messages be “signed’?.

An Application of Number Theory, the RSA Cryptosystem

Page 8: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

DiscussionThis is exactly how business transactions are being conductedon the internet today, except that the boxes are virtual boxes.Closing a box is accomplished by encrypting the message. Sowhile the message is traveling on the internet, being exposed tohackers and others, it is encrypted using a “key”. Only theowner of the key knows how to open the box and retrieve itscontent.

QuestionThe question faced scientists was how to design a system withthe following properties:

1 A group of particpants can securely communicate witheach other over an open system.

2 How can anyone send a message to bob so no one exceptBob will be able to understand the message.

3 Can messages be “signed’?.

An Application of Number Theory, the RSA Cryptosystem

Page 9: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

DiscussionThis is exactly how business transactions are being conductedon the internet today, except that the boxes are virtual boxes.Closing a box is accomplished by encrypting the message. Sowhile the message is traveling on the internet, being exposed tohackers and others, it is encrypted using a “key”. Only theowner of the key knows how to open the box and retrieve itscontent.

QuestionThe question faced scientists was how to design a system withthe following properties:

1 A group of particpants can securely communicate witheach other over an open system.

2 How can anyone send a message to bob so no one exceptBob will be able to understand the message.

3 Can messages be “signed’?.

An Application of Number Theory, the RSA Cryptosystem

Page 10: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

RSA Public Key System

DiscussionUntil the mid-70’s encryptions were done using private keys.Two persons or institutions that needed to establish securecommunications shared a private key they used for encryption.

The system worked quite well, except for one problem: how toshare keys.

DES, (Data Encryption Standard) was a popular private keysystem that was widely used by many governments andinstitutions.

It was recently replaced by another system, AES (AdvancedEncryption Standard).

In 1976 Rivest, Shamir and Adelman proposed the public keycryptosystem: RSA.

An Application of Number Theory, the RSA Cryptosystem

Page 11: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

RSA Public Key System

DiscussionUntil the mid-70’s encryptions were done using private keys.Two persons or institutions that needed to establish securecommunications shared a private key they used for encryption.

The system worked quite well, except for one problem: how toshare keys.

DES, (Data Encryption Standard) was a popular private keysystem that was widely used by many governments andinstitutions.

It was recently replaced by another system, AES (AdvancedEncryption Standard).

In 1976 Rivest, Shamir and Adelman proposed the public keycryptosystem: RSA.

An Application of Number Theory, the RSA Cryptosystem

Page 12: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

RSA Public Key System

DiscussionUntil the mid-70’s encryptions were done using private keys.Two persons or institutions that needed to establish securecommunications shared a private key they used for encryption.

The system worked quite well, except for one problem: how toshare keys.

DES, (Data Encryption Standard) was a popular private keysystem that was widely used by many governments andinstitutions.

It was recently replaced by another system, AES (AdvancedEncryption Standard).In 1976 Rivest, Shamir and Adelman proposed the public keycryptosystem: RSA.

An Application of Number Theory, the RSA Cryptosystem

Page 13: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

RSA

Each key consisted of two parts, a public part used forencryption and a private part used for decryption.

1 Every message can be coded as an integer M .

2 Public key: (K ,e) where K = pq, p,q prime numbers,gcd(e, (p − 1)(q − 1)) = 1.

3 To encrypt the message M , coded as an integer, wecalculate EM = Me mod K and send EM to the owner ofthe public key (K ,e).

4 Decryption: The key owner first findsd = e−1 mod (p − 1)(q − 1).

5 To retrieve M , the owner of the key (K ,e) calculates:EMd mod K = M .

An Application of Number Theory, the RSA Cryptosystem

Page 14: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

RSA

Each key consisted of two parts, a public part used forencryption and a private part used for decryption.

1 Every message can be coded as an integer M .2 Public key: (K ,e) where K = pq, p,q prime numbers,

gcd(e, (p − 1)(q − 1)) = 1.

3 To encrypt the message M , coded as an integer, wecalculate EM = Me mod K and send EM to the owner ofthe public key (K ,e).

4 Decryption: The key owner first findsd = e−1 mod (p − 1)(q − 1).

5 To retrieve M , the owner of the key (K ,e) calculates:EMd mod K = M .

An Application of Number Theory, the RSA Cryptosystem

Page 15: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

RSA

Each key consisted of two parts, a public part used forencryption and a private part used for decryption.

1 Every message can be coded as an integer M .2 Public key: (K ,e) where K = pq, p,q prime numbers,

gcd(e, (p − 1)(q − 1)) = 1.3 To encrypt the message M , coded as an integer, we

calculate EM = Me mod K and send EM to the owner ofthe public key (K ,e).

4 Decryption: The key owner first findsd = e−1 mod (p − 1)(q − 1).

5 To retrieve M , the owner of the key (K ,e) calculates:EMd mod K = M .

An Application of Number Theory, the RSA Cryptosystem

Page 16: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

RSA

Each key consisted of two parts, a public part used forencryption and a private part used for decryption.

1 Every message can be coded as an integer M .2 Public key: (K ,e) where K = pq, p,q prime numbers,

gcd(e, (p − 1)(q − 1)) = 1.3 To encrypt the message M , coded as an integer, we

calculate EM = Me mod K and send EM to the owner ofthe public key (K ,e).

4 Decryption: The key owner first findsd = e−1 mod (p − 1)(q − 1).

5 To retrieve M , the owner of the key (K ,e) calculates:EMd mod K = M .

An Application of Number Theory, the RSA Cryptosystem

Page 17: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

RSA

Each key consisted of two parts, a public part used forencryption and a private part used for decryption.

1 Every message can be coded as an integer M .2 Public key: (K ,e) where K = pq, p,q prime numbers,

gcd(e, (p − 1)(q − 1)) = 1.3 To encrypt the message M , coded as an integer, we

calculate EM = Me mod K and send EM to the owner ofthe public key (K ,e).

4 Decryption: The key owner first findsd = e−1 mod (p − 1)(q − 1).

5 To retrieve M , the owner of the key (K ,e) calculates:EMd mod K = M .

An Application of Number Theory, the RSA Cryptosystem

Page 18: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Prime numbers, key facts

The following theorems play a central role discussing primesand factorization.

1 T1: GF (p) = {0,1, . . . ,p − 1} is a field (addition andmultiplication are done mod p)

2 T2: GF (p) has primitve elements. α ∈ GF (p) is primitive if{αi | i = 0,1, . . .p − 2} = {0,1,2, . . . ,p − 1}.

3 T3: If p(x) is a polynomial with coefficients in GF (p) andf (β) = 0 then p(x) = (x − β)p1(x) where p1(x) is apolynomial with coefficients in GF (p).

4 T4: A finite field has pn (p prime) elements and is uniqueupto isomorphism.

An Application of Number Theory, the RSA Cryptosystem

Page 19: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Prime numbers, key facts

The following theorems play a central role discussing primesand factorization.

1 T1: GF (p) = {0,1, . . . ,p − 1} is a field (addition andmultiplication are done mod p)

2 T2: GF (p) has primitve elements. α ∈ GF (p) is primitive if{αi | i = 0,1, . . .p − 2} = {0,1,2, . . . ,p − 1}.

3 T3: If p(x) is a polynomial with coefficients in GF (p) andf (β) = 0 then p(x) = (x − β)p1(x) where p1(x) is apolynomial with coefficients in GF (p).

4 T4: A finite field has pn (p prime) elements and is uniqueupto isomorphism.

An Application of Number Theory, the RSA Cryptosystem

Page 20: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Prime numbers, key facts

The following theorems play a central role discussing primesand factorization.

1 T1: GF (p) = {0,1, . . . ,p − 1} is a field (addition andmultiplication are done mod p)

2 T2: GF (p) has primitve elements. α ∈ GF (p) is primitive if{αi | i = 0,1, . . .p − 2} = {0,1,2, . . . ,p − 1}.

3 T3: If p(x) is a polynomial with coefficients in GF (p) andf (β) = 0 then p(x) = (x − β)p1(x) where p1(x) is apolynomial with coefficients in GF (p).

4 T4: A finite field has pn (p prime) elements and is uniqueupto isomorphism.

An Application of Number Theory, the RSA Cryptosystem

Page 21: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Prime numbers, key facts

The following theorems play a central role discussing primesand factorization.

1 T1: GF (p) = {0,1, . . . ,p − 1} is a field (addition andmultiplication are done mod p)

2 T2: GF (p) has primitve elements. α ∈ GF (p) is primitive if{αi | i = 0,1, . . .p − 2} = {0,1,2, . . . ,p − 1}.

3 T3: If p(x) is a polynomial with coefficients in GF (p) andf (β) = 0 then p(x) = (x − β)p1(x) where p1(x) is apolynomial with coefficients in GF (p).

4 T4: A finite field has pn (p prime) elements and is uniqueupto isomorphism.

An Application of Number Theory, the RSA Cryptosystem

Page 22: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Theorem (Fermat’s theorem)

If p is prime and a < p then ap−1 mod p = 1.

Chứng minh.

Since GF (p) is a field for anya ∈ GF (p) {a,2a,3a, . . . , (p − 1)a} = {1,2,3, . . . ,p − 1}.So a · 2a · 3a · · · (p − 1)a = 1 · 2 · 3 · · · (p − 1)ap−1 ·

∏p−1i=1 i =

∏p−1i=1 i mod p ⇒ ap−1 = 1 mod p

An Application of Number Theory, the RSA Cryptosystem

Page 23: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Theorem (Fermat’s theorem)

If p is prime and a < p then ap−1 mod p = 1.

Chứng minh.

Since GF (p) is a field for anya ∈ GF (p) {a,2a,3a, . . . , (p − 1)a} = {1,2,3, . . . ,p − 1}.So a · 2a · 3a · · · (p − 1)a = 1 · 2 · 3 · · · (p − 1)ap−1 ·

∏p−1i=1 i =

∏p−1i=1 i mod p ⇒ ap−1 = 1 mod p

An Application of Number Theory, the RSA Cryptosystem

Page 24: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example

1 Calculate 7341235 mod 11.

2 11 is prime, so 710 mod 11 = 17341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 10

3 Calculate 7341235 mod 341.

4 341 = 31 · 11, 7341235 mod 11 = 10.7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 25: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.

2 11 is prime, so 710 mod 11 = 17341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 10

3 Calculate 7341235 mod 341.

4 341 = 31 · 11, 7341235 mod 11 = 10.7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 26: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.

2 11 is prime, so 710 mod 11 = 17341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 10

3 Calculate 7341235 mod 341.

4 341 = 31 · 11, 7341235 mod 11 = 10.7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 27: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.

4 341 = 31 · 11, 7341235 mod 11 = 10.7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 28: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 10

3 Calculate 7341235 mod 341.

4 341 = 31 · 11, 7341235 mod 11 = 10.7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 29: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.

4 341 = 31 · 11, 7341235 mod 11 = 10.7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 30: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.

4 341 = 31 · 11, 7341235 mod 11 = 10.7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 31: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.4 341 = 31 · 11, 7341235 mod 11 = 10.

7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 32: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.4 341 = 31 · 11, 7341235 mod 11 = 10.

7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.

72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 33: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.4 341 = 31 · 11, 7341235 mod 11 = 10.

7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 2

75 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 34: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.4 341 = 31 · 11, 7341235 mod 11 = 10.

7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.

So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 35: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.4 341 = 31 · 11, 7341235 mod 11 = 10.

7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.

We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 36: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be applied to simplify some intimidatinglooking computations:

Example1 Calculate 7341235 mod 11.2 11 is prime, so 710 mod 11 = 1

7341235 mod 11 = (710)34123 · 75 mod 11 = 75 mod 11 = 103 Calculate 7341235 mod 341.4 341 = 31 · 11, 7341235 mod 11 = 10.

7341235 mod 31 = 7341220715 mod 31 = 715 mod 31.72 mod 31 = 18, 73 mod 31 = 7 · 18 mod 31 =126 mod 31 = 275 mod 31 = 73 · 72 mod 31 = 1.So if x = 7341235 then we have:x mod 11 = 10, x mod 31 = 1.We can now use the Chinese Reaminder Theorem and get:7341235 mod 341 = 32.

An Application of Number Theory, the RSA Cryptosystem

Page 37: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be used to test whether an integer iscomposite (not prime).

Given an integer n, if an−1 mod n 6= 1, a < n then n iscomposite.

But what if an−1 = 1?For example: 2340 mod 341 = 1 but 341 = 11 · 31a1728 mod 1729 = 1 ∀a relatively prime to 1729.

QuestionCan you prove it? It is not difficult, give it a try.

An Application of Number Theory, the RSA Cryptosystem

Page 38: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be used to test whether an integer iscomposite (not prime).

Given an integer n, if an−1 mod n 6= 1, a < n then n iscomposite.

But what if an−1 = 1?For example: 2340 mod 341 = 1 but 341 = 11 · 31a1728 mod 1729 = 1 ∀a relatively prime to 1729.

QuestionCan you prove it? It is not difficult, give it a try.

An Application of Number Theory, the RSA Cryptosystem

Page 39: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Fermat’s theorem can be used to test whether an integer iscomposite (not prime).

Given an integer n, if an−1 mod n 6= 1, a < n then n iscomposite.

But what if an−1 = 1?For example: 2340 mod 341 = 1 but 341 = 11 · 31a1728 mod 1729 = 1 ∀a relatively prime to 1729.

QuestionCan you prove it? It is not difficult, give it a try.

An Application of Number Theory, the RSA Cryptosystem

Page 40: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Question (Challenge)The other day we found the 163 digits long key below on theinternet. It is not prime, easy to check.2Key−1 mod Key 6= 1Can we find its prime factors?

Key =1193098423264097759646037965385887599016380476452728541299175513582355781793126309459269365733778030509749311859187902804005784261377727067235425553086083970158319

QuestionAre there any other ways to factor integers besides trying theGCD of the integer with smaller integers?

An Application of Number Theory, the RSA Cryptosystem

Page 41: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Question (Challenge)The other day we found the 163 digits long key below on theinternet. It is not prime, easy to check.2Key−1 mod Key 6= 1Can we find its prime factors?

Key =1193098423264097759646037965385887599016380476452728541299175513582355781793126309459269365733778030509749311859187902804005784261377727067235425553086083970158319

QuestionAre there any other ways to factor integers besides trying theGCD of the integer with smaller integers?

An Application of Number Theory, the RSA Cryptosystem

Page 42: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Is p really a prime number?

QuestionIs there a way to certify that a given number p is indeed prime?

Theorem (Wallis)

p is prime if and only if (p − 1)! mod p = −1.

An Application of Number Theory, the RSA Cryptosystem

Page 43: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Is p really a prime number?

QuestionIs there a way to certify that a given number p is indeed prime?

Theorem (Wallis)

p is prime if and only if (p − 1)! mod p = −1.

An Application of Number Theory, the RSA Cryptosystem

Page 44: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Let N be an integer. By Fermat’s theorem if N is prime thenaN−1 mod N = 1. This calculation can be executed very fast onintegers with a few thousand digits. This means that if for some1 < a < N − 1, aN−1 mod N 6= 1 then N is definitely not aprime number.

But what can we conclude if aN−1 mod N = 1?

Answer: NOTHING. N can be composite, or prime.

Example

1 2340 mod 341 = 1 but 341 = 11 · 31.2 But 3340 mod 341 = 56 proves that 341 is composite.3 On the other hand, if

gcd(a,1729) = 1 then a1728mod1729 = 1.4 Since φ(1729) = 1729(1− 1

7)(1−1

13)(1−1

19) = 1296 if weselect a randomly we do not have a good chance to find aninteger that will prove that 1729 is not a prime number .

An Application of Number Theory, the RSA Cryptosystem

Page 45: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Let N be an integer. By Fermat’s theorem if N is prime thenaN−1 mod N = 1. This calculation can be executed very fast onintegers with a few thousand digits. This means that if for some1 < a < N − 1, aN−1 mod N 6= 1 then N is definitely not aprime number.

But what can we conclude if aN−1 mod N = 1?

Answer: NOTHING. N can be composite, or prime.

Example

1 2340 mod 341 = 1 but 341 = 11 · 31.2 But 3340 mod 341 = 56 proves that 341 is composite.3 On the other hand, if

gcd(a,1729) = 1 then a1728mod1729 = 1.4 Since φ(1729) = 1729(1− 1

7)(1−1

13)(1−1

19) = 1296 if weselect a randomly we do not have a good chance to find aninteger that will prove that 1729 is not a prime number .

An Application of Number Theory, the RSA Cryptosystem

Page 46: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Let N be an integer. By Fermat’s theorem if N is prime thenaN−1 mod N = 1. This calculation can be executed very fast onintegers with a few thousand digits. This means that if for some1 < a < N − 1, aN−1 mod N 6= 1 then N is definitely not aprime number.

But what can we conclude if aN−1 mod N = 1?

Answer: NOTHING. N can be composite, or prime.

Example

1 2340 mod 341 = 1 but 341 = 11 · 31.2 But 3340 mod 341 = 56 proves that 341 is composite.3 On the other hand, if

gcd(a,1729) = 1 then a1728mod1729 = 1.4 Since φ(1729) = 1729(1− 1

7)(1−1

13)(1−1

19) = 1296 if weselect a randomly we do not have a good chance to find aninteger that will prove that 1729 is not a prime number .

An Application of Number Theory, the RSA Cryptosystem

Page 47: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Let N be an integer. By Fermat’s theorem if N is prime thenaN−1 mod N = 1. This calculation can be executed very fast onintegers with a few thousand digits. This means that if for some1 < a < N − 1, aN−1 mod N 6= 1 then N is definitely not aprime number.

But what can we conclude if aN−1 mod N = 1?

Answer: NOTHING. N can be composite, or prime.

Example1 2340 mod 341 = 1 but 341 = 11 · 31.

2 But 3340 mod 341 = 56 proves that 341 is composite.3 On the other hand, if

gcd(a,1729) = 1 then a1728mod1729 = 1.4 Since φ(1729) = 1729(1− 1

7)(1−1

13)(1−1

19) = 1296 if weselect a randomly we do not have a good chance to find aninteger that will prove that 1729 is not a prime number .

An Application of Number Theory, the RSA Cryptosystem

Page 48: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Let N be an integer. By Fermat’s theorem if N is prime thenaN−1 mod N = 1. This calculation can be executed very fast onintegers with a few thousand digits. This means that if for some1 < a < N − 1, aN−1 mod N 6= 1 then N is definitely not aprime number.

But what can we conclude if aN−1 mod N = 1?

Answer: NOTHING. N can be composite, or prime.

Example1 2340 mod 341 = 1 but 341 = 11 · 31.2 But 3340 mod 341 = 56 proves that 341 is composite.

3 On the other hand, ifgcd(a,1729) = 1 then a1728mod1729 = 1.

4 Since φ(1729) = 1729(1− 17)(1−

113)(1−

119) = 1296 if we

select a randomly we do not have a good chance to find aninteger that will prove that 1729 is not a prime number .

An Application of Number Theory, the RSA Cryptosystem

Page 49: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Let N be an integer. By Fermat’s theorem if N is prime thenaN−1 mod N = 1. This calculation can be executed very fast onintegers with a few thousand digits. This means that if for some1 < a < N − 1, aN−1 mod N 6= 1 then N is definitely not aprime number.

But what can we conclude if aN−1 mod N = 1?

Answer: NOTHING. N can be composite, or prime.

Example1 2340 mod 341 = 1 but 341 = 11 · 31.2 But 3340 mod 341 = 56 proves that 341 is composite.3 On the other hand, if

gcd(a,1729) = 1 then a1728mod1729 = 1.

4 Since φ(1729) = 1729(1− 17)(1−

113)(1−

119) = 1296 if we

select a randomly we do not have a good chance to find aninteger that will prove that 1729 is not a prime number .

An Application of Number Theory, the RSA Cryptosystem

Page 50: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Let N be an integer. By Fermat’s theorem if N is prime thenaN−1 mod N = 1. This calculation can be executed very fast onintegers with a few thousand digits. This means that if for some1 < a < N − 1, aN−1 mod N 6= 1 then N is definitely not aprime number.

But what can we conclude if aN−1 mod N = 1?

Answer: NOTHING. N can be composite, or prime.

Example1 2340 mod 341 = 1 but 341 = 11 · 31.2 But 3340 mod 341 = 56 proves that 341 is composite.3 On the other hand, if

gcd(a,1729) = 1 then a1728mod1729 = 1.4 Since φ(1729) = 1729(1− 1

7)(1−1

13)(1−1

19) = 1296 if weselect a randomly we do not have a good chance to find aninteger that will prove that 1729 is not a prime number .

An Application of Number Theory, the RSA Cryptosystem

Page 51: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Numbers N like 1729 for which aN−1 mod N = 1 ∀a relativelyprime to N are called Carmichael numbers. They are rare, butthere are infinitely many of them.

So Fermat’s theorem is not a good test for primality. We need abetter test.

Theorem (Miller-Rabin Test)

Let N be an integer, N − 1 = 2m · (2k + 1).An integer n is NOT a “composite-witness” for N if:

1 For some 1 ≤ i ≤ m, n(2k+1)2imod N = −1.

2 Or n(2k+1)2imod N = 1 and n2k+1 mod N = 1

In other words, the test fails to prove that N is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 52: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Numbers N like 1729 for which aN−1 mod N = 1 ∀a relativelyprime to N are called Carmichael numbers. They are rare, butthere are infinitely many of them.

So Fermat’s theorem is not a good test for primality. We need abetter test.

Theorem (Miller-Rabin Test)

Let N be an integer, N − 1 = 2m · (2k + 1).An integer n is NOT a “composite-witness” for N if:

1 For some 1 ≤ i ≤ m, n(2k+1)2imod N = −1.

2 Or n(2k+1)2imod N = 1 and n2k+1 mod N = 1

In other words, the test fails to prove that N is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 53: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Numbers N like 1729 for which aN−1 mod N = 1 ∀a relativelyprime to N are called Carmichael numbers. They are rare, butthere are infinitely many of them.

So Fermat’s theorem is not a good test for primality. We need abetter test.

Theorem (Miller-Rabin Test)

Let N be an integer, N − 1 = 2m · (2k + 1).An integer n is NOT a “composite-witness” for N if:

1 For some 1 ≤ i ≤ m, n(2k+1)2imod N = −1.

2 Or n(2k+1)2imod N = 1 and n2k+1 mod N = 1

In other words, the test fails to prove that N is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 54: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Numbers N like 1729 for which aN−1 mod N = 1 ∀a relativelyprime to N are called Carmichael numbers. They are rare, butthere are infinitely many of them.

So Fermat’s theorem is not a good test for primality. We need abetter test.

Theorem (Miller-Rabin Test)

Let N be an integer, N − 1 = 2m · (2k + 1).An integer n is NOT a “composite-witness” for N if:

1 For some 1 ≤ i ≤ m, n(2k+1)2imod N = −1.

2 Or n(2k+1)2imod N = 1 and n2k+1 mod N = 1

In other words, the test fails to prove that N is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 55: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Miller-Rabin Test

Chứng minh.

If p is prime then by Fermat’s theorem ap−1 mod p = 1.So a(p−1)/2 mod p =

√1 = ±1.

If a(p−1)/2 mod p = −1 then the test stops. In other words, it willnot say that p is composite.If a(p−1)/2 mod p = 1 then we calculate a(p−1)/4 mod p = ±1We continue until we reach a2k+1 mod p

We skip the important part of the proof. They proved that if N iscomposite then more than 50% of the integers a < N will becomposite-witnesses. In other words, to test whether an integerp is prime, we randomly select say 100 integers a < p andapply to them the Miller-Rabin test. If the test fails, we assumethat p is a prime number. The probabilty that we made amistake, that is decided that p is prime while in fact it is not, isless then

(12

)100.

An Application of Number Theory, the RSA Cryptosystem

Page 56: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Example

1 1729 is a composite integer. Indeed 1728 = 26 · 33 and31728/2i

mod 1729 = 1 but 31728/64 mod 1729 = 664proving that 1729 is composite.

2 c = 9746347772161 is a Carmichael number.3 39746347772160 mod 9746347772161 = 1.4 39746347772160/2 mod 9746347772161 = 1, no decission.

So we continue.5 39746347772160/4 mod 9746347772161 = 4485448662696

proving that c is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 57: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Example1 1729 is a composite integer. Indeed 1728 = 26 · 33 and

31728/2imod 1729 = 1 but 31728/64 mod 1729 = 664

proving that 1729 is composite.

2 c = 9746347772161 is a Carmichael number.3 39746347772160 mod 9746347772161 = 1.4 39746347772160/2 mod 9746347772161 = 1, no decission.

So we continue.5 39746347772160/4 mod 9746347772161 = 4485448662696

proving that c is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 58: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Example1 1729 is a composite integer. Indeed 1728 = 26 · 33 and

31728/2imod 1729 = 1 but 31728/64 mod 1729 = 664

proving that 1729 is composite.2 c = 9746347772161 is a Carmichael number.

3 39746347772160 mod 9746347772161 = 1.4 39746347772160/2 mod 9746347772161 = 1, no decission.

So we continue.5 39746347772160/4 mod 9746347772161 = 4485448662696

proving that c is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 59: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Example1 1729 is a composite integer. Indeed 1728 = 26 · 33 and

31728/2imod 1729 = 1 but 31728/64 mod 1729 = 664

proving that 1729 is composite.2 c = 9746347772161 is a Carmichael number.3 39746347772160 mod 9746347772161 = 1.

4 39746347772160/2 mod 9746347772161 = 1, no decission.So we continue.

5 39746347772160/4 mod 9746347772161 = 4485448662696proving that c is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 60: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Example1 1729 is a composite integer. Indeed 1728 = 26 · 33 and

31728/2imod 1729 = 1 but 31728/64 mod 1729 = 664

proving that 1729 is composite.2 c = 9746347772161 is a Carmichael number.3 39746347772160 mod 9746347772161 = 1.4 39746347772160/2 mod 9746347772161 = 1, no decission.

So we continue.

5 39746347772160/4 mod 9746347772161 = 4485448662696proving that c is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 61: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Example1 1729 is a composite integer. Indeed 1728 = 26 · 33 and

31728/2imod 1729 = 1 but 31728/64 mod 1729 = 664

proving that 1729 is composite.2 c = 9746347772161 is a Carmichael number.3 39746347772160 mod 9746347772161 = 1.4 39746347772160/2 mod 9746347772161 = 1, no decission.

So we continue.5 39746347772160/4 mod 9746347772161 = 4485448662696

proving that c is composite.

An Application of Number Theory, the RSA Cryptosystem

Page 62: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Factoring

Discussion

1 To implement RSA we need to manufacture large primes.2 The Miller-Rabin test is commonly used for this purpose.3 There are also efficient algorithms to manufacture

“certified” primes.4 Are all large primes safe?

An Application of Number Theory, the RSA Cryptosystem

Page 63: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Factoring

Discussion1 To implement RSA we need to manufacture large primes.

2 The Miller-Rabin test is commonly used for this purpose.3 There are also efficient algorithms to manufacture

“certified” primes.4 Are all large primes safe?

An Application of Number Theory, the RSA Cryptosystem

Page 64: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Factoring

Discussion1 To implement RSA we need to manufacture large primes.2 The Miller-Rabin test is commonly used for this purpose.

3 There are also efficient algorithms to manufacture“certified” primes.

4 Are all large primes safe?

An Application of Number Theory, the RSA Cryptosystem

Page 65: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Factoring

Discussion1 To implement RSA we need to manufacture large primes.2 The Miller-Rabin test is commonly used for this purpose.3 There are also efficient algorithms to manufacture

“certified” primes.

4 Are all large primes safe?

An Application of Number Theory, the RSA Cryptosystem

Page 66: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Factoring

Discussion1 To implement RSA we need to manufacture large primes.2 The Miller-Rabin test is commonly used for this purpose.3 There are also efficient algorithms to manufacture

“certified” primes.4 Are all large primes safe?

An Application of Number Theory, the RSA Cryptosystem

Page 67: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Square roots

Most integers are not perfect squares. Finding the square rootor identifying that it is not a perfect square is very easy. Yet inmodular arithmetic the situation is drastically different.

Half the positive integres mod a prime number p are quadraticresidues. While finding their square roots is not difficult it is a bittrickier than finding the square root of an integer.

Finding the square root of an integer mod p · q where p,q areprimes is dramatically different. Actually it is as difficult asfactoring. In other words, if there was a fast calculation of√

n mod p · q then we would have a fast factorization.

We shall start by learning how to find√

n mod p.

An Application of Number Theory, the RSA Cryptosystem

Page 68: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Square roots

Most integers are not perfect squares. Finding the square rootor identifying that it is not a perfect square is very easy. Yet inmodular arithmetic the situation is drastically different.

Half the positive integres mod a prime number p are quadraticresidues. While finding their square roots is not difficult it is a bittrickier than finding the square root of an integer.

Finding the square root of an integer mod p · q where p,q areprimes is dramatically different. Actually it is as difficult asfactoring. In other words, if there was a fast calculation of√

n mod p · q then we would have a fast factorization.

We shall start by learning how to find√

n mod p.

An Application of Number Theory, the RSA Cryptosystem

Page 69: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Square roots

Most integers are not perfect squares. Finding the square rootor identifying that it is not a perfect square is very easy. Yet inmodular arithmetic the situation is drastically different.

Half the positive integres mod a prime number p are quadraticresidues. While finding their square roots is not difficult it is a bittrickier than finding the square root of an integer.

Finding the square root of an integer mod p · q where p,q areprimes is dramatically different. Actually it is as difficult asfactoring. In other words, if there was a fast calculation of√

n mod p · q then we would have a fast factorization.

We shall start by learning how to find√

n mod p.

An Application of Number Theory, the RSA Cryptosystem

Page 70: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Square roots

Most integers are not perfect squares. Finding the square rootor identifying that it is not a perfect square is very easy. Yet inmodular arithmetic the situation is drastically different.

Half the positive integres mod a prime number p are quadraticresidues. While finding their square roots is not difficult it is a bittrickier than finding the square root of an integer.

Finding the square root of an integer mod p · q where p,q areprimes is dramatically different. Actually it is as difficult asfactoring. In other words, if there was a fast calculation of√

n mod p · q then we would have a fast factorization.

We shall start by learning how to find√

n mod p.

An Application of Number Theory, the RSA Cryptosystem

Page 71: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Recall: GF (p) has primitve elements. Let α be a primitiveelement of GF (p).

2 n is a quadratic residue mod p if and only ifn = α2k mod p.

3 n is a quadratic residue mod p if and only ifn

p−12 mod p = 1.

4 Claim: If n is a quadratice residue mod p then we can findan integer β such that n2m+1β2s mod p = 1

5√

n mod p = nm+1βs mod p6 We will not have to find a primitive element.

An Application of Number Theory, the RSA Cryptosystem

Page 72: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Recall: GF (p) has primitve elements. Let α be a primitiveelement of GF (p).

2 n is a quadratic residue mod p if and only ifn = α2k mod p.

3 n is a quadratic residue mod p if and only ifn

p−12 mod p = 1.

4 Claim: If n is a quadratice residue mod p then we can findan integer β such that n2m+1β2s mod p = 1

5√

n mod p = nm+1βs mod p6 We will not have to find a primitive element.

An Application of Number Theory, the RSA Cryptosystem

Page 73: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Recall: GF (p) has primitve elements. Let α be a primitiveelement of GF (p).

2 n is a quadratic residue mod p if and only ifn = α2k mod p.

3 n is a quadratic residue mod p if and only ifn

p−12 mod p = 1.

4 Claim: If n is a quadratice residue mod p then we can findan integer β such that n2m+1β2s mod p = 1

5√

n mod p = nm+1βs mod p6 We will not have to find a primitive element.

An Application of Number Theory, the RSA Cryptosystem

Page 74: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Recall: GF (p) has primitve elements. Let α be a primitiveelement of GF (p).

2 n is a quadratic residue mod p if and only ifn = α2k mod p.

3 n is a quadratic residue mod p if and only ifn

p−12 mod p = 1.

4 Claim: If n is a quadratice residue mod p then we can findan integer β such that n2m+1β2s mod p = 1

5√

n mod p = nm+1βs mod p6 We will not have to find a primitive element.

An Application of Number Theory, the RSA Cryptosystem

Page 75: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Recall: GF (p) has primitve elements. Let α be a primitiveelement of GF (p).

2 n is a quadratic residue mod p if and only ifn = α2k mod p.

3 n is a quadratic residue mod p if and only ifn

p−12 mod p = 1.

4 Claim: If n is a quadratice residue mod p then we can findan integer β such that n2m+1β2s mod p = 1

5√

n mod p = nm+1βs mod p

6 We will not have to find a primitive element.

An Application of Number Theory, the RSA Cryptosystem

Page 76: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Recall: GF (p) has primitve elements. Let α be a primitiveelement of GF (p).

2 n is a quadratic residue mod p if and only ifn = α2k mod p.

3 n is a quadratic residue mod p if and only ifn

p−12 mod p = 1.

4 Claim: If n is a quadratice residue mod p then we can findan integer β such that n2m+1β2s mod p = 1

5√

n mod p = nm+1βs mod p6 We will not have to find a primitive element.

An Application of Number Theory, the RSA Cryptosystem

Page 77: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Calculate np−1

2 mod p = ±1 (use one of the powermodfunctions).

2 If np−1

2 mod p = −1 stop! n is not a quadratic residue.3 Let p − 1 = 2m(2k + 1).

4 Note: np−1

4 mod p = ±1. Repeat calculating np−1

2j until youget −1 or n2k+1 mod p = 1

5 If np−1

2j = −1 then find a non-quadratic residue β that isβ

p−12 mod p = −1 (easy, just try a few numbers).

6 np−1

2j βp−1

2 mod p = 1

7 Calculate: np−12j+1 β

p−14 mod p = ±1

8 Repeat the same process ubtil you reachn2k+1β2s mod p = 1

An Application of Number Theory, the RSA Cryptosystem

Page 78: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Calculate np−1

2 mod p = ±1 (use one of the powermodfunctions).

2 If np−1

2 mod p = −1 stop! n is not a quadratic residue.

3 Let p − 1 = 2m(2k + 1).

4 Note: np−1

4 mod p = ±1. Repeat calculating np−1

2j until youget −1 or n2k+1 mod p = 1

5 If np−1

2j = −1 then find a non-quadratic residue β that isβ

p−12 mod p = −1 (easy, just try a few numbers).

6 np−1

2j βp−1

2 mod p = 1

7 Calculate: np−12j+1 β

p−14 mod p = ±1

8 Repeat the same process ubtil you reachn2k+1β2s mod p = 1

An Application of Number Theory, the RSA Cryptosystem

Page 79: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Calculate np−1

2 mod p = ±1 (use one of the powermodfunctions).

2 If np−1

2 mod p = −1 stop! n is not a quadratic residue.3 Let p − 1 = 2m(2k + 1).

4 Note: np−1

4 mod p = ±1. Repeat calculating np−1

2j until youget −1 or n2k+1 mod p = 1

5 If np−1

2j = −1 then find a non-quadratic residue β that isβ

p−12 mod p = −1 (easy, just try a few numbers).

6 np−1

2j βp−1

2 mod p = 1

7 Calculate: np−12j+1 β

p−14 mod p = ±1

8 Repeat the same process ubtil you reachn2k+1β2s mod p = 1

An Application of Number Theory, the RSA Cryptosystem

Page 80: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Calculate np−1

2 mod p = ±1 (use one of the powermodfunctions).

2 If np−1

2 mod p = −1 stop! n is not a quadratic residue.3 Let p − 1 = 2m(2k + 1).

4 Note: np−1

4 mod p = ±1. Repeat calculating np−1

2j until youget −1 or n2k+1 mod p = 1

5 If np−1

2j = −1 then find a non-quadratic residue β that isβ

p−12 mod p = −1 (easy, just try a few numbers).

6 np−1

2j βp−1

2 mod p = 1

7 Calculate: np−12j+1 β

p−14 mod p = ±1

8 Repeat the same process ubtil you reachn2k+1β2s mod p = 1

An Application of Number Theory, the RSA Cryptosystem

Page 81: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Calculate np−1

2 mod p = ±1 (use one of the powermodfunctions).

2 If np−1

2 mod p = −1 stop! n is not a quadratic residue.3 Let p − 1 = 2m(2k + 1).

4 Note: np−1

4 mod p = ±1. Repeat calculating np−1

2j until youget −1 or n2k+1 mod p = 1

5 If np−1

2j = −1 then find a non-quadratic residue β that isβ

p−12 mod p = −1 (easy, just try a few numbers).

6 np−1

2j βp−1

2 mod p = 1

7 Calculate: np−12j+1 β

p−14 mod p = ±1

8 Repeat the same process ubtil you reachn2k+1β2s mod p = 1

An Application of Number Theory, the RSA Cryptosystem

Page 82: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Calculate np−1

2 mod p = ±1 (use one of the powermodfunctions).

2 If np−1

2 mod p = −1 stop! n is not a quadratic residue.3 Let p − 1 = 2m(2k + 1).

4 Note: np−1

4 mod p = ±1. Repeat calculating np−1

2j until youget −1 or n2k+1 mod p = 1

5 If np−1

2j = −1 then find a non-quadratic residue β that isβ

p−12 mod p = −1 (easy, just try a few numbers).

6 np−1

2j βp−1

2 mod p = 1

7 Calculate: np−12j+1 β

p−14 mod p = ±1

8 Repeat the same process ubtil you reachn2k+1β2s mod p = 1

An Application of Number Theory, the RSA Cryptosystem

Page 83: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Calculate np−1

2 mod p = ±1 (use one of the powermodfunctions).

2 If np−1

2 mod p = −1 stop! n is not a quadratic residue.3 Let p − 1 = 2m(2k + 1).

4 Note: np−1

4 mod p = ±1. Repeat calculating np−1

2j until youget −1 or n2k+1 mod p = 1

5 If np−1

2j = −1 then find a non-quadratic residue β that isβ

p−12 mod p = −1 (easy, just try a few numbers).

6 np−1

2j βp−1

2 mod p = 1

7 Calculate: np−12j+1 β

p−14 mod p = ±1

8 Repeat the same process ubtil you reachn2k+1β2s mod p = 1

An Application of Number Theory, the RSA Cryptosystem

Page 84: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

√n mod p

1 Calculate np−1

2 mod p = ±1 (use one of the powermodfunctions).

2 If np−1

2 mod p = −1 stop! n is not a quadratic residue.3 Let p − 1 = 2m(2k + 1).

4 Note: np−1

4 mod p = ±1. Repeat calculating np−1

2j until youget −1 or n2k+1 mod p = 1

5 If np−1

2j = −1 then find a non-quadratic residue β that isβ

p−12 mod p = −1 (easy, just try a few numbers).

6 np−1

2j βp−1

2 mod p = 1

7 Calculate: np−12j+1 β

p−14 mod p = ±1

8 Repeat the same process ubtil you reachn2k+1β2s mod p = 1

An Application of Number Theory, the RSA Cryptosystem

Page 85: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Examples

Example

1 p = 3 mod 4.2 This is a very easy case as

p−12 = 2k + 1, n2k+1 mod p = 1 so

√n mod p = nk+1.

3 Let p = 337639.71168819 mod 337639 = 1 (71 is a quadratic residue mod337639).71168820/2 mod 337639 = 234428.2344282 mod 337639 = 71.So√

71 mod 337639 = 234428.

An Application of Number Theory, the RSA Cryptosystem

Page 86: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Examples

Example1 p = 3 mod 4.

2 This is a very easy case asp−1

2 = 2k + 1, n2k+1 mod p = 1 so√

n mod p = nk+1.

3 Let p = 337639.71168819 mod 337639 = 1 (71 is a quadratic residue mod337639).71168820/2 mod 337639 = 234428.2344282 mod 337639 = 71.So√

71 mod 337639 = 234428.

An Application of Number Theory, the RSA Cryptosystem

Page 87: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Examples

Example1 p = 3 mod 4.2 This is a very easy case as

p−12 = 2k + 1, n2k+1 mod p = 1 so

√n mod p = nk+1.

3 Let p = 337639.71168819 mod 337639 = 1 (71 is a quadratic residue mod337639).71168820/2 mod 337639 = 234428.2344282 mod 337639 = 71.So√

71 mod 337639 = 234428.

An Application of Number Theory, the RSA Cryptosystem

Page 88: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Examples

Example1 p = 3 mod 4.2 This is a very easy case as

p−12 = 2k + 1, n2k+1 mod p = 1 so

√n mod p = nk+1.

3 Let p = 337639.71168819 mod 337639 = 1 (71 is a quadratic residue mod337639).71168820/2 mod 337639 = 234428.2344282 mod 337639 = 71.So√

71 mod 337639 = 234428.

An Application of Number Theory, the RSA Cryptosystem

Page 89: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Examples

Example1 p = 3 mod 4.2 This is a very easy case as

p−12 = 2k + 1, n2k+1 mod p = 1 so

√n mod p = nk+1.

3 Let p = 337639.

71168819 mod 337639 = 1 (71 is a quadratic residue mod337639).71168820/2 mod 337639 = 234428.2344282 mod 337639 = 71.So√

71 mod 337639 = 234428.

An Application of Number Theory, the RSA Cryptosystem

Page 90: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Examples

Example1 p = 3 mod 4.2 This is a very easy case as

p−12 = 2k + 1, n2k+1 mod p = 1 so

√n mod p = nk+1.

3 Let p = 337639.71168819 mod 337639 = 1 (71 is a quadratic residue mod337639).

71168820/2 mod 337639 = 234428.2344282 mod 337639 = 71.So√

71 mod 337639 = 234428.

An Application of Number Theory, the RSA Cryptosystem

Page 91: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Examples

Example1 p = 3 mod 4.2 This is a very easy case as

p−12 = 2k + 1, n2k+1 mod p = 1 so

√n mod p = nk+1.

3 Let p = 337639.71168819 mod 337639 = 1 (71 is a quadratic residue mod337639).71168820/2 mod 337639 = 234428.

2344282 mod 337639 = 71.So√

71 mod 337639 = 234428.

An Application of Number Theory, the RSA Cryptosystem

Page 92: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

Examples

Example1 p = 3 mod 4.2 This is a very easy case as

p−12 = 2k + 1, n2k+1 mod p = 1 so

√n mod p = nk+1.

3 Let p = 337639.71168819 mod 337639 = 1 (71 is a quadratic residue mod337639).71168820/2 mod 337639 = 234428.2344282 mod 337639 = 71.So√

71 mod 337639 = 234428.

An Application of Number Theory, the RSA Cryptosystem

Page 93: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.

2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue modp.

3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 94: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.

3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 95: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.3 75 is a quadratic residue.

4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 96: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.

5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 97: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 1

6 75(p−1)/871(p−1)/4 mod p = −1⇒75(p−1)/8713(p−1)/4 mod p = 1.

7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 98: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.

7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 99: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 1

8√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 100: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 2309891

9 Verify: 23098912 mod p = 75.10 We can verify it in yet another way. 75 = 25 · 3. This means

that√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 101: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem

Page 102: An Application of Number Theory, the RSA Cryptosystemfaculty.washington.edu/moishe/hanoiex/Number Theory Applications/Number-Theory...An Application of Number Theory, the RSA Cryptosystem.

1 p = 2701297, p − 1 = 24 · 33 · 132 · 37.2 71(p−1)/2 = 2701296 so 71 is not a quadratic residue mod

p.3 75 is a quadratic residue.4 75(p−1)/4 mod p = 2701296 = −1.5 71(p−1)/2 mod p = −1⇒ 75(p−1)/471(p−1)/2 mod p = 16 75(p−1)/871(p−1)/4 mod p = −1⇒

75(p−1)/8713(p−1)/4 mod p = 1.7 75(p−1)/16713(p−1)/8 = 75168331711012986 mod p = 18√

75 mod p = 75168332/2711012986/2 mod p = 23098919 Verify: 23098912 mod p = 75.

10 We can verify it in yet another way. 75 = 25 · 3. This meansthat√

3 mod p = 2309891/5. Indeed5−1 mod p = 1080519 and 1080519 · 2309891 mod p =1542497 and 15424972 mod p = 3.

An Application of Number Theory, the RSA Cryptosystem