Académique Documents
Professionnel Documents
Culture Documents
&
:{
easy
n
:
theory
B A a. e
•
C
- - o
D
- • a
I
•
F
0 a - a
G - - .
H a e o o
I a o
a - - -
J
K
L
In
N
O
A B C D E F G It .
I J K L In N 0 P Q 2 S T U V W X Y Z P
Q
as
.
Y
ASC 22 : American Standard Code
X
Y
Modular Arithmetic .
z mod 26 .
modular m .
>
#
M O
extra numbers .
Zm= foil , 2 .
-
- -
m -
I
} remainder upon
division by
m
.
PEEL
addition BE 7km atb remainder mod
define the
of atb
ai
; is m
, . .
: III :÷ :* :!
m
"
30=26-14
.gr#*in..pw.::::::::i::tn .
↳ mod is
(
' '
Knud 26 a=b m a
congruent
zo=
b and
)
"
to m
; is
A -
b multiple of at -_m
Example :
Shift cipher
p=C=k=Z④zg
A th mod 26
encrypt ; for XEP , KEK ,
eklx ) -
. .
decryption .
.
For
ye c. kek . day )=y - k med 26 .
; -
-
, - -
"
( all mod 26
Example .
HELLO
Okita
Yola
→ 14
21182525
in texts
k
.
, × text .
V s K -44
2 -2 C cipher texts . .
The P=C=#Ez6
In shift cipher ,
we used a
¥41231
B c D ' .
-
x y z
-
.
.
D I I G It
' - -
A B c .
cyclic
cyc.licpermueotion-egfork-3.FI (A) =D I LBK Tcl Z )=C
another I E - . .
notation ,
.
We allow
arbitrary
now
permutation .
A B D E F
IT
C
G
I
-
-
E F U A Q -
- -
H
G
TIITUXD
X
For daleth da Calx ) )
=
Verify =p )) =
x =
.
:
.
TL Ut ) -
-
E Ill 37--7 .
'
a- CE ) -
-
A .
in Substitution cipher ?
How
many keys
permutations of 26 letters A Z
.
How the .
many
- -
26 ! Factorial .
"
> Io
Substitution cipher has been used and considered safe for many gentries
HEERA'S .
P =
C = Zm .
m > o
,
( For AB ,
Z , use m
-
-
26
?
) I
{ a.be#im god calm }
=
K =
La . b) I ,
+
.
\ divisor
greatest common
For Kha b) .
,
.
acxtx
'
) tax tax
'
mod m .
decryption dy ly )
-
-
at Cy
-
b ) mod m .
dgleklx
dylaxtb X. modm
' '
Verify )) ) a- C Laxtbs bi ) a- ax
-
.
= -
-
= -
-
.
on
.
For a. b ,
in Im ,
define at b. a -
b ,
← result of usual
operation after
remainder mod alarm
taking
-
¥.
rk fine
Kisumu
.
a
bit problematic .
26
example : m -26 '
.
7.18=126--22 mod .
- abtac mod m .
'
"
number such that mod
'
is to in Im b
-
a .
to =/ M .
"
So 15=7 mod 26 .
Affine -
Cryptosystem
-
:
Key = Kea . b) .
encryption excxkaxtb
axtb
:
x →
.
'
decryption : dy Cy , = a- CYb )
-
}
-4 we
get shift cipher
How many keys
For a , .
"
less than m
C Z 226
A 13 m
-
- -
.
O I
2 - - -
25 .
ACTIVITY ;
4
Encrypt it affine cipher m
-
-
26 ,
key -45,10 )
using
.
.
3) with neighbour
Exchange your .
W E K X
-
ABC DEF G H I J K L MN O P Q
0 I 2 3 45 6 7 89 to 11 12 13 14 IS 16
RS T UV WXYZ
P 18/9 20 2122 232425
S 18×51-10=100/26 = 22 . W ,
E 4×5-110=30/26 = 4 .
E -
A O +10 = 10/26=20 .
K
N 13×5-110=75/26--23 .
X
WDF .
D :
3 I .
55 .
9
5. J .
Z . F; I .
31 57 83109
- 135 .
25
x
to Axtb
↳ I
.
I
To
. +26
13 39 65 K¥
26 -
y
④ ad
I .
Note the inverse in 7hm is bet dm
of No a
-
me
-
some a
- .
. .
.
invereible ) but
ifitexi-4-rt.swuque.su
we had two such no bi db
p pose
.
a
dm and bz
a. b ,
= , me a -
= I mod m .
Then b b- be med
,
= b
,
.
I =
big = m -
Have bi-bz.ba.ba .
-
a) shift Cipher . 127 substitution Cipher
Hill Cupid :
p integers .
D= C = C 7↳Dm
,
some m > o
.
in 226
with entries
keys k= f CA ,
s ) I D is an mxm matrix .
,
. -
=
.
÷¥i¥÷ ! ! .
.
; a
The matrix 8 in
invertible # det D is invertible modulo .
why ?
A. adj A
-
-
deed .
2mi
IF ? feud
Do C
ITA adj A) =L
'
( ad
Iet A Abcd ] = -
be .
Example : m=z .
3×8--53=1 module
I I §] det A 11×7
'
=
A
- .
-
[ invertible
-
Insist
'
ILIE
' '
A- A sub
¥ ]
=
-
↳ t 26
-3 .
verify :
a. x' =L ; :3 .
IIs if f- to 9) =
*
JULY If -
20 h
-
24 A
-
I} } I 5- If )
-
'
X X
ex ANTS
=L ; f) If ] I
ex ) -
Lfo ] t mod
=
TY
) 26 .
e. ex 's =
§ ] [ t Too )
'
] I If ) mod 26
=
-1313 = .
201
REMARKS :
,)
There are bits of keys for m
large
"
2) for me 1 .
we
get
the affine cipher
Hm
3)
If A =
then excx )
! %f÷ciph
Nts
-
-
'
matrix
identity day , =
y -
s
fth
century
c
4) Special case
of Vigentie
considered safe system
! )
"
total
length of
'
when unbreakable
cipher m =
centuries
the This is called
plaintext .
7 .
choose key 5=01-11772 E
S FC2.fr 8. 5,5 ,
it . 4) E ( 22617
plaintext '
some letter
"
I
"
is encrypted by different
C
if it 's position in
T H LM ⑤ ①⑤ A N Ex A M P L E O F T H E V
fi
:÷÷÷÷÷÷÷÷÷÷÷÷÷±÷f""" 0 O
? ?
A B C D E F G H I J K L M N o P Q R S T U V W X Y Z
0 I 2 3 4 5 G 7 8 9 to 11 12 13 14 IS 16 17 18 19 so 21 22 2324 25
used nowadays AES C advanced standard )
cryptosystem :
encrypeion .
One -
time Pad :
long I . .
is 128 bit
key length .
Public key .
DES 4970 -
sooo
)
Before
.
t 't
key length ,
64 bits =
56 t 8 control bits It raw
In 1964 ,
the most powerful computer
↳ teacher 's
birthday .
Cray CDC
supercomputer :
( 8 million $ )
't
Nowadays ,
Supercomputer : ~ to FLOPS
"
control 1034
AES : 128 bit = 112 bit t 16 .
£ keys =
945K¥24 .
5 Some number
.
theory
b carb ) division
a.
integers ,
god greatest common .
←
d divider ,
a
is a
multiple of d .
↳ Whenever Ha and Hb .
then eld .
prime
not prime
I t
Cd be 00003 0000017=1
g
.
,
I
← v
I
I oooo ol I
1000001 .
I to
Euclidean Algorithm .
lnput ;
=
Given : a > b > o
,
integers .
blog
↳ b does we divide a
the scheme of divisions with reminder
Compute following
.
b
fear
=
b. ← b mod r .
/ . tr ,
Vy ← r ,
mod r
, VE first Vy
4
.
I I
I
,
rnc-rn.rmdrn-ltn-i-fenirn.it rn
Vn =
Gn th
, -
until rn , ,
=0 -
OUTPUT ,
god La , b) =
rn .
is the ged
Lab ) ?
Why rn
divisor b ;
D rn is a common
of a ,
upwards
-
2) tha , -43 ,
told ? or
-4 rn .
↳
tea .
-
f. b) = ra
-4lb -
girl =
23
Conclusion : rn b ,
=
gcdca ,
,
example .
I 237 a -
-7321 b - 4836 .
)
.
step
I
4836 =
2485 + ↳ s ,
}
2351=1*134
)
t 73 .
134
) 4
=
73 t 61
73 61 2
) 5
=
t * '
b
)
61 = 60 t
① → god
fo = to to . ) 7
so
stops
.
n
?
what the smallest number a that
requires
n
steps
is
Worst all
scenario for Euclidean Algo of I
-
:
case
-
:* : :*
a=b the
:: : : : :
÷÷÷ : .
f
Vn ,
= Th -
I t th
,
for h =L . 2 ,
-
-
-
Fibonacci numbers :
Fn = In .
it In u
rn
.
=
,
Good news i Fibonacci number
grow exponentially .
smallest numbers Laib ) that require n division steps are Cfn . Fri )
-
w#n#¥-Fs -
II k¥5 )
n
In Let Gold ratio OI
-
(
-
- :
HII
i
where 4 -
-
I 1.618 -
l = I
,
Fn =
IF Ion hegFn= n.bg#-Io=nhgoI .
cis constant
integer
- tabby
1234567 :
7 range Eu
.
a- -
an
Conclusion :
EA is 0 Chg af
,
( bounded
by c .
Ilyas )
b
for input
a >
quadratic time algorithm efficient
every ?
.
bra
example : a -7321 .
log ,oa=4 -
=
Sff logger .
- - -
Him :
ASA cryptosystem .
Need ; EA →
god c a. b ) .
'
→
a-
mod m
EEA
.
compute
T
time
on running
focus
.
extended
CRT .
format
.
EL
BezTh b
@zLtbzdzEdd-gcdca.b
a. , non - zero ,
Notation : d7I= { xd )
x in 2) =
f -
- -
,
- d. o
,
d. zd .
3d -
-
-
aztb2-faxtbylx.gr ink } .
In particular :
d=fcdcaib3=ax- by for '
some x.
y ink .
TT
Beaut -
coefficients .
3) =/
22-132=2.1
gcdez
.
example :
.
Question -
. How to
find the inverse at of same number a mod m ?
7=1-5
- I
mod 26
a-
mod ?
What are the invertible elements m
invertible in od m }
Notation : Zin = { a
E Im I a is .
IF 15 '
7 19 21 23 A }
{
'
11
7,9
.
= , ,
3,5
,
I
,
,
.
,
,
THENh :
-
for I
fed calm ) =L
) ,
number
ZE 2mW ) s m
prime
.
②
=
far 3.43
[ ZE -
-
.
2.3=1
mods
looks like A Q G ,
i. , ,
med 5
f- C- I ) 4.4=1
held
.
Im is a .
C- I .
-
I )
It mod
I
↳ a . a- m .
⇐ a . at -
I = x. m
for X E I
I
'
⇐ aca t XL met
-
⇐
-
I
god ca m
)
-
-
.
't
Parl L2 ) Im Iml
5035¥ For Isa
=
Em
t.gcdea.ms I
-
any
-
-
⇐ mis prime
Q '
18 8 is invertible mod self
) fed neg ) =/ Therefore
Byu
.
's , .
.
, , .
mod
a 1=8 . X
self
the inverse
of 8 mod
the Begone -
coefficient x is
soy
Tenchi dean
Qs .
Lee 's find the god is , wtf )
using Algorithm .
2019=252
'
8-138=2-3-12 fi inverse
3=1.2+10
-
god .
Looking for
numbers ix.
y ,
such
¥4 that I = Six t sexy .
iEaro
I =3 .
Golf -
8. b- a ) - 8=3.2019 .
-
(3.52+1) f .
mod 2019
we find 1=8 -
C -
757 )
2019-2-2 .
S 1262--10096=1 mod
self
.
EEA -_
Extended Euclidean Algorithm .
to > ri > o
integers
Inp hi
-
.
EA to -
far th
Compute : ,
-
8, =
fifths .
rn : -
f. * rn . i → god .
Vm , =
fnvn .
Vitro
with O L rn Crn -
is .
. -
<
too til
ti-ti-z-fie.ie ,
-
So -4 S,
, Si =
Sir -
fi . i Sit
Output :
gcdcro.ril-rn-snrottnrigcdca.b-xatby.EE/t--0Choga5
2019=25
8-138=2-3-12
'd
s -
I 2+10 8 5=252×2+1
0 I 2 3 4
Stop
Vi self 8 3 2
I
Gi -
252 Zo I
Si I O 72
I 3
D o
I
O - 1×2
RSA encryption
-
:
To do ; CRT ,
phi -
years ago )
→ ooo
X - a mod mi .
Mr .
Xz
'
-
armed Mr
Hr -
-
armed Mr .
X
-
Was
.
,
a
unique
where where
X ai
Mif t
army -1 as
Mryr
-
- -
=
,
Mi
-
-
MMT
,
Mihm -
- -
Mr =
¥ .
'
and Yi -
- MI mod mi
X =3 mods -5
my it
j
-
X = 4 mod 7 .
my -7 .
Find X ; X =
I .
105 't -12.70 -
I
-13-42-31-4.30 '
4=1103 .
"
253 mod 2/0
Ai It , Mi 705 .
1=4--105 modz .
A 2 79 "
ME 1=45-70 mad 3 .
'
as =3 Ms 4L 27-43=45
'
meds 2- mods
-
.
=3 .
.
All
-9 , My -70 .
44--30-1=2-1 .
mod 7 2-1=4 mod
f
Euler 's phi
-
function :
Yi IN → IN defined by
invertible modem .
Cfcs ) -
4 .
When P is a
prime
number ,
2p*= 2PM .
↳ 943=174*1 =p -
I
Faoe;lfp.qpnme9cpqs=94ukCP-DlWLpIg
Ucp f ) counts invertible elements mod Pfe
Proof : , .
-
-
I , 2 ,
3
-
- -
, I
Pfe ,
qif--pfp
multiple of multiple of he
3
p sp
-
p Pfe
- - -
-
- -
- -
q multiple of
#
p
.
Pt G- I numbers .
Cpt f -
D= Pfe -
p -
feel =
Cp -
hCG -
I
) .
4cg ) =
413.3 )
| Shri
4.5.7831
-
-
f not horses -
hey
fEmo¥mf -
tee p be prime .
.
,
'
XP
-
② I
medp for
e
all
.
PROOF :
⑦ i
Show part 2 .
Assume PXX Cp doesn't divide X )
, ,
.
↳ in mod P
why ? tf jx in
j e D impossible i
j
-
- -
-
i. p
.
[
-
then ii
j, mod divides a divides Ii
x p p ji x p j
-
-
,
-
Therefore Fx 2x 2x -
-
DX ) G. 2.3 - - -
I
) prod p
Ep
-
p
-
, , . , = , .
'
XP Cpt ! mod
) CP ) !
P
= -
I
it
XP I mod p is invertible med
= c P is ! -
P .
they
" "
-
no n
.
Hes H Wile found a
proof
.
,
,
Compute 7 ,
't b
Mt
If mod y =
76 mod 't = 4
.
'
Tba
'
22.7 .
7 = f. 5.5--125=0 med it
,
72-omod.it
-
Remarks .
.
cryptosystem
.
RSA Cryptosystem :
-
-
q .
n
-
p
.
of .
P=C =
In .
Keys , K=Sk
-
-
in , pig .
a. b) }
where h =p
.
f .
a
invertible mud 4cm
,
y Ln )= Cp -
D ( of
-
-
I
) abt modeling
Ewa Xb mod nite
encryption
: = n . Er
requires public crib ) .
private :( P .
f. a -7
t " M
"
ab -4 mod yen ) =
X mod n .
⇐ abt tt .
Yon ) =
X .
Xt " " '
mod n .
' % "
=X .
XM tmodnn-p.fr
-
.
at a
'
/ =X mod n
Fermat 's Theorem :
.
"
x'
e
modp
I
.
mod
} pg
My money Pf
.
-
-
n .
Encryption ,
"
Compute X mod n
Example ; ,
, ←
D ⑥
I €
21--1-14+16=1+2424 binary expansion
-
o
q
.
ya =
x1t4ttb.zxl.cx34f@x2j2TTComputeix2rmedn.zcX5modn.cex
m.dn.dz square
.
'M
'
YZ p -101
q= 103
4cm -40200
a -413 b= 5777 .
A
10403
=
Message
No b -
5777 :
5777--242142 ?
Ek 43 )
-43*777
+27-124*20
145=2
n -_ 10403 N O
385360
13 14
468
.
*
( 14h )
1357 mod 10403 603639169
,
,
=
a -4174
"
"
"
+242426+2 .
t.tt?i
5=7478
.
145171920€14
145777 mod 10403
'
445*66.142*2
27804926
.
µ
'
6=2177953
651 .
320-1320
=
.
"
#txu4 14 e.
H2o mod 10403 .
x 9798×10308 #
3738
he = - -
- 4A =
.
1415 -
-
-
141% 1415
'
14240=14153 -
-
His
.
2214=7374.0 l4'92
Fest method to compute xbmodn is "
b -
- lol = 641-32-14+1=26+25-122+3 .
D-
Compute iterated squares .
3) Then compute
.
RSA
Security of cryptosystem .
"
Eve b mod yen ,
tf for ) is known then can
compute a
-
f p f c-
prime
'
p
PM
- .
n
Suppose
-
,
i
.
( nap
q )
.
Prot Assume
' ' "
in =p q
.
.
Then 4cm -49-1142-1 )
I know can ?
"
⇐
"
Assume some grade tells me fun ) .
2 also know
" Yet )
n ,
and mathematics tells me ,
n
-
-
p.ge .
6lb
=P he -449 e) t I c.pt f) =p tl -
ten ) .
known ptfis known
The polynomial x2-lptfpxtpq-cx.pl Cx -
f)
So
P&G are .
the zero
of the polynomial Xihptfsxth .
Rabin cryptosystem :
mod 4
to =p f prime p =3
.
p.ge
.
n .
& G =3 mod 4
19
example pet .
. PFI .
f- G- In ; K -
-
fun .ph/n--Pb }
p
! t
private .
:
Ki→x2 modn
Encryption
Decryption ; y , →
"
Jy
"
mod n .
6 possible plaintext Xin Xy
Ty mod
' ' ' '
Then -6 compute n ?
the PET
mod
Compute following :
Zp=y n
Zg y 4¥ -
-
mod n
.
sede for systems of -
?
mod p and X , mod med )
q
c
Xi Zp unique X n
=
Zq
-
as ,
. unique
(3) Xs =
of .
Each these
four mods xa.az Xie is a
square
of , x , , , .
of mod n
not
y
.
mod not of
Verify :
yer n .
x , is square y xi=yL xI ,
I
=zf=y¥=x
'
" I
* =
x =
x
-
mud p .
xixmodn
I format
g.)
'
Ip mod HEY modn .
X
fi
-
-
- - -
-
-
,
.
In
practice . we hope only one of x , nxy gives resonate
plaintext .
Example : p -3
-
.
6=7 .
n -
-4
42--4 mod 21
x=z y
-
- ,
,
'
Xi XFH mod -4
modes -46=2 mood 7
'
Xi -23--31=4--1 Zz Y
-
D
-
-
i = .
-
.
,
:::÷i : : : : : : : : : : : :: :
"
med
147 Xy = 2 3 .
A 4=5 mod 7 Xx=5 modal
x,
'
=
5=4 mod -4 XI -
-
162=256--4 mod 4
XI -
-
15=361--4 modal Nui -
- 5--25=4 modal .
A p prime
, in
Ep ,
have at most 2
square
roots number
of given
.
Ulp ) =p -
I
.
If p, q prime ,
n
-
Pfe .
in In ,
we have at most 4
square
roots .
fraction n
-
ng =p G .
.
Assignment 4 ,
Rabin Cryptosystem .
{ if B C Z } I
{ I 2-53
'
2
-
.
o
-
i
. -
.
, ,
.
encode blocks
of
s letters
with base 26
Do same
.
Hello
714×26+114262411×263 -114×264=6497147
74111114
Prime Numbers :
Given n EIN ,
is n Prime ?
divide P
2 Ed Ep -
I ; d does not p prime .
to test
is Zed
In face . it saficient for Efp it dlp .
ab
If n
-
-
"
" 30 & 10154
lo p
Remember : a =p genes . y
f .
2
Ef Efp .
divide C Sieve
test if q p .
of Erato seher
240 BC )
# prime numbers
up to
Tpa 107721075 '
①
-
Theorem ; For A 32
Denote an
the number of prime
number
p
by ,
such that ZEP Em .
Then
f- Fm Stum ) S8 Fm
For m
large : Tum ) rent -
-
- -
-
-
hmm
-
2512×10154 lnm
I
Ipa = m . = 356 ?
s
. - - -
-
- -
-
e .
-
Sax L 20027
Theorem ;
C
Agrawal Kayal .
"
number
if a
given
n is
prime -
Xxampk 1554
clog Pio
=
p =
'
Then p prime ⇐ Cx -
gyp = c XP -
as mod p .
\ I
'
polynomials
in the variable P ,
in
coefficients ZEP
Discussion : It is easier to decide it a number n is
prime
then to
find all prime factors of
n .
Have seen .
.
There a
poly time algorithm that decide .
if a
number is
given prime . L A bit show )
lion is known
No algorithm for integer factories
-
such method
'
Salway
-
are
Algorithm .
Tf
'
number
a
y modp for some
y 2
-
-
, e
called residue
If not a is quadratic non mod p
-
.
.
Example p II
=
:
5--3
72--5 med it
mod it = 62=3
I mod 11
.
F- e- a' 5- up
-
at
residue mod 11 are { I ,
3. 4.5.93
The quadratic
. -
- - -
non
-
pesidue mod 11 are f- 2 , 6.7 ,
8 ,
to } ,
this
T poly time the
Compute in using
and multiply method
square
- - .
Proof :
"
"
"
< Is Assume Y mod p
a
for some
-
EI
-
.
, y ,
Then # '
y ) mod p
I
a =L
YP
-
=
= , .
fermat .
" "
⇐ Assume a mod p
Zp can
as a
-
- bi
IF
bi
fi
"
b ,b3
'
we will see = ,
b -
-
-
,
- - .
b )
,
,
\ root mod P
primitive ;
3
W
" " or
med
b =L p .
proofed
.
. mod p .
or
AED
Improved Fermat :
Lp D- divides i .
4
pi§
is So Bt big mod
p
i even
i=sj a-
-
i
Therefore
- -
, ,
Example :
of and is
legendre symbol a
p ;
:
¥511
mainframe
residue
Fay modp .
,
a is quadratic non residue med p
-
.
example :
CF )
-
x
I hate
it
, '
FT =
Cbp ) a
-
-
bmodp .
(¥ , =
,
µ
(F) = -
15
( T ) -
-
I
Theorem odd a EZ Then CST ) =
mod p
:
p prime , , .
mod
Proof :
If a=o
,
p .
a
quadratic ,
"
but .
.
at = - I
mod
p .
3¥ 3
a -
a
"
Definition :
AE -
- a
→ a -
"
write n =p , pin .
. .
Peet be the prime factorization of n .
et
as
lens -
cap.sk#je2cfgG
.
-
. .
.
Example :
( 92¥ ,
5- coziness .ch#ic67fs .
②
A-
9975=3.57-19 =L } Hs ) Fg )
#
.
) .
=L -
t ) I C -
he n
.
= I
2¥
- -
3.1
'
.
!
= 21=271 mod
89 83 83.83 I
=
=L ya fell
-
I
-
.
= -
We know :
p odd prime ,
a c- 2 .
(F) =
a
modp .
when is odd 2
n
integer ,
a. E ,
then # modn
(f) may be
equal to a .
Example :
cien
91--7×13 .
=
I K¥345 ) :-c
-
I ) .
.
# I
(F) 33--27--6=-1 med ?
= -
=3 =
So LET = -
Compare :
to =
1045=-1 mod 91 .
45=2
92=81 916=1
"
"
( oo . to 9 =
I
932=1
98=1
,
"
9 .
to
!
.
65=5.3-3 I 045=[45/3]
91 composite
example
.
3=10 mod 91
a =2 is Euler witness
It ,
Now take n = a -2
,
the
(F) =
(F) LIE ) =L -
ill -
n =/ for fait nets
is not
prime
-
'
z = 27=8 mod D-
is Euler pseudo
-
to the base a
an
prime
.
If Ehlen witness
it is not an
I¥me , then a is
↳
.
Then ;
( { at
Iff n
is Euler pseudo -
prime
to the base a) ISE ( 2n*/
a in
29 .
Sale algorithm Given n odd
Strawn i
.
ray
- .
① choose Is a < n
randomly
.
then RETURN
③ If to
,
a is a
factor of n .
STOP .
: NO
a # mod
④ Compute n
.
#
If a mod n f- ( Az )
,
Then return :
"
n
not
prime
'
If a med n =
Cfp ) ,
Then RETURN .
.
'
'
n possibleby prime !
'
picking o
-
=
.
Problem , How to
compute the Jacob -
symbol Ldn )
( In the definition
=p ? prime factorization of )
. we use n poet
. . .
n
Have to
find different method to
Jacobi
compute
.
symbols
-
.
-
Rules in the Game b- compute Cnt ) ;
< I >
tf a=b modn ,
then cap ) = Che ,
reduce upper me
J
.
mod g
'
it n It
=/
-
CF ,
-
,
(
t it n
-
-
I3 mod 8 .
③ Canby --L%Lk→ -
Fa , if a -
. named 4
ya , else .
Example : C
GIFT ) .EC#as)-l3gYf7 )
gets .it mods
€ I .
(3131
9975=3 needy
9975 ) .
3139=3 mod 4
.
⑨= -
C 9937357g
) 9975=558 mod
3139
assists ?
ee
notte
-
⇐ iffy , # -
i see ¥ ¥ -
East
.cz#siE-cIIsiEcaIsi=cFsT=EssiFss---uIzsi=-lYaI
477=-1
-
=
rules to
These give an algorithm
Cen ) in
compute OC bgn5 .
amine
,I7¥p= - c = -
c7¥ )
.
=I¥nsh = -
=tf¥
=
* 23474¥, ha
= -
79ft = -
= -
i ± -
' Ea
.
II f I I. A
'
=
t =
We use Jacobi symbol for prime testing :
If n is prime ,
then
,
then , = ant mod n f a E Z -
-1 I 741146
"
mod 9283 .
I
-
number P 1×2912=1654
, of
between and n
Ign
2
= numbers
.
prime
Strassen
if is Solway
-
test
to
prime
.
:
1 Algorithm n
Primality Testing ;
( Aim : Miller -
Robin Test I
-
'
No at
Recall Fermat 's Theorem ;
tf p is a
prime ,
then =
, modp
if pya
in fact Am -
I mod p et divides
p
-
: -
I m .
1-
" ' k I
all
'
=p .
when to mod
p prime ,
a
p .
Az 2512
1.
O Choose random number 2<=a<=n-1
2. Compute gcd(a,n). If d=gcd(a,n) ¥1
O ,
then we found
a
proper division d of n . STOP .
③ tf ah
-
'
II mod n
,
then STOP
,
n is wearing
else back to
①
,
go
13 .
Example :
n
-
-
is ,
gcd ( a. n ) Fl , if a =3 , 5. 6.9 ,
lo , 12 : Find divisor .
Assume
Step ③ n
=p f p.ge = 10154 p.ge primes
- .
: .
.
.
In the sea En I
range
-
.
,
many mutiples of p ?
how
f- I "
= "
how
)
many muti pees
off .
? py
CR D . . charmiehael ,
1812 )
if
① not and
n is prime ,
③ an -1=1 mod n
for all a with gcdca.nl =/
Example :
n
-
-
561 . is Carmichael .
①
Lf n is Carmichael .
.
then n is
sguate-feec.no m2 divides n
)
( prime factorization of n
=p, Pz .pe with all distinct
n
)
. -
;
,
is I
② square free
-
n . n
,
divisor
every prime p of n .
Square -
free
)
17=3 ,
4560 ,
v p
-
- H i 101560 . V P -- 17 . 161560 .
✓
hence 561 is Carmichael .
More Carmichael numbers : 561=3×11×17 .
1105=5+13×17 .
1729 . 2465,2821 -
-
-
172081=7×13×31×61 .
Mtl
P
.
:
.
ah mod
'
Carmichael all
=/ for withgcdca =/
-
n a n )
N ,
,
CRT ; an
'
mod
for all
-
=/ p :
pi ,
and all a .
Fermat ;
Pi -
I divide n -
1
of Assume Carmichael
Proof ③ n Pfe pig primes, pff h
-
i
-
, , .
Ps L .
h =p G -
By ③ f- I divides n I =p f I =
PIG
-
D t p I
- -
- -
,
Therefore divides
fit p I
-
,
However ,
peg p
.
,
sq ,
} n has at least 3 distinct prime
divisions .
-
pts
Assigns :
Mat 'h4 hand
Mpls
-
'
Ppts CS
-
co
-
=
-
.
Mar .
18 .
Fermat to .
gcd La , n ) =L -
=3 d odd ie
n -
if
write n -
I .
where d is
f
'
n -1--18=21
-
. -
Then : either ① ad =
I mod n
n -61
-
Or
③ AID = -
I mod n
for some O Eres -
I n -
I =
2- - 15 ,
Proof :
ad -4 mod n → case ①
of
add
tf
"
Look at ad
,
old
,
aid .
' '
,
att 'd aid mod n .
,
'
T T
not )
I
'd
aid 5=1
"
Then of =L mod n .
But n is
prime and the polynomial equation
,
Therefore , aid =
-
I mod n
.
Let de odd
Notation : n .
number
tf some a with
gcd La , n ) =/
Test ① ;
choose a =L
① 235 =
( 275 mod 561 .
= 263 Ft mod 561 .
in ⑦ coed ) -
Lad 5 aid coed 5 aid
compute
-
= - - -
; , . ,
For r
-
-
O . I ,
2.3 = s -
r -
- O ,
It = 2631=-1 .
mod 561
8=1 ,
265=166 t -
I mod 561
8=2 1662 =
67 I -
I mod 561
r =3 t mod 561
672 =
I -
I
is witness 561
a- 2
for n
being composite
-
.
-
/
Hitler -
Rabin Test :
Input : n .
odd natural number .
① choose 2 Ea en -
I
⑦ Compute gcdca.nl .
lf gcdca.in
) # l
,
then STOP ,
found divisor
gcdca . n )
of n .
④ For r
-
- o to S I -
,
do :
"
= -
I n then STOP n ,
else b a- 6- mod n
compute
.
⑤ STOP
"
"
n is with witness
; composite .
a
Def :
tf n odd
composite
number ,
gcdca.net .
Chine )
(
false a en -
i ,
gcdca , ma l l E t£
and a is not witness .
to choose is
probability non -
witness E 254 . .
Set m
-
- Bd
write n=p9pE - - -
pea
Ul
j =
fat at -1=1 mod n ) .
UI
k =
Salam -
- timed Pii )
.
UI
L =
fat am =
It mod n )
UI
{ non -
witness ) .
Fact : LEK E
JE ZE are
swbgtoups
'
If a. b in L .
then ab in L .
Am =
-4 bm III ( ab )m= It .
It =
It shod n .
LAGRANGE Theorem ;
1-
Subgroup
" l
-
l l l
'
n -15 .
,
n -
1=14--2 .
-7 .
5=1 ,
d -7 .
If =
{I 2
4,7 8 11 13 143 8 elements
m=d=7
. . .
,
,
S
.
1=0
.
,
-
Ul
Y =
fl , 4 , 11 ,
14 } . 4 elements .
Ul
ke f , , 14 , 4,11 } of -
-
H mods and a
"
# mod t '
y elements
UI
Je fi 14 } of =
It mods
elements
, ,
.
2
.
In k ,
we have It mod pie
'
,
II mod Paa
,
-
-
-
II modpeet possibility
divisors then
We
get ; tf n has 3 or more
prime
,
,
1¥ ¥ =
,
t 73 .
I non -
witness l E Rf
p divisor Pe
tf for some
prime p
-
has only : n -
n one prime
.
So n has two
=
prime divisors
fron -
witness } E l{h
when is
f
=
If ? Precisely when n is a Carmichael number .
: ,
.
divisors
prime .
cote ,
nnotapn.me#power .
'
How do
you
test
if n
=p ?
Newton 's Method
-
he 1447123 Compute In
f-
=
.
solve n
-
-
o
>
I
Method to
Efficient compute roots .
Jn Fn Fn
Factoring ;
•
Discrete logarithm :
D Polland 's p
-
i method .
I choose B ( bound ) ,
and a c. Base ) .
!
② Compute b -
- AB mod n .
= a
b
do be bi mod
② For 2. to B n
-
i -
- .
" !
( ya.PT . . .
)B = a mod n .
③ Compute gcdcb
-
I , m
)
④ en STOP else to ①
If I
aged Cb I. - n ) .
.
, go .
Dissension : Assume n =p
- m
,
p prime
.
P -
I =
Pi Pa B '
-
-
- -
pi with Pi prime .
that
"
c p i
-
Then p I divides B!
:÷÷i÷:÷l :÷÷ :*
-
÷: :
.
psgcdcb -
I. n
) .
Example : n -
-
15,770,708.441
that
such p I &
q have large prime factors
-
-
I .
→
Goodwins
Theorem : CE , Fowvry .
1985 )
}
{ p prime . 2 Ep em ,
p
-
I has prime
divisor > m 313C .
Fm
/
for some constant c
' '
divisor 71600
ht Mao
, prime
-
One solution for RSA ;
number 25
"
choose random r re
cpzr )
↳ Quadratic sieve
best known methods today
}
.
(
↳ Algebraic number
field sieve
Fun in sub exponential time
>
Idea .
. Given h
F- y
'
mod n
my ex
'
-
y )
'
-
ex -
}
-
and # Ly mod n
my way ,
X
ny, ex
y, Fn
. -
X 227
-
Y 210
-
-
7429
-
Example
,
n
-
.
:
-
~
- x -
Y
-
17
that x'
-
such
for y
.
Looking x.
= n
y
-
gcdcn .
AKA
:::÷
Jn =
86 19
:: : ::*
.
.
:
÷
"
:* : : :*: :c
:: n
£-227 ,
22ft -
n= 44100 = 61032
x Y
Discrete Logarithms :
If an
is root for 2¥
a not primitive 31127*1=6
y
.
{ I .
2143 f- 2¥
ad # modp for
all divisors d of p
-
l
H
P -
t .
26*-11.33 .
zit # * * I
73=13 ULP -
1) =
4427=413 .
4) = 613 ) -
441=2 . =
y 22=4 # I
a→
as
*
¥
Test 2*13 3 #
=
1
,
2 . 4, 5 ,
6 , 7 , 8 , 9 ,
10 ' " ' ' Z -
V
,
24=16--3-+1
!
X
X
X
prime
root ? X
¥, gY, Xp Yo . E- -
Iti
-
.
v
divisors of 1=12 d "b
proper p are '
-
to # oh
know
we : 2,5=91,7 ,
lo .
5,9 ,
it . 12.6 ,
3.8.42 ) 102--9=11
1×2 3×7
6×7 8×7
63=12 II
meds .
mods mods mod !3
104 =3 ty
A -7 . at ,
al ,
of a3 . , . 76
lob
176=11 med B .
X is called logarithm .
number
Remark : choose a
prime p which is of the form pesfti for
some number
prime of .
: ,
412 ) you ) f I
primitive
-
= -
=
roots in 2p* .
I 74*1=26 .
For a E Zp* ,
to test if a is
primitive nots .
I need to test
only ,
a- ¥1 ,
anti mod p .
Proper divisors of p I
-
=
He are 2.
of .
a p
I 2
2 3 5 11 13 If 29 37 53 59 61 67 83
3 7 17 31 43 79 89
compute =
If
f
I EX ,
yep -2 .
Y it
-
- .
Recall EL Gamal cryptosystem :
a
-
a
primitive for
.
,
Plaintext :
P = 72ft
't
Ciphertext c 2p* X
Ip
-
: -
Keys K
-
-
HA , X ) where A- at modp - , I
snap -23
t tr
public private
AY MA ' ) random
encryption i exam ) =L , for some
y C- 749
CM -
I mod Et -
I
p
- -
f- y x -
-
It -4 "
=p
'
4
( c4j =
c- = mod
4
Note .
Cris increased
flexibility ; use p-adic elliptic groups )
's
and tbxtc PXQ
elliptic curves
y
=
* Ethanol is a bit more
expansive than
RSA
is twice
( ciphertext as
long )
↳
pohlig
-
Hellman algorithm .
Question mod
what is X
logab p ?
-
: -
⇐ ax =D modp .
a =
I
p :
a = b mod p
Kup Y
axe
-
= b mod
p
→ are x modulo I
we
looking for p
-
.
Ponting
-
P =p ? pak
'
Suppose : -
I . . . pfe
Find a- hgab mod p .
legal 8 mod
"
a X
-
-
4
Want x=
logy 8 mod of ↳ problem : z is not in 2*4
.
mod ? '
Compute x begat p
-
-
Idea :
"
x -
-
'
x -
-
11=109218 mod 29 ⇐ 2
"
=
IS mod 29 .
pit ? I
-
Write x= aotaip ,
t a. - - -
tae ,
-
i
-
' ' MP
aao
" Yp
)E
'
b¥ ax
-
( AP )
-
(a
-
Observe
.
i
, ,
=
.
.
= = = -
-
= n
,
"
"
'
" ,
%
-
MYP
compute powers of a' ,
until I
get
b a
÷÷÷÷÷÷÷÷÷÷÷:÷ .ie?iii
: "
.
. .
( a' Y
'
' a
Observe .
.
b' =
where b, -
-
b a--
- A
b
a% 294
'
'
= =
27 z mod zf b, -_
b. at = 18 I-
=f
A 122=28 mod 29
b' hi
"
=
97 =
28 mod 4
↳aa←
x =3 mod 4 I
→
} D mods .
A- 4 may
us
@
i. ¥ i
w E
Es
'
s E
is a
⑦ o