Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
20Activity
0 of .
Results for:
No results containing your search query
P. 1
Modular Arithmetic & RSA Encryption

Modular Arithmetic & RSA Encryption

Ratings:

4.57

(7)
|Views: 4,580 |Likes:
Published by trogsworth
Provides an introduction to modular arithmetic and it's application to encryption via RSA, intended for talented year 10 students (though should be fairly widely applicable)
Provides an introduction to modular arithmetic and it's application to encryption via RSA, intended for talented year 10 students (though should be fairly widely applicable)

More info:

Published by: trogsworth on Mar 23, 2008
Copyright:Attribution Share Alike

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF or read online from Scribd
See more
See less

01/09/2013

pdf

 
Modular Arithmetic & RSA Encryption
Philip Tromanshttp://pjtlog.blogspot.com/March 2008
1 Introduction
With the rise of the internet, information security has become enormously important to every internet user.After all, no-one wants their credit card details stolen when they shop online. All modern cryptography (theart of encoding messages so that only the desired recipient can understand the message) is based on maths,and huge amounts of money are directed at research into these fields. In this talk we intend to explorethe most prominent form of encryption used on the internet (RSA encryption) and some of the theory thatmakes us believe it’s safe to use.As for the exercises in this set of notes, don’t be worried if you can’t do all of them. The first few aregenerally intended to be do-able, but the latter ones are supposed to be hard, and are supposed to stretchyou (hopefully you’ll find them interesting too).
2 Prime numbers
Prime numbers are sometimes said to be the
building blocks
of the number system. A number is
prime
if and only if the only two numbers that divide it are 1 and itself. For example: 11, 17, 23 and 2 are all prime,and 4 and 33 aren’t prime as 4 = 2
×
2 and 33 = 3
×
11. Every number that isn’t prime can be expressed asa product of primes, for example:53158732 = 2
×
2
×
11
×
19
×
63587Note: 1 is
defined 
not to be a prime.
2.1 Coprime numbers
Two numbers are
coprime
if they don’t share any common factors. If they don’t have any common factors,then they definitely can’t have any common prime factors (if you can’t see why that’s true, then think aboutit for a little while or ask someone). So for example, 9 and 10 are coprime as 9 = 3
×
3 and 10 = 2
×
5, and8 and 12 are not coprime as 8 = 2
×
2
×
2 and 12 = 2
×
2
×
3 (both have a factor of 2).Note: 1 is coprime to every number apart from 1 (and anything being coprime to 0 makes no sense).
2.2 Exercises
1. Which of 68, 50, 37, 97, 5, 43 are prime? If not, why not?2. Express 18 as a product of primes.3. Are any two different prime numbers coprime?4. What’s the highest common factor (HCF) of any two coprime numbers?1
 
5. Is
x
3
prime where
x
is any positive integer (i.e. a counting number: 1, 2, 3 ...).6. Consider the sequence of numbers: 41, 43, 47, 53, 61, ...(where the difference between each pair of numbers increases by 2 each time). Are all of these numbers in the sequence (up to infinity) prime?
3 Euler’s Totient Function,
φ
(
x
)
Euler’s totient function is generally written
φ
(
x
), and only exists when
x
is a positive integer. It is definedby:
φ
(
x
) = the number of positive integers less than
x
(and greater than or equal to 1) that are coprime to
x
. For example:
φ
(9) = 6as 1, 2, 4, 5, 7 and 8 are coprime to 9. Also,
φ
(13) = 12as 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 are all coprime to 13.
3.1 Properties
(You might like to write reasons why this is true after it’s been explained on the board).For a prime number
p
:
φ
(
 p
) =
p
1
φ
(
 p
2
) =
p
2
 p
For distinct primes
p
,
q
:
φ
(
 pq
) =
pq
q
 p
+ 1= (
 p
1)(
q
1)
3.2 Exercises
1. Calculate
φ
(16),
φ
(21),
φ
(25),
φ
(7).
4 Modular Arithmetic
You might not have ever heard of modular arithmetic, but the chances are you use it every day. It’s justa posh name for arithmetic on remainders. For example, when you tell the time, if it’s 2pm you say it’s 2o’clock and not 14 o’clock. We say that the time is told
mod 12 
(mod stands for modulo). We write this as:
t
2 (mod 12)What this means is ”when t is divided by 12, the remainder is 2”. Some more examples are: 7
2 (mod 5),6
0 (mod 6).
4.1 Exercises
1. Calculate 7 (mod 3), 6 (mod 4), 100 (mod 9).2. What is
p
+ 3 (mod
p
) for any postive integer
p
bigger than 3?.3. What is
p
2
(mod
p
) for any positive integer
p
?. What about
p
2
+
p
+ 1 (mod
p
)?4. Does 2
x
3 (mod 6) have any solutions i
x
is a positive integer? (if it does, state one, if not thensay why not)5. Solve 2
x
4 (mod 6).2
 
5 Encryption
Encryption is the art of transforming text (called a
plaintext 
) so that it is unreadable unless you have specialknowledge (a
key 
). So, if you want to communicate in secret with someone, you give them a key (and youhave the same key) and encrypt some information for them. If this is intercepted by someone else, then inan ideal world it is useless to them, as they don’t have the key. If the message is received as intended, thenthat person has the key and can decrypt it, and read the contents.
5.1 The Key Distribution Problem
Think of a way of encryption (say swap A with B, B with C, C with D, ..., Z with A). Chances are, you’vethought of something that is
symmetric
. This means that you need the
same
key to decrypt it as to encryptit.
Plaintext CiphertextKey
Now imagine you are somewhere where
all 
your communications are intercepted. How will you get the keyto the recipient? This is what is known as the
key distribution problem 
.What we need is an
asymmetric
cipher, i.e. one where there is a
different 
encryption key and decryptionkey (and ideally it needs to be hard to work out the decryption key from the encryption key).
Plaintext CiphertextEncryption KeyDecryption Key
With this setup, you can publish your encryption key (write it on your door or whatever) and keep yourdecryption key secret. Then, if anyone wants to communicate with you, then they just encrypt it using yourencryption key, and only you should be able to decrypt and read the message. One such algorithm existsand is called RSA (after the initials of its inventors).
6 RSA Encryption
Before we can actually look at the RSA algorithm, we need one more tool. It’s called the Fermat-EulerTheorem.Note: This section is the hardest so far, and takes the ideas from before and makes quite a lot of use of them. Don’t be put off if you don’t understand this straight away. It’s meant to be challenging.
6.1 The Fermat-Euler Theorem
The Fermat-Euler Theorem states that:
a
φ
(
n
)
1 (mod
n
)for all integers
a
in the range 1 ...
n
(not including
n
) that are coprime to
n
. This is quite a complicatedstatement, so read it a few times to make sure you’ve understood it.Proving this isn’t too hard, but we don’t have time to do it now. It requires a bit more background inmodular arithmetic, but if you’re interested then either me or one of your maths teachers would be happy3

Activity (20)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Said Aydemir liked this
Said Aydemir liked this
Lindsay McHugh liked this
Alex Miller liked this
danut89 liked this
smartthinker23 liked this
Jonny Dean liked this
Elva Mckendry liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->