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݀g}=f}[}.ybX\(7K+m5ĤӜ=d&e g/,uEE.*7YS"``'x%h'7hWGx7ӄP($B9EQeԃa~AfRd,3Ӗ9cccZJ'(]l(4^6]'Pd5YΈJ$I(8GR+
i$I'2QG(U_ȏ6,֭fc43`PMNZ.^he&" +D<`D>Oŷ'DP^FKt\v]z,Dr_\N8>j=E===eӂ#m6ΦӀ 30U^NM9$w2rʂ)n=믾jllǵHle^C_O=~5UUpxsmhnDf*ܵkyWVRG6d%ͅkDZiJ@
b2kQI{ɄXfN Raa
Wb"@yBU\mixg<C#Euler Totient Function (n)to compute (n) need to count number of residues to be excluded
in general need prime factorization, but
for p (p prime) (p) = p1
for p.q (p,q prime) (pq) =(p1)x(q1)
eg.
(37) = 36
(21) = (3 1)x(7 1) = 2x6 = 12
iZLZZ+Zi+@( +$Euler's Theorema generalisation of Fermat's Theorem
a(n) = 1 (mod n)
for any a,n where gcd(a,n)=1
eg.
a=3;n=10; (10)=4;
hence 34 = 81 = 1 mod 10
a=2;n=11; (11)=10;
hence 210 = 1024 = 1 mod 11
^8ZZZ`ZZ&
`I %Primality Testing
often need to find large prime numbers
traditionally sieve using trial division
ie. divide by all numbers (primes) in turn less than the square root of the number
only works for small numbers
alternatively can use statistical primality tests based on properties of primes
for which all primes numbers satisfy property
but some composite numbers, called pseudoprimes, also satisfy the property
can use a slower deterministic primality testRZqZQZ{Z.Z6qQ{.>R
&Miller Rabin Algorithmja test based on Fermat s Theorem
algorithm is:
TEST (n) is:
1. Find integers k, q, k > 0, q odd, so that (n 1)=2kq
2. Select a random integer a, 1<a<n 1
3. if aq mod n = 1 then return ( maybe prime");
4. for j = 0 to k 1 do
5. if (a2jq mod n = n1)
then return(" maybe prime ")
6. return ("composite")
/ZZZ/
< 0&. q'Probabilistic Considerations tif MillerRabin returns composite the number is definitely not prime
otherwise is a prime or a pseudoprime
chance it detects a pseudoprime is < 1/4
hence if repeat test with different random a then chance n is prime after t tests is:
Pr(n prime after t tests) = 14t
eg. for t=10 this probability is > 0.99999`MW+. ( (Prime Distribution 8prime number theorem states that primes occur roughly every (ln n) integers
but can immediately ignore evens
so in practice need only test 0.5 ln(n) numbers of size n to locate a prime
note this is only the average
sometimes primes are close together
other times are quite far apart\d=J dH= O )Chinese Remainder Theoremused to speed up modulo computations
if working modulo a product of numbers
eg. mod M = m1m2..mk
Chinese Remainder theorem lets us work in each moduli mi separately
since computational cost is proportional to size, this is faster than working in the full modulus MNN 7p*Chinese Remainder Theoremcan implement CRT in several ways
to compute A(mod M)
first compute all ai = A mod mi separately
determine constants ci below, where Mi = M/mi
then combine results to get answer using:
6ZZZ
!,ZH#
3,!Primitive Roots from Euler s theorem have a(n)mod n=1
consider ammod n=1, GCD(a,n)=1
must exist for m= (n) but may be smaller
once powers reach m, cycle will repeat
if smallest is m= (n) then a is called a primitive root
if p is prime, then successive powers of a "generate" the group mod p
these are useful but relatively hard to find GQ
Q
%0n &  Discrete Logarithms or Indicesthe inverse problem to exponentiation is to find the discrete logarithm of a number modulo p
that is to find x where ax = b mod p
written as x=loga b mod p or x=inda,p(b)
if a is a primitive root then always exists, otherwise may not
x = log3 4 mod 13 (x st 3x = 4 mod 13) has no answer
x = log2 3 mod 13 = 4 by trying successive powers
whilst exponentiation is relatively easy, finding discrete logarithms is generally a hard problem BZiZcZ5/
?
#
+U
dv
> Summary have considered:
prime numbers
Fermat s and Euler s Theorems
Primality Testing
Chinese Remainder Theorem
Discrete Logarithms
&nn.=
7 /!+./356789 :
;<=
>?HS ` %J++..f` Fh;K]Xqm` h` ffif_3` ffΟ` }` RP@hk]Ҧhk]]pb` ff` ѹWff3>?" dd@,?Pd@ l2 " d@l2`" d n?" dd@ @@``PR @ ` `6p>>NNFF0N(
IT
"
cBlCDEF"d@
llll@`"
Gb I
#"I:b ^Z
#"^Z2
T?y@?
"^Z2
Z?yd@?
"
v)2
T?y@?
"% 2
N?@?
"@
2
N?@?
"Q
2
N?@?
"
z2
Z?yd@?
"
_2
Z?d@?
" H
=2
#l?d@?
"f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~Br$7$mNm z ?im7u]9fB*hhvx@`"
J
,
cBmCBDE<FF@
+gm1r*B60r $@`"
A

cBBC0DE F*@
B00*BB@`"o
r
.
c4B~C`DEPFZd@
`ZSB#$*MHZ`Z7T`B~*x*ZB1NZ``*,@`"rR
/
cBC6DE@FJd@
xN$06$$Nx"$@`"R
0
cB<CDE@FJd@
6Z0~6~<Z6B0***0B6Z6Z"$@`"
I2
1
cBCDE0F:d@
rH6rrr@`"z
2
c<BCDETF^@
r`N5*e_/$HZr)A)rr,0@`"Y
3
cTBCDE`Fj@
Bw$HZrwZ`rZB0H24@`"q+:
4
sB+CDEFd@
,,Z*6HZl~*Z~+l+Z+H6`0~lZH60`6%H%Z%l~[\@`@`"2
5
N?@?
"Flb W
6#"W2
7
T?@?
"W2
8
N?@?
".=2
9
T?d@?
"B+2
:
N?@?
".^X2
;
T?d@?
"Rr02
<
N?@?
"b
=#"
2
>
H??
"
2
?
N?d?
"2
@
H??
"7%w2
A
N?d?
"R5d
B
B . "*p
X Click to edit Master title style!!
C
6@. " `
[#Click to edit Master subtitle style$$
D
6`. "` `
V*
E
6. "`
X*
F
6. "` `
X*
B
s*h ? ffif_3___PPT10\.
+D0' 0=+2*`X(
X
X
0 P
>*
X
0
@*d
X
c$ ?
X
0`
0
RClick to edit Master text styles
Second level
Third level
Fourth level
Fifth level!
S
X
6 G _P
>*
X
6E _
@*H
X0h ? 3380___PPT10.@ 0@0(
x
c$AB `
x
c$ AC `
H
0h ? 3380___PPT10.j_$
pP$(
Pr
P SpB'g
r
P SPF/T
H
P0h ? 3380___PPT10.5l0
0(
x
c$0B `}
x
c$F `
H
0h ? 3380___PPT10. 60~
0(
x
c$<B `}
x
c$@F `
^
6A3?
PXH
0h ? 3380___PPT10..b0
0(
x
c$B `}
x
c$PF `
H
0h ? 3380___PPT10. "0
0(
x
c$B `}
x
c$F `
H
0h ? 3380___PPT10.W0
0(
x
c$pB `}
x
c$F `
H
0h ? 3380___PPT10.@`0
0(
x
c$pk#B `}
x
c$k#F `
H
0h ? 3380___PPT10.C.0
0(
x
c$o#B `}
x
c$0o#F `
H
0h ? 3380___PPT10.0
0(
x
c$p#B `}
x
c$Pp#F `
H
0h ? 3380___PPT10.;0
0(
x
c$n#B `}
x
c$pn#F `
H
0h ? 3380___PPT10. q0
0(
x
c$r#B `}
x
c$0r#F `
H
0h ? 3380___PPT10.0
0(
x
c$q#B `}
x
c$Ps#F `
H
0h ? 3380___PPT10.@*
*(
x
c$v#B `}
r
SPv#F `
H
0h ? 3380___PPT10.
ld0(
x
c$t#B `}
x
c$pt#F `m
^
6A3?^
6A3?` 00H
0h ? 3380___PPT10.B0
@0(
x
c$t#B `}
x
c$!F `
H
0h ? 3380___PPT10.g0
P0(
x
c$%B `}
x
c$ %F `
H
0h ? 3380___PPT10. Z0
`0(
x
c$%B `}
x
c$%F `
H
0h ? 3380___PPT10.:[vn(
X
CX
n
S%X
0
The idea of "factoring" a number is important  finding numbers which divide into it. Taking this as far as can go, by factorising all the factors, we can eventually write the number as a product of (powers of) primes  its prime factorisation.H
0h ? 3380___PPT10.`%(
X
CX
S`%X
0
'One of the most useful results of number theory is the Chinese remainder theorem (CRT), so called because it is believed to have been discovered by the Chinese mathematician SunTse in around 100 AD. It is very useful in speeding up some operations in the RSA publickey scheme, since it allows you to calculate modulo factors of your modulus, and then combine the answers to get the actual result.$W8P U Z H
0h ? 3380___PPT10.iM ](
X
CX
S%X
0
_Discrete logs (or indices) share the properties of normal logarithms, and are quite useful. However whilst exponentiation is relatively easy, finding discrete logs is not, in fact is as hard as factoring a number.
It is the inverse problem to exponentiation, and is an example of a problem thats "easy" one way (raising a number to a power), but "hard" the other (finding what power a number is raised to giving the desired answer). Problems with this type of asymmetry are very rare, but are of critical usefulness in modern cryptography. & MH
0h ? 3380___PPT10.`:
me(
X
CX
e
S`%X
0
]One of the useful features of the Chinese remainder theorem is that it provides a way to manipulate (potentially very large) numbers mod M, in terms of tuples of smaller numbers.This can be useful when M is 150 digits or more. However note that it is necessary to know beforehand the factorization of M. See worked examples in Stallings section 8.4.^0.b . b ) H
0h ? 3380___PPT10.@ǠJ"
P( f~f~f~f
X
C
SP
0
Lecture slides by Lawrie Brown for Cryptography and Network Security , 4/e, by William Stallings, Chapter 8 Introduction to Number Theory .
$k"
4p H
0h ? 33KCp( flflfmfm
R
3X
I
C@%X
0
Opening quote. A number of concepts from number theory are essential in the design of publickey cryptographic algorithms, which this chapter will introduce. H
0h ? 33]( flflfmfm
R
3X
CX
0
wA central concern of number theory is the study of prime numbers. Indeed, whole books have been written on the subject.xxx H
0h ? 33ph( fl`@Afm
R
3X
n
C BX
0
Have the concept of relatively prime if two number share no common factors other than 1.
Another common problem is to determine the "greatest common divisor GCD(a,b) which is the largest number that divides into both a & b. H
0h ? 33^( flflfmfm
R
3X
CKX
0
lTwo theorems that play important roles in publickey cryptography are Fermat s theorem and Euler s theorem.
Fermat s theorem (also known as Fermat s Little Theorem ) states an important property of prime numbers. See Stallings section 8.2 for its proof.
>%2) H
0h ? 33NF( flflfmfm
R
3X
L
C`X
0
Now introduce the Euler s totient function (n), defined as the number of positive integers less than n & relatively prime to n.
nb. (1) = 1. BV
h
R
H
0h ? 33E= ( fo
R
3X
C
CX
0
To compute (n) need to count the number of residues to be excluded. In general you need use a complex formula on the prime factorization of n, but have a couple of special cases.Eo H
0h ? 33l,$$( `
$R
$ 3X
*
$ C
X
0
rEuler's Theorem is a generalization of Fermat's Theorem for any number n. See Stallings section 8.2 for its proof.(sds H
$0h ? 339 (( flflfmfm
(R
( 3X
( C@
X
0
For many cryptographic algorithms,it is necessary to select one or more very large prime numbers at random.
Thus we are faced with the task of determining whether a given large number is prime.
Traditionally sieve for primes using trial division of all possible prime factors, but this only works for small numbers.
Alternatively can use repeated statistical primality tests based on properties of primes, and then for certainty, use a slower deterministic primality test, such as the AKS test.
@7D X
H
(0h ? 33n.&0,( flflfmfm
,R
, 3X
,
, CjX
0
VThe algorithm due to Miller and Rabin is typically used to test a large number for primality. See Stallings section 8.3 for its proof, which is based on Fermat s theorem.
,^M&R
P H
,0h ? 33@0F( fkflflfl
0R
0 3X
0 C jX
0
TIf MillerRabin returns composite the number is definitely not prime, otherwise it is either a prime or a pseudoprime. The chance it detects a pseudoprime is < 1/4
So if apply test repeatedly with different values of a, the probabiility that the number is a pseudoprime can be made as small as desired, eg after 10 tests have chance of error < 0.00001
If really need certainty, then would now expend effort to run a deterministic primality proof such as AKS.6*Z
C }
H
00h ? 33P4\( ,
4R
4 3X
4 C
X
0
jA result from number theory, known as the prime number theorem, states that primes near n are spaced on the average one every (ln n) integers. Sine can ignore even numbers, on average need only test 0.5 ln(n) numbers of size n to locate a prime. eg. for numbers round 2^200 would check 0.5ln(2^200) = 69 numbers on average. Is only an average, can see successive odd primes, or long runs of composites.@ tZ " I ) H
40h ? 33cxp^RЀ3ÿlHbP@AL
G@;b`B&V@DTHRNfRR@`G(
/00___PPT10
pph___PPT2001D<4X?%O=;2"+Cryptography and Network SecurityChapter 8+ DFourth Edition
by William Stallings
Lecture slides by Lawrie BrownD T
Oh+'0PX p
'&Cryptography and Network Security 4/eosLecture OverheadsetDr Lawrie Brownr Lr LCMacintosh HD:Users:lpb:admin:consult:PrenticeHall:Slides:ch01.pptP
Lawrie BrownUse20rMicrosoft PowerPointb:a@B@@37;@>jGNPICTNHH
HH ܁fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙8fjvhfghfghfjvhfghfghfڙۙ_f}֬nfxfفefيef}֬nfxfفefيefܙנڙݙkfɋhٳaf{װ:f6LfGDfɋhٳaf{װ:f6LfGDfݙ{ՐWۙ@rݙTfmfh(5W"Ĕƽfnāѱlqffҽ~f%ɐfĎϲfŢfjī˙ffQҺsoĽfnfŢff~ҼuffѬGDfh(5W"Ĕƽfnāѱlqffҽ~f%ɐfĎϲfŢfjī˙ffQҺsoĽfnfŢff~ҼuffѬGDfޙ%vٕٚXrIk;(d_c}y7FoF,foִ09fc}y/>fF&f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")DxQ7I/ř$Dəˁfpf*r"f;Uسv
AEfDjٕټt'fh5SZfpf*r"f;Uسv
AEfDjٕټt'fh5SZfÙ!*ϣ4F{ؑMhP/$;Ocʙȁf0nafC~*f;ق%wGf'gٖ~ٍ
S8o/fhfU?f0nafC~*f;ق%wGf'gٖ~ٍ
S8o/fhfU?f0[?F2j//%gI%Fd^ʙŁf0ٰم~*f;q٬\ӏٱkh}ٱTn1fٟ>f0ٰم~*f;q٬\ӏٱkh}ٱTn1fٟ>f0?Fw圛J"]ʙf/kرi'~*f;Jئ"uٺ#f@խn2fpKXf/kرi'~*f;Jئ"uٺ#f@խn2fpKXf/:?Fo**Y)KYʙf.P4cfD*ff$Je,
#,1Ufd*\O [f<2f\( Df.P4cfD*ff$Je,
#,1Ufd*\O [f<2f\( Df.y'Nf?6o>4!4I 7v&'ZK;(fətfa]f``f,Qd[feZcf^afdYefa]f``f,Qd[feZcf^afdYef4yșf!Qff!Qf'yf.Vff.VfE$fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙fff͙Cffffffffffffffgfffff
fffffffffff
ffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffff ffffffffff fffffffffffffffffffffffffffffff͙fff͙fff͙fff͙^fffffffffffffffffffffffgggggggggggfffffffffff˛fgggggggggggggfffffffffffff˜Ɯځghhhhhhhhhhffffffffff˝ǝׁghhhhhhhhhhhfffffffffff˞Ǟсgiiiiiiiiii
iiffffffffff
ffˠ
Ƞhjjjjjjjjjjjjjjjjjjjfffffffffffffffffffʡǡ5hkkkkffffȣˣģ,hkkkfffǥʥå.illqwmjklkklffܧ0jnnlklnlxnnff۩Ӧө.joo mowttwqoqoff۬ Ϩ'kppmuumpffڮ.kqq vw{{}qqff۱ ɱ0lss
s}}ssffܴ
Ҳǲ.mttyyvxt{tffܷûnvvffκnwwffμoxxffDpzz~z}}zffggijfghiihgfDq~ffgfghijihgfbq}}
}}ff
ggfggijjiggfghijighf
YrffgihfhjihgfghijhfhhfsفffffffhiffhigfghfghhfghgfՁtނffffffffffhhghihfiigfhhgfruބfffffffffffffffffffffffffhfffgfefhjgfvކ/ f/ffffffffffffffffff ffffffgfefiif/ vއ
fffffffff
ffffffff ffff ihedfefefgigf
wމ#fffffffffffffffffffffffifhffihghhghiifeefiif
vx݊"ffffffffffffffffffffffffffffifgiiffffdiddcbbcddfhgffccfgigf"x fefecaacefefhfgififfeffbhfb``ceec``cfiefiifef yÌfffedefebcdc__adda__chfggfiffeffaheaaedeaadhfefghfdfρzĎ
fefddefddfgfggf
iffeffafebbcbcegfefghfdfzǏfdefeeffccfecdffd`]^aegffgfhgfeffbbgcbcbcgfeffdfgffcf{Ȑfedcefedefeffccfccffe_]]^]befgfgiffeefbbfecacefgffdf{ȑ feded`bfbdf_ffe^]`bcdcb`]cefgf
ihffddfb`bdeffedeffefgffef
ƒfdbdecefbef efcff`]]^ede_]cafgf gjhfecdffcbcdeffedefgfeefƓfefeb^\[Z[\]`cefddfddfedff`fdf]^^`dcabdc^`cfgihfbf
}ǔ
fef
_[^__^__^__]^bfdfefddf``fcf
]^_accddabeccb_fgijigfgfdef
}ǔ fefdZ_a\\^_`^]__^`effc`faffZf cfcff`^``bdc`fgijigfgf }Ǖ feffe[b^\]_\ZYYZ\_]^``af``f`ffYfdf_ffe_bcdcb_effbfdfҁ~Ȗfefdf
^`a\^^\adec`[[^aacfYf_fccffeabcbaef~Ȗ fefcf[c]\a\cedecca[\a]cbbfXfcf]f`fcdffebdbefefÁ~ȗfefcf[c^^b^d
eba`^^b_cbcfXfaf\ffefddfddedfeddef~
旾fbf_`acaccbacabbcdfWd`f\ffcfcdc__cfc_^`bddefdbcddf~ʗƗfeccffe]a`addcdcbcf^cf[ffafc_`dffefbeffd^_``ceddbcdf^[^^f``fbbf
feeafb`abaccef^W_]fc]fc^fr fedbdfdbdef^Zbf]cf]cf̾
՜.+,D՜.+,p,
$,4<D
L'arOnscreen ShownsSchool of IT&EE, UNSW@ADFAmZ
ArialTimes New Roman
WingdingsCourier NewTimesRoman
TimesItalicTimesBold
Helveticach01,Cryptography and Network Security Chapter 8+Chapter 8 Introduction to Number Theory Prime NumbersPrime FactorisationRelatively Prime Numbers & GCDFermat's TheoremEuler Totient Function (n)Euler Totient Function (n)Euler's TheoremPrimality TestingMiller Rabin AlgorithmProbabilistic ConsiderationsPrime DistributionChinese Remainder TheoremChinese Remainder TheoremPrimitive RootsDiscrete LogarithmsChapter 8 Introduction to Number Theory++( The Devil said to Daniel Webster: "Set me a task I can't carry out, and I'll give you anything in the world you ask for."
Daniel Webster: "Fair enough. Prove that for n greater than 2, the equation an + bn = cn has no nontrivial solution in the integers."
They agreed on a threeday period for the labor, and the Devil disappeared.
At the end of three days, the Devil presented himself, haggard, jumpy, biting his lip. Daniel WebsDArialBoldca8`Ps8`n&"DTimes New Roman`Ps8`n& DWingdingsRoman`Ps8`n&0DCourier Newman`Ps8`n&1@DTimesRomanman`Ps8`n&PDTimesItalican`Ps8`n&`DTimesBoldcan`Ps8`n&
`.
@n?" dd@ @@``<P'
GG !"#$%&'_b$'[T0CC$$b$Hky_Cb$ӾARNV080!0AA@801+ʚ;0ʚ;g4ddsi06/m
ppp@<4dddd1`gʚ;<4BdBd1`ʚ;<4!d!d1`ʚ;0___PPT10
pph___PPT2001D<4X?%;2"+Cryptography and Network SecurityChapter 8+ DFourth Edition
by William Stallings
Lecture slides by Lawrie BrownD TChapter 8 Introduction to Number Theory++( The Devil said to Daniel Webster: "Set me a task I can't carry out, and I'll give you anything in the world you ask for."
Daniel Webster: "Fair enough. Prove that for n greater than 2, the equation an + bn = cn has no nontrivial solution in the integers."
They agreed on a threeday period for the labor, and the Devil disappeared.
At the end of three days, the Devil presented himself, haggard, jumpy, biting his lip. Daniel Webster said to him, "Well, how did you do at my task? Did you prove the theorem?'
"Eh? No . . . no, I haven't proved it."
"Then I can have whatever I ask for? Money? The Presidency?'
"What? Oh, that of course. But listen! If we could just prove the following two lemmas "
The Mathematical Magpie, Clifton Fadiman
PP
HX
Prime Numbers
prime numbers only have divisors of 1 and self
they cannot be written as a product of other numbers
note: 1 is prime, but is generally not of interest
eg. 2,3,5,7 are prime, 4,6,8,9,10 are not
prime numbers are central to number theory
list of prime number less than 200 is:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 d0j}0j}* Prime Factorisation3to factor a number n is to write it as a product of other numbers: n=a x b x c
note that factoring a number is relatively hard compared to multiplying the factors together to generate the number
the prime factorisation of a number n is when its written as a product of primes
eg. 91=7x13 ; 3600=24x32x52
/z
 Relatively Prime Numbers & GCD(qtwo numbers a, b are relatively prime if have no common divisors apart from 1
eg. 8 & 15 are relatively prime since factors of 8 are 1,2,4,8 and of 15 are 1,3,5,15 and 1 is the only common factor
conversely can determine the greatest common divisor by comparing their prime factorizations and using least powers
eg. 300=21x31x52 18=21x32 hence GCD(18,300)=21x31x50=6
OZwZtZ7ZZ wt6t 1 Fermat's Theorem*ap1 = 1 (mod p)
where p is prime and gcd(a,p)=1
also known as Fermat s Little Theorem
also ap = p (mod p)
useful in public key and primality testing e
+ ,f&+
"Euler Totient Function (n)Ywhen doing arithmetic modulo n
complete set of residues is: 0..n1
reduced set of residues is those numbers (residues) which are relatively prime to n
eg for n=10,
complete set of residues is {0,1,2,3,4,5,6,7,8,9}
reduced set of residues is {1,3,7,9}
number of elements in reduced set of residues is called the Euler Totient Function (n) gY >g<C#Euler Totient Function (n)to compute (n) need to count number of residues to be excluded
in general need prime factorization, but
for p (p prime) (p) = p1
for p.q (p,q prime) (pq) =(p1)x(q1)
eg.
(37) = 36
(21) = (3 1)x(7 1) = 2x6 = 12
iZLZZ+Zi+@( +$Euler's Theorema generalisation of Fermat's Theorem
a(n) = 1 (mod n)
for any a,n where gcd(a,n)=1
eg.
a=3;n=10; (10)=4;
hence 34 = 81 = 1 mod 10
a=2;n=11; (11)=10;
hence 210 = 1024 = 1 mod 11
^8ZZZ`ZZ&
`I %Primality Testing
often need to find large prime numbers
traditionally sieve using trial division
ie. divide by all numbers (primes) in turn less than the square root of the number
only works for small numbers
alternatively can use statistical primality tests based on properties of primes
for which all primes numbers satisfy property
but some composite numbers, called pseudoprimes, also satisfy the property
can use a slower deterministic primality testRZqZQZ{Z.Z6qQ{.>R
&Miller Rabin Algorithmja test based on Fermat s Theorem
algorithm is:
TEST (n) is:
1. Find integers k, q, k > 0, q odd, so that (n 1)=2kq
2. Select a random integer a, 1<a<n 1
3. if aq mod n = 1 then return ( maybe prime");
4. for j = 0 to k 1 do
5. if (a2jq mod n = n1)
then return(" maybe prime ")
6. return ("composite")
/ZZZ/
< 0&. q'Probabilistic Considerations tif MillerRabin returns composite the number is definitely not prime
otherwise is a prime or a pseudoprime
chance it detects a pseudoprime is < 1/4
hence if repeat test with different random a then chance n is prime after t tests is:
Pr(n prime after t tests) = 14t
eg. for t=10 this probability is > 0.99999`MW+. ( (Prime Distribution 8prime number theorem states that primes occur roughly every (ln n) integers
but can immediately ignore evens
so in practice need only test 0.5 ln(n) numbers of size n to locate a prime
note this is only the average
sometimes primes are close together
other times are quite far apart\d=J dH= O )Chinese Remainder Theoremused to speed up modulo computations
if working modulo a product of numbers
eg. mod M = m1m2..mk
Chinese Remainder theorem lets us work in each moduli mi separately
since computational cost is proportional to size, this is faster than working in the full modulus MNN 7p*Chinese Remainder Theoremcan implement CRT in several ways
to compute A(mod M)
first compute all ai = A mod mi separately
determine constants ci below, where Mi = M/mi
then combine results to get answer using:
6ZZZ
!,ZH#
3,!Primitive Roots from Euler s theorem have a(n)mod n=1
consider am=1 (mod n), GCD(a,n)=1
must exist for m = (n) but may be smaller
once powers reach m, cycle will repeat
if smallest is m = (n) then a is called a primitive root
if p is prime, then successive powers of a "generate" the group mod p
these are useful but relatively hard to find ,JR
;
%0d &  Discrete Logarithmsthe inverse problem to exponentiation is to find the discrete logarithm of a number modulo p
that is to find x such that y = gx (mod p)
this is written as x = logg y (mod p)
if g is a primitive root then it always exists, otherwise it may not, eg.
x = log3 4 mod 13 has no answer
x = log2 3 mod 13 = 4 by trying successive powers
whilst exponentiation is relatively easy, finding discrete logarithms is generally a hard problem ZTZcZ5'J
+U
Z~
F Summary have considered:
prime numbers
Fermat s and Euler s Theorems & (n)
Primality Testing
Chinese Remainder Theorem
Discrete Logarithms
&vvB?
7 /!+./356789 :
;<=
>?AB0
@0(
x
c$t#B `}
x
c$!F `
H
0h ? 3380___PPT10.g0
P0(
x
c$%B `}
x
c$ %F `
H
0h ? 3380___PPT10. Z0
`0(
x
c$%B `}
x
c$%F `
H
0h ? 3380___PPT10.:[! 1(
X
CX
S%X
0
3Discrete logarithms are fundamental to a number of publickey algorithms, including DiffieHellman key exchange and the digital signature algorithm (DSA).
Discrete logs (or indices) share the properties of normal logarithms, and are quite useful. The logarithm of a number is defined to be the power to which some positive base (except 1) must be raised in order to equal that number. If working with modulo arithmetic, and the base is a primitive root, then an integral discrete logarithm exists for any residue.
However whilst exponentiation is relatively easy, finding discrete logs is not, in fact is as hard as factoring a number. This is an example of a problem that is "easy" one way (raising a number to a power), but "hard" the other (finding what power a number is raised to giving the desired answer). Problems with this type of asymmetry are very rare, but are of critical usefulness in modern cryptography. .]
HS H
0h ? 3380___PPT10.`:
!`8F( flflfmfm
8R
8 3X
8 CИX
0
TConsider the powers of an integer modulo n. By Eulers theorem, for every relatively prime a, there is at least one power equal to 1 (being (n)), but there may be a smaller value. If the smallest value is m = (n) then a is called a primitive root. If n is prime, then the powers of a primitive root generate all residues mod n. Such generators are very useful, and are used in a number of publickey algorithms, but they are relatively hard to find.Z>
N. V * H
80h ? 33p<*( flflfmfm
<R
< 3X
< C
X
0
8Chapter summary. H
<0h ? 33r,S,01i١A SB`0H(
C/0DArialBoldca(PPs(Pn&"DTimes New RomanPPs(Pn& DWingdingsRomanPPs(Pn&0DCourier NewmanPPs(Pn&1@DTimesRomanmanPPs(Pn&PDTimesItalicanPPs(Pn&`DTimesBoldcanPPs(Pn&
`.
@n?" dd@ @@``LT(
GG !"#$%&'(_b$'[T0CC$$b$Hky_Cb$ӾARNV080!0AA@801+ʚ;0ʚ;g4ddsi0p6/m
ppp@<4dddd1`gʚ;<4BdBd1`ʚ;<4!d!d1`ʚ;0___PPT10
pph___PPT2001D<4X?%O=;2"+Cryptography and Network SecurityChapter 8+ DFourth Edition
by William Stallings
Lecture slides by Lawrie BrownD TChapter 8 Introduction to Number Theory++( The Devil said to Daniel Webster: "Set me a task I can't carry out, and I'll give you anything in the world you ask for."
Daniel Webster: "Fair enough. Prove that for n greater than 2, the equation an + bn = cn has no nontrivial solution in the integers."
They agreed on a threeday period for the labor, and the Devil disappeared.
At the end of three days, the Devil presented himself, haggard, jumpy, biting his lip. Daniel Webster said to him, "Well, how did you do at my task? Did you prove the theorem?'
"Eh? No . . . no, I haven't proved it."
"Then I can have whatever I ask for? Money? The Presidency?'
"What? Oh, that of course. But listen! If we could just prove the following two lemmas "
The Mathematical Magpie, Clifton Fadiman
PP
HX
Prime Numbers
prime numbers only have divisors of 1 and self
they cannot be written as a product of other numbers
note: 1 is prime, but is generally not of interest
eg. 2,3,5,7 are prime, 4,6,8,9,10 are not
prime numbers are central to number theory
list of prime number less than 200 is:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 d0j}0j}* Prime Factorisation3to factor a number n is to write it as a product of other numbers: n=a x b x c
note that factoring a number is relatively hard compared to multiplying the factors together to generate the number
the prime factorisation of a number n is when its written as a product of primes
eg. 91=7x13 ; 3600=24x32x52
/z
 Relatively Prime Numbers & GCD(qtwo numbers a, b are relatively prime if have no common divisors apart from 1
eg. 8 & 15 are relatively prime since factors of 8 are 1,2,4,8 and of 15 are 1,3,5,15 and 1 is the only common factor
conversely can determine the greatest common divisor by comparing their prime factorizations and using least powers
eg. 300=21x31x52 18=21x32 hence GCD(18,300)=21x31x50=6
OZwZtZ7ZZ wt6t 1 Fermat's Theorem*ap1 = 1 (mod p)
where p is prime and gcd(a,p)=1
also known as Fermat s Little Theorem
also ap = p (mod p)
useful in public key and primality testing e
+ ,f&+
"Euler Totient Function (n)Ywhen doing arithmetic modulo n
complete set of residues is: 0..n1
reduced set of residues is those numbers (residues) which are relatively prime to n
eg for n=10,
complete set of residues is {0,1,2,3,4,5,6,7,8,9}
reduced set of residues is {1,3,7,9}
number of elements in reduced set of residues is called the Euler Totient Function (n) gY >g<C#Euler Totient Function (n)to compute (n) need to count number of residues to be excluded
in general need prime factorization, but
for p (p prime) (p) = p1
for p.q (p,q prime) (pq) =(p1)x(q1)
eg.
(37) = 36
(21) = (3 1)x(7 1) = 2x6 = 12
iZLZZ+Zi+@( +$Euler's Theorema generalisation of Fermat's Theorem
a(n) = 1 (mod n)
for any a,n where gcd(a,n)=1
eg.
a=3;n=10; (10)=4;
hence 34 = 81 = 1 mod 10
a=2;n=11; (11)=10;
hence 210 = 1024 = 1 mod 11
^8ZZZ`ZZ&
`I %Primality Testing
often need to find large prime numbers
traditionally sieve using trial division
ie. divide by all numbers (primes) in turn less than the square root of the number
only works for small numbers
alternatively can use statistical primality tests based on properties of primes
for which all primes numbers satisfy property
but some composite numbers, called pseudoprimes, also satisfy the property
can use a slower deterministic primality testRZqZQZ{Z.Z6qQ{.>R
&Miller Rabin Algorithmja test based on Fermat s Theorem
algorithm is:
TEST (n) is:
1. Find integers k, q, k > 0, q odd, so that (n 1)=2kq
2. Select a random integer a, 1<a<n 1
3. if aq mod n = 1 then return ( maybe prime");
4. for j = 0 to k 1 do
5. if (a2jq mod n = n1)
then return(" maybe prime ")
6. return ("composite")
/ZZZ/
< 0&. q'Probabilistic Considerations tif MillerRabin returns composite the number is definitely not prime
otherwise is a prime or a pseudoprime
chance it detects a pseudoprime is < 1/4
hence if repeat test with different random a then chance n is prime after t tests is:
Pr(n prime after t tests) = 14t
eg. for t=10 this probability is > 0.99999`MW+. ( (Prime Distribution 8prime number theorem states that primes occur roughly every (ln n) integers
but can immediately ignore evens
so in practice need only test 0.5 ln(n) numbers of size n to locate a prime
note this is only the average
sometimes primes are close together
other times are quite far apart\d=J dH= O )Chinese Remainder Theoremused to speed up modulo computations
if working modulo a product of numbers
eg. mod M = m1m2..mk
Chinese Remainder theorem lets us work in each moduli mi separately
since computational cost is proportional to size, this is faster than working in the full modulus MNN 7p*Chinese Remainder Theoremcan implement CRT in several ways
to compute A(mod M)
first compute all ai = A mod mi separately
determine constants ci below, where Mi = M/mi
then combine results to get answer using:
6ZZZ
!,ZH#
3,!Primitive Roots from Euler s theorem have a(n)mod n=1
consider am=1 (mod n), GCD(a,n)=1
must exist for m = (n) but may be smaller
once powers reach m, cycle will repeat
if smallest is m = (n) then a is called a primitive root
if p is prime, then successive powers of a "generate" the group mod p
these are useful but relatively hard to find ,JR
;
%0d &  Discrete Logarithmsthe inverse problem to exponentiation is to find the discrete logarithm of a number modulo p
that is to find x such that y = gx (mod p)
this is written as x = logg y (mod p)
if g is a primitive root then it always exists, otherwise it may not, eg.
x = log3 4 mod 13 has no answer
x = log2 3 mod 13 = 4 by trying successive powers
whilst exponentiation is relatively easy, finding discrete logarithms is generally a hard problem ZTZcZ5'J
+U
Z~
F Summary have considered:
prime numbers
Fermat s and Euler s Theorems & (n)
Primality Testing
Chinese Remainder Theorem
Discrete Logarithms
&vvB?
7 /!+./356789 :
;<=
>?ABsx,,
j eg{HH(dh 0@( t
@
@
0Ѝ
P
T*
@
0Ї
V*
@
6P
`P
T*
@
6P
`
V* H
@0h ? 33r:Cr"CPZH(
C*/0`DArialicaca Ps n&"DTimes New Roman Ps n& DWingdingsRomanicaca Ps n&"DTimes New Roman Ps n& DWingdingsRoman Ps n&0DCourier Newman Ps n&@DTimesRomanman Ps n&PDTimesItalican Ps n&`DTimesBoldcan Ps n&pDHelveticacan Ps n&
`.
@n?" dd@ @@``TT(
}
!"#$%&'()*+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{~
#&$GG !"%'(_b$'[T0CC$$b$Hky_Cb$ӾARNV080!0AA@801+ʚ;0ʚ;g4ddsi0@0m
xppp@<4dddd1`gʚ;<4BdBd1`ʚ;<4!d!d1`ʚ;0___PPT10
pph___PPT2001D<4X?%O=<2"+Cryptography and Network SecurityChapter 8+ DFourth Edition
by William Stallings
Lecture slides by Lawrie BrownD TChapter 8 Introduction to Number Theory++( The Devil said to Daniel Webster: "Set me a task I can't carry out, and I'll give you anyter said to him, "Well, how did you do at my task? Did you prove the theorem?'
"Eh? No . . . no, I haven't proved it."
"Then I can have whatever I ask for? Money? The Presidency?'
"What? Oh, that of course. But listen! If we could just prove the following two lemmas "
The Mathematical Magpie, Clifton Fadiman
PP
HX
Prime Numbers
prime numbers only have divisors of 1 and self
they cannot be written as a product of other numbers
note: 1 is prime, but is generally not of interest
eg. 2,3,5,7 are prime, 4,6,8,9,10 are not
prime numbers are central to number theory
list of prime number less than 200 is:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 d0j}0j}* Prime Factorisation3to factor a number n is to write it as a product of other numbers: n=a x b x c
note that factoring a number is relatively hard compared to multiplying the factors together to generate the number
the prime factorisation of a number n is when its written as a product of primes
eg. 91=7x13 ; 3600=24x32x52
/z
 Relatively Prime Numbers & GCD(qtwo numbers a, b are relatively prime if have no common divisors apart from 1
eg. 8 & 15 are relatively prime since factors of 8 are 1,2,4,8 and of 15 are 1,3,5,15 and 1 is the only common factor
conversely can determine the greatest common divisor by comparing their prime factorizations and using least powers
eg. 300=21x31x52 18=21x32 hence GCD(18,300)=21x31x50=6
OZwZtZ7ZZ wt6t 1 Fermat's Theorem*ap1 = 1 (mod p)
where p is prime and gcd(a,p)=1
also known as Fermat s Little Theorem
also ap = p (mod p)
useful in public key and primality testing e
+ ,f&+
"Euler Totient Function (n)Ywhen doing arithmetic modulo n
complete set of residues is: 0..n1
reduced set of residues is those numbers (residues) which are relatively prime to n
eg for n=10,
complete set of residues is {0,1,2,3,4,5,6,7,8,9}
reduced set of residues is {1,3,7,9}
number of elements in reduced set of residues is called the Euler Totient Function (n) gY >g<C#Euler Totient Function (n)to compute (n) need to count number of residues to be excluded
in general need prime factorization, but
for p (p prime) (p) = p1
for p.q (p,q prime) (pq) =(p1)x(q1)
eg.
(37) = 36
(21) = (3 1)x(7 1) = 2x6 = 12
iZLZZ+Zi+@( +$Euler's Theorema generalisation of Fermat's Theorem
a(n) = 1 (mod n)
for any a,n where gcd(a,n)=1
eg.
a=3;n=10; (10)=4;
hence 34 = 81 = 1 mod 10
a=2;n=11; (11)=10;
hence 210 = 1024 = 1 mod 11
^8ZZZ`ZZ&
`I %Primality Testing
often need to find large prime numbers
traditionally sieve using trial division
ie. divide by all numbers (primes) in turn less than the square root of the number
only works for small numbers
alternatively can use statistical primality tests based on properties of primes
for which all primes numbers satisfy property
but some composite numbers, called pseudoprimes, also satisfy the property
can use a slower deterministic primality testRZqZQZ{Z.Z6qQ{.>R
&Miller Rabin Algorithmja test based on Fermat s Theorem
algorithm is:
TEST (n) is:
1. Find integers k, q, k > 0, q odd, so that (n 1)=2kq
2. Select a random integer a, 1<a<n 1
3. if aq mod n = 1 then return ( maybe prime");
4. for j = 0 to k 1 do
5. if (a2jq mod n = n1)
then return(" maybe prime ")
6. return ("composite")
/ZZZ/
< 0&. q'Probabilistic Considerations tif MillerRabin returns composite the number is definitely not prime
otherwise is a prime or a pseudoprime
chance it detects a pseudoprime is < 1/4
hence if repeat test with different random a then chance n is prime after t tests is:
Pr(n prime after t tests) = 14t
eg. for t=10 this probability is > 0.99999`MW+. ( (Prime Distribution 8prime number theorem states that primes occur roughly every (ln n) integers
but can immediately ignore evens
so in practice need only test 0.5 ln(n) numbers of size n to locate a prime
note this is only the average
sometimes primes are close together
other times are quite far apart\d=J dH= O )Chinese Remainder Theoremused to speed up modulo computations
if working modulo a product of numbers
eg. mod M = m1m2..mk
Chinese Remainder theorem lets us work in each moduli mi separately
since computational cost is proportional to size, this is faster than working in the full modulus MNN 7p*Chinese Remainder Theoremcan implement CRT in several ways
to compute A(mod M)
first compute all ai = A mod mi separately
determine constants ci below, where Mi = M/mi
then combine results to get answer using:
6ZZZ
!,6H+C,!Primitive Roots from Euler s theorem have a(n)mod n=1
consider am=1 (mod n), GCD(a,n)=1
must exist for m = (n) but may be smaller
once powers reach m, cycle will repeat
if smallest is m = (n) then a is called a primitive root
if p is prime, then successive powers of a "generate" the group mod p
these are useful but relatively hard to find ,JR
;
%0d &  Discrete Logarithmsthe inverse problem to exponentiation is to find the discrete logarithm of a number modulo p
that is to find x such that y = gx (mod p)
this is written as x = logg y (mod p)
if g is a primitive root then it always exists, otherwise it may not, eg.
x = log3 4 mod 13 has no answer
x = log2 3 mod 13 = 4 by trying successive powers
whilst exponentiation is relatively easy, finding discrete logarithms is generally a hard problem ZTZcZ5'J
+U
Z~
F Summary have considered:
prime numbers
Fermat s and Euler s Theorems & (n)
Primality Testing
Chinese Remainder Theorem
Discrete Logarithms
&vvD?
7 /!+./356789 :
;<=
>?ABsx,,
j egHH(dh q(
X
CX
thing in the world you ask for."
Daniel Webster: "Fair enough. Prove that for n greater than 2, the equation an + bn = cn has no nontrivial solution in the integers."
They agreed on a threeday period for the labor, and the Devil disappeared.
At the end o
SX
0
oThe idea of "factoring" a number is important  finding numbers which divide into it. Taking this as far as can go, by factorising all the factors, we can eventually write the number as a product of (powers of) primes  its prime factorisation. Note also that factoring a number is relatively hard compared to multiplying the factors together to generate the number.
H
0h ? 3380___PPT10.`0(
X
CX
SX
0
One of the most useful results of number theory is the Chinese remainder theorem (CRT), so called because it is believed to have been discovered by the Chinese mathematician SunTse in around 100 AD. It is very useful in speeding up some operations in the RSA publickey scheme, since it allows you to do perform calculations modulo factors of your modulus, and then combine the answers to get the actual result. Since the computational cost is proportional to size, this is faster than working in the full modulus sized modulus.$WP T Z uH
0h ? 3380___PPT10.iH( flflfmfm
R
3X
C X
0
VA central concern of number theory is the study of prime numbers. Indeed, whole books have been written on the subject. An integer p>1 is a prime number if and only if its only divisors are 1 and itself. Prime numbers play a critical role in number theory and in the techniques discussed in this chapter. Stallings Table 8.1 (excerpt above) shows the primes less than 2000. Note the way the primes are distributed. In particular note the number of primes in each range of 100 numbers.(0& X H
0h ? 33.~( flflfmfm
R
3X
CX
0
Two theorems that play important roles in publickey cryptography are Fermat s theorem and Euler s theorem.
Fermat s theorem (also known as Fermat s Little Theorem) as listed above, states an important property of prime numbers. See Stallings section 8.2 for its proof.
>%B) H
0h ? 33$t( flflfmfm
R
3X
CX
0
Now introduce the Euler s totient function (n), defined as the number of positive integers less than n & relatively prime to n. Note the term residue refers to numbers less than some modulus, and the reduced set of residues to those numbers (residues) which are relatively prime to the modulus (n). Note by convention that (1) = 1. VS^d v
H
0h ? 33NF ( fo
R
3X
L
CX
0
To compute (n) need to count the number of residues to be excluded. In general you need use a complex formula on the prime factorization of n, but have a couple of special cases as shown.Ex H
0h ? 33I (( flflfmfm
(R
( 3X
( CpX
0
For many cryptographic functions it is necessary to select one or more very large prime numbers at random.
Thus we are faced with the task of determining whether a given large number is prime.
Traditionally sieve for primes using trial division of all possible prime factors of some number, but this only works for small numbers.
Alternatively can use repeated statistical primality tests based on properties of primes, and then for certainty, use a slower deterministic primality test, such as the AKS test.
@FF
W H
(0h ? 33@8,( flflfmfm
,R
, 3X
>
, CЈX
0
hThe algorithm shown is due to Miller and Rabin is typically used to test a large number for primality. See Stallings section 8.3 for its proof, which is based on Fermat s theorem.
,gM&\ P H
,0h ? 33 4L( ,
4R
4 3X
4 C0X
0
ZA result from number theory, known as the prime number theorem, states that primes near n are spaced on the average one every (ln n) integers. Since you can ignore even numbers, on average need only test 0.5 ln(n) numbers of size n to locate a prime. eg. for numbers round 2^200 would check 0.5ln(2^200) = 69 numbers on average. This is only an average, can see successive odd primes, or long runs of composites.@ Z N ) H
40h ? 33p<,( flflfmfm
<R
< 3X
< C*X
0
:Chapter 8 summary. H
<0h ? 33rL!HE+H6aM80aQUZ< Y]a?2eB6i"kC H(
C*/0`DArialRdO)Q/3HPictures7PowerPoint Document(ZSummaryInformation(PM
!"#$%&'()*+,./0123456789:;<=>?@ABCDEFGHIJKLNPQRSqUVWXYZ[\]^_`abcdefghijklmnoprstuvwxyz{}~DocumentSummaryInformation8Current User1
SummaryFonts UsedDesign Template
Slide TitlesP :B_PID_LINKBASE'A)_6&William StallingsTf three days, the Devil presented himself, haggard, jumpy, biting his lip. Daniel Webster said to him, "Well, how did you do at my task? Did you prove the theorem?'
"Eh? No . . . no, I haven't proved it."
"Then I can have whatever I ask for? Money? The Presidency?'
"What? Oh, that of course. But listen! If we could just prove the following two lemmas "
The Mathematical Magpie, Clifton Fadiman
PP
HX
Prime Numbers
prime numbers only have divisors of 1 and self
they cannot be written as a product of other numbers
note: 1 is prime, but is generally not of interest
eg. 2,3,5,7 are prime, 4,6,8,9,10 are not
prime numbers are central to number theory
list of prime number less than 200 is:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 d0j}0j}* Prime Factorisation3to factor a number n is to write it as a product of other numbers: n=a x b x c
note that factoring a number is relatively hard compared to multiplying the factors together to generate the number
the prime factorisation of a number n is when its written as a product of primes
eg. 91=7x13 ; 3600=24x32x52
/z
 Relatively Prime Numbers & GCD(qtwo numbers a, b are relatively prime if have no common divisors apart from 1
eg. 8 & 15 are relatively prime since factors of 8 are 1,2,4,8 and of 15 are 1,3,5,15 and 1 is the only common factor
conversely can determine the greatest common divisor by comparing their prime factorizations and using least powers
eg. 300=21x31x52 18=21x32 hence GCD(18,300)=21x31x50=6
OZwZtZ7ZZ wt:t 1 Fermat's Theorem*ap1 = 1 (mod p)
where p is prime and gcd(a,p)=1
also known as Fermat s Little Theorem
also ap = p (mod p)
useful in public key and primality testing e
+ ,l&+
"Euler Totient Function (n)Ywhen doing arithmetic modulo n
complete set of residues is: 0..n1
reduced set of residues is those numbers (residues) which are relatively prime to n
eg for n=10,
complete set of residues is {0,1,2,3,4,5,6,7,8,9}
reduced set of residues is {1,3,7,9}
number of elements in reduced set of residues is called the Euler Totient Function (n) gY >g<C#Euler Totient Function (n)to compute (n) need to count number of residues to be excluded
in general need prime factorization, but
for p (p prime) (p) = p1
for p.q (p,q prime) (pq) =(p1)x(q1)
eg.
(37) = 36
(21) = (3 1)x(7 1) = 2x6 = 12
iZLZZ+Zi+@( +$Euler's Theorema generalisation of Fermat's Theorem
a(n) = 1 (mod n)
for any a,n where gcd(a,n)=1
eg.
a=3;n=10; (10)=4;
hence 34 = 81 = 1 mod 10
a=2;n=11; (11)=10;
hence 210 = 1024 = 1 mod 11
^8ZZZ`ZZ&
bI %Primality Testing
often need to find large prime numbers
traditionally sieve using trial division
ie. divide by all numbers (primes) in turn less than the square root of the number
only works for small numbers
alternatively can use statistical primality tests based on properties of primes
for which all primes numbers satisfy property
but some composite numbers, called pseudoprimes, also satisfy the property
can use a slower deterministic primality testRZqZQZ{Z.Z6qQ{.>R
&Miller Rabin Algorithmja test based on Fermat s Theorem
algorithm is:
TEST (n) is:
1. Find integers k, q, k > 0, q odd, so that (n 1)=2kq
2. Select a random integer a, 1<a<n 1
3. if aq mod n = 1 then return ( maybe prime");
4. for j = 0 to k 1 do
5. if (a2jq mod n = n1)
then return(" maybe prime ")
6. return ("composite")
/ZZZ/
< 0(. q'Probabilistic Considerations tif MillerRabin returns composite the number is definitely not prime
otherwise is a prime or a pseudoprime
chance it detects a pseudoprime is < 1/4
hence if repeat test with different random a then chance n is prime after t tests is:
Pr(n prime after t tests) = 14t
eg. for t=10 this probability is > 0.99999`MW+2 ( (Prime Distribution 8prime number theorem states that primes occur roughly every (ln n) integers
but can immediately ignore evens
so in practice need only test 0.5 ln(n) numbers of size n to locate a prime
note this is only the average
sometimes primes are close together
other times are quite far apart\d=J dN= O )Chinese Remainder Theoremused to speed up modulo computations
if working modulo a product of numbers
eg. mod M = m1m2..mk
Chinese Remainder theorem lets us work in each moduli mi separately
since computational cost is proportional to size, this is faster than working in the full modulus MNN 7p*Chinese Remainder Theoremcan implement CRT in several ways
to compute A(mod M)
first compute all ai = A mod mi separately
determine constants ci below, where Mi = M/mi
then combine results to get answer using:
6ZZZ
!,6H+C,!Primitive Roots from Euler s theorem have a(n)mod n=1
consider am=1 (mod n), GCD(a,n)=1
must exist for m = (n) but may be smaller
once powers reach m, cycle will repeat
if smallest is m = (n) then a is called a primitive root
if p is prime, then successive powers of a "generate" the group mod p
these are useful but relatively hard to find ,JR
;
%0n &  Discrete Logarithmsthe inverse problem to exponentiation is to find the discrete logarithm of a number modulo p
that is to find x such that y = gx (mod p)
this is written as x = logg y (mod p)
if g is a primitive root then it always exists, otherwise it may not, eg.
x = log3 4 mod 13 has no answer
x = log2 3 mod 13 = 4 by trying successive powers
whilst exponentiation is relatively easy, finding discrete logarithms is generally a hard problem ZTZcZ5'J
+U
^~
F Summary have considered:
prime numbers
Fermat s and Euler s Theorems & (n)
Primality Testing
Chinese Remainder Theorem
Discrete Logarithms
&vvD?
7 /!+./356789 :
;<=
>?ABsx,,
j egHH(dh rk"nk&C RdO)^(c@Pictures7PowerPoint Document(ZSummaryInformation(PMDocumentSummaryInformation8Current UserS
SummaryFonts UsedDesign Template
Slide TitlesP :B_PID_LINKBASE'A)_6Parviz KeshavarziParviz KeshavarziT