Crypto 101
Crypto 101
Crypto 101
CONTENTS
CONTENTS
CONTENTS
CONTENTS
CHAPTER 1. ABOUT THISBOOK
how
why
that’sa bug
CHAPTER 4. ACKNOWLEDGM ENTS
CHAPTER 5. EXCLUSIVE OR
ki
Pi Ci
ki
Pi Ci
pi i
ki
pi ci
0 0= 0 1 0= 1
0 1= 1 1 1= 0
CHAPTER 5. EXCLUSIVE OR
a b= b a
a b
a a= 0 a 0 0= 0
a 1 1= 0
a 0= a a
0 0= 0 a 1 0= 1
a b a= b
a b a= a a b
= 0 b
= b
commutativity commutative
CHAPTER 5. EXCLUSIVE OR
bitwise
73 87 = 0b1001001 0b1010111
1 0 0 1 0 0 1
=
1 0 1 0 1 1 1
= 0 0 1 1 1 1 0
= 0b0011110
= 30
CHAPTER 5. EXCLUSIVE OR
ki ki
Pi Ci Pi
perfect security
ci
pi
ki
CHAPTER 5. EXCLUSIVE OR
Alice Bob
ki ki
Pi Ci Pi
Eve
CHAPTER 5. EXCLUSIVE OR
c1 c2 = (p1 k) (p2 k) ( )
= p1 k p2 k ( )
= p1 p2 k k (a b= b a)
= p1 p2 0 (x x = 0)
= p1 p2 (x 0 = x)
p1
p2
CHAPTER 5. EXCLUSIVE OR
CHAPTER 5. EXCLUSIVE OR
Ci K
Cj
K
Cj Pj = (Pj K) Pj
= K Pj Pj
= K 0
= K
Pi = Ci K i
pi any
all
k = ci pi
k
pi = ci k
CHAPTER 5. EXCLUSIVE OR
CHAPTER 5. EXCLUSIVE OR
CHAPTER 5. EXCLUSIVE OR
put
together
E
P C k
C = E (k; P )
CHAPTER 6. BLOCK CIPHERS
block size
D
C k
P
P = D (k; C)
k k
P C P
E D
keyed
CHAPTER 6. BLOCK CIPHERS
24 = 16
0 F
1 E
2 D
3 C
4 B
5 A
6 9
7 8
E k
CHAPTER 6. BLOCK CIPHERS
0
F
5
C
6 4
9
B 3
1
E
D
2
7
8 A
k
CHAPTER 6. BLOCK CIPHERS
0
F
5
C
6 4
9
B 3
1
E
D
2
7
8 A
k
CHAPTER 6. BLOCK CIPHERS
1
A
C
2
7
9
0
F D
5
6
8
4
3 E
B
CHAPTER 6. BLOCK CIPHERS
24 =
16
2128 1038:5
n! n
n
n
n! = 1 2 3 : : : (n 1) n
5! = 120 10! =
3628800
(2128)!
2128 (2128)!
2128 2256
CHAPTER 6. BLOCK CIPHERS
CHAPTER 6. BLOCK CIPHERS
CHAPTER 6. BLOCK CIPHERS
8 8
x x S(x) = 0 x S(x) =
x x x
4 4
CHAPTER 6. BLOCK CIPHERS
c(x)
CHAPTER 6. BLOCK CIPHERS
C = E D E S (k 1; D D E S (k 2; E D E S (k3 ; p)))
k3 = k1 k1 = k 2 = k3
:::
| {z } | {z } | {z }
# # #
z }| { z }| { z }| {
:::
:::
| {z } | {z } | {z }
# # #
z }| { z }| { z }| {
:::
CHAPTER 7. STREAM CIPHERS
128
24
CHAPTER 7. STREAM CIPHERS
CHAPTER 7. STREAM CIPHERS
passive
active
A
S
C = E CB (E k ; AkS)
C
k S
CHAPTER 7. STREAM CIPHERS
S k
C
A
once
S s0
s0
E k (Aks0 ) CR1
s0
CR1
A
CHAPTER 7. STREAM CIPHERS
b 1 1
A S
s0
f f
k
k
A
b
E
E
CR 1
a
S
A
s0 s1
b 2 2
A S
s0 s1
k E
CR 2
s0 Aks0
s1
CHAPTER 7. STREAM CIPHERS
A S
s0 a
f k E
p b
p
28 = 256 b
p p : : : p = pb
| {z }
b
25616
256
16 = 4096
CHAPTER 7. STREAM CIPHERS
CHAPTER 7. STREAM CIPHERS
ahead of time
P1 P2 P3
IV
k E k E k E
:::
C1 C2 C3
CHAPTER 7. STREAM CIPHERS
C1 C2 C3
:::
k D k D k D
IV
P1 P2 P3
CHAPTER 7. STREAM CIPHERS
I VA
I VM
G
PM = I VM I VA G
I VM
CM = E (k; I VM PM )
= E (k; I VM (I VM I VA G))
= E (k; I VA G)
CHAPTER 7. STREAM CIPHERS
P P1 P2 P3
k k
C = C1C2 C3
CHAPTER 7. STREAM CIPHERS
C 0 = C1 Z C1 Z
P20 = D (k; Z ) C1
= R
P10 = P1
P30 = P1 IV
(P1 I V) P1 = I V
CHAPTER 7. STREAM CIPHERS
stronger
are
X X
CHAPTER 7. STREAM CIPHERS
Ci X Ci+ 1
:::
k D k D
:::
Pi0 Pi+ 1 X
Ci
Pi0
after
X
CHAPTER 7. STREAM CIPHERS
Pi + 1 X
Pi + 1
X
CHAPTER 7. STREAM CIPHERS
Pi0+ 1 = Pi + 1 X
= Pi + 1 ; = ;
= ; = ;
= ; = ;
may
CHAPTER 7. STREAM CIPHERS
CHAPTER 7. STREAM CIPHERS
constructing
padding oracle
CHAPTER 7. STREAM CIPHERS
R = r 1; r 2 : : : r b
Ci
RkCi
R = r 1r 2 : : : r b Ci
k D k D
IV
PR Pi = p1p2 : : : pb
CHAPTER 7. STREAM CIPHERS
previous
R
R rb
R RkCi
R
RkCi
Pi
every
CHAPTER 7. STREAM CIPHERS
and
C R
Pi
Pi R
R RkCi
Pi
p0 p1p2p3p4
p0 : : :
CHAPTER 7. STREAM CIPHERS
R
Pi p0 p00
p00 p1p2p3p4
p1 p2 p3 p4
is
R Pi
p00 p01p02p03p04
CHAPTER 7. STREAM CIPHERS
Ci
D (Ci )[b] rb
D (Ci )[b] rb =
D (Ci )[b] = rb
Ci
D (Ci )[b] rb =
almost
CHAPTER 7. STREAM CIPHERS
D (Ci )[b] rb =
=
b 1
why
CHAPTER 7. STREAM CIPHERS
slightly faster
timing attack
side-channel attack
synchronous
CHAPTER 7. STREAM CIPHERS
k C k C
Ki Ki
Ci
Pi Pi
asynchronous self-synchronizing
CHAPTER 7. STREAM CIPHERS
alleged
CHAPTER 7. STREAM CIPHERS
permutation
S
S
i; j S
S
CHAPTER 7. STREAM CIPHERS
identity permutation
j
j
Si Sj
Ki
K ::: :::
j S[i ] S[j ]
CHAPTER 7. STREAM CIPHERS
0 1 i j 254 255
f r om i t er t ool s i mpor t
def
f or in
f or in
r et ur n
S
CHAPTER 7. STREAM CIPHERS
0 1 i j 254 255
S[i ] S[j ]
S S[S[i ] + S[j ]]
Ki
0 1 j i Si + Sj 255
Ki
def
f or in
y i el d
CHAPTER 7. STREAM CIPHERS
ki ki
Pi Ci Pi
CHAPTER 7. STREAM CIPHERS
k C k C
Ki Ki
Ci
Pi Pi
ki Ki
twice
CHAPTER 7. STREAM CIPHERS
k n kkn
n
k
224 226
k
+
CHAPTER 7. STREAM CIPHERS
CHAPTER 7. STREAM CIPHERS
i
(0; 0) i = 1 2 16 (1 + 2 9)
(0; 0) i 2
6 f 1; 255g 2 16 (1 + 2 8)
(0; 1) i 2
6 f 0; 1g 2 16 (1 + 2 8)
16
(0; i + 1) i 2
6 f 0; 255g 2 (1 + 2 8 )
16
(i + 1; 255) i =
6 254 2 (1 + 2 8 )
(255; i + 1) i 2
6 f 1; 254g 2 16 (1 + 2 8)
(255; i + 2) i 2
6 f 0; 253; 254; 255g 2 16 (1 + 2 8)
16
(255; 0) i = 254 2 (1 + 2 8 )
(255; 1) i = 255 2 16 (1 + 2 8)
(255; 2) i 2 f 0; 1g 2 16 (1 + 2 8)
(255; 255) i =
6 254 2 16 (1 + 2 8)
16
(129; 129) i = 2 2 (1 + 2 8 )
2 8 28
2 8
2 8 2 8 = 2 16
16 k
2 (1 + 2 )
i = 1 0
1+ 2 9
CHAPTER 7. STREAM CIPHERS
255
0; 1; 2; 255
CHAPTER 7. STREAM CIPHERS
CHAPTER 7. STREAM CIPHERS
CHAPTER 7. STREAM CIPHERS
k Pi
N k00: : : ki E Ci
N
i
Pi
Ci
N k00 : : : ki
N i
E k Si
Pi
Ci
CHAPTER 7. STREAM CIPHERS
pi si si = pi
CHAPTER 7. STREAM CIPHERS
n
CHAPTER 7. STREAM CIPHERS
n(n 1)
2
squared
authenticate
CHAPTER 8. KEY EXCHANGE
one-way
CHAPTER 8. KEY EXCHANGE
why
CHAPTER 8. KEY EXCHANGE
secret
CHAPTER 8. KEY EXCHANGE
CHAPTER 8. KEY EXCHANGE
y gx ( p)
x y g p
p g
x y
rA rB
mA mB
m A = gr A ( p)
CHAPTER 8. KEY EXCHANGE
m B = gr B ( p)
r m = gr ( p)
s = (gr A ) r B ( p)
(gr A ) r B ( p) = (gr B ) r A ( p)
rA rB
g
mA = gr A ( p) mB = gr B ( p)
rA rB
CHAPTER 8. KEY EXCHANGE
h p i
L 1/ 3; 3 64/ 9
p
L [1; 1/ 2] = O( n)
CHAPTER 8. KEY EXCHANGE
CHAPTER 8. KEY EXCHANGE
CHAPTER 9. PUBLIC-KEY ENCRYPTION
hybrid
CHAPTER 9. PUBLIC-KEY ENCRYPTION
CHAPTER 9. PUBLIC-KEY ENCRYPTION
p q
N
encryption exponent e
(N ; e)
M C
C Me ( N)
d decryption exponent C M
p q
d
M Cd ( N)
d
d
CHAPTER 9. PUBLIC-KEY ENCRYPTION
(N ; e)
M C
(N ; e)
C Me ( N)
N
p q p q
would
implementation
CHAPTER 9. PUBLIC-KEY ENCRYPTION
e
Pe P1 P
( N)
CHAPTER 9. PUBLIC-KEY ENCRYPTION
(n k p) (p) (k)
M 0: : : R
(n k)
(n k) (k)
(n k) ! (k)
X Y
(n k) (k)
X kY n
n N
R k k
n k
n k k
R M k000 : : :
CHAPTER 9. PUBLIC-KEY ENCRYPTION
G H
G k
n k H n k
k
X Y
X kY k
X kY X
n k Y k
M M k000 : : :
M k000 : : : = X G(R)
G(R)
G(R) = H (X ) Y
H
G X Y
CHAPTER 9. PUBLIC-KEY ENCRYPTION
M
H G
CHAPTER 9. PUBLIC-KEY ENCRYPTION
cryptographic
CHAPTER 10. HASH FUNCTIONS
will
m h pre-image
resistance
CHAPTER 10. HASH FUNCTIONS
m m0
second pre-imageresistance
m; m 0
collision resistance
CHAPTER 10. HASH FUNCTIONS
CHAPTER 10. HASH FUNCTIONS
CHAPTER 10. HASH FUNCTIONS
rainbow tables
CHAPTER 10. HASH FUNCTIONS
2160
harder
CHAPTER 10. HASH FUNCTIONS
as
CHAPTER 10. HASH FUNCTIONS
H (M 1) H (M 1 kM 2 )
M1 H (M 1)
M1
H (M 1 ) ŀ xation
448 ( 512)
H (M 1kM 2 ) H (M 1)
H (M 1 kGkM 2 ) G gluepadding
glues
M1
M1
CHAPTER 10. HASH FUNCTIONS
Mi A i = H (SkM i )
S
Mi
Ai
CHAPTER 10. HASH FUNCTIONS
can’t
abused
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
signature
algorithm
chosen messageattack
mi
ti
existential forgery
(m; t)
t0 m0
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
t0 mi
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
not
C=
E (K C ; P ) t = M AC(K M ; P )
C t
t = M AC(K M ; P ) C = E (K C ; P kt)
C t
C
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
C = E (K C ; P ) t = M AC(K M ; C)
C t
not
provable
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
t = H (kkm)
t H
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
H (k)
almost
k
k
kkmkp k
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
m p
m0
kkmkpkm 0
kkmkpkm 0kp0
exactly
mkpkm 0
k
gluepadding
m m0
def
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
f or in
r et ur n
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
t = H (mkk)
t = H (kkmkk)
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
m
k
pi n n er k
(= 0x3636 : : :)
f
b bit s
k
pou t er k
(= 0x5c5c: : :)
f
b bit s
pi nner
pout er
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
pi n ner pout er
p
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
a b
p
t = m a+ b ( p)
m
p m
M mi
P
t = (m n an + + m 1 a) + b ( p)
| {z }
P (M ;a)
P (M ; a) = a (a (a ( ) + m2) + m 1) + b ( p)
p
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
a; b
a b
m1; m2 (a; b)
t 1 = m1 a + b ( p)
t 2 = m2 a + b ( p)
a; b
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
t1 t 2 = (m 1 a + b) (m 2 a + b) ( p)
+
t1 t 2 = m1 a + b m2 a b ( p)
+ b b
t1 t 2 = m1 a m2 a ( p)
+ a
t1 t 2 = a (m 1 m 2) ( p)
+ (m 1 m2)
1
a = (t 1 t 2 )(m 1 m2) ( p)
a t1 t2 b
t 1 = m1 a + b ( p)
+
b = t1 m1 a ( p)
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
O
n F
O(k2; M )
k1 k2
a b
k2
O
a b k2
F (k1; n) F
O(k2 ; M ) M
O
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
wrong
about
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
A E
f encrypt ed
aut hent icat ed
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
P1 Pn X
:::
1 n X
k E k E k E
1 n ta
C1 ::: Cn t
t X
ta
ta
i
X Pi
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
P1 Pn
:::
1 n
k E k E
ta
CHAPTER 11. M ESSAGE AUTHENTICATION CODES
CHAPTER 12. SIGNATURE ALGORITHMS
CHAPTER 12. SIGNATURE ALGORITHMS
H
L N
L
L
N
q N N
L p
p 1 q
g
( p) q
g= 2(p 1)/ q ( p)
p 1 g
(p; q; g)
x 0 < x < q
y y = gx ( p)
(p; q; g; y) x
k
q k
CHAPTER 12. SIGNATURE ALGORITHMS
k
r; s m
r = (gk ( p)) ( q)
1
s= k (H (m) + xr ) ( q)
q
q k
m
(r; s)
1
w= s ( q)
u1 = wH (m) ( q)
u2 = wr ( q)
v = (gu 1 yu 2 ( p)) ( q)
v r
k
CHAPTER 12. SIGNATURE ALGORITHMS
(r i ; si )
mi k
CHAPTER 12. SIGNATURE ALGORITHMS
(r 1; s1) (r 2; s2 ) m1 m2
s1 s2
1
s1 = k (H (m 1) + xr 1) ( q)
1
s2 = k (H (m 2) + xr 2) ( q)
r1 r2
r i = gk ( q)
k r k
ri x
si
1 1
s1 s2 = k (H (m 1) + xr ) k (H (m 2) + xr ) ( q)
1
= k ((H (m 1 ) + xr ) (H (m 2) + xr )) ( q)
1
= k (H (m 1) + xr H (m 2 ) xr ) ( q)
1
= k (H (m 1) H (m 2)) ( q)
1
k = (H (m 1 ) H (m 2 )) (s1 s2) ( q)
H (m 1) H (m 2)
s1
CHAPTER 12. SIGNATURE ALGORITHMS
s2
k x
s
k x
1
s= k (H (m) + xr ) ( q)
(r; s)
x
sk = H (m) + xr ( q)
sk H (m) = xr ( q)
1
r (sk H (m)) = x ( q)
H (m) k
k s
1
r ( q)
r q
q
k
k k once
k ri ri
CHAPTER 12. SIGNATURE ALGORITHMS
non-repudiation
CHAPTER 12. SIGNATURE ALGORITHMS
keys
CHAPTER 13. KEY DERIVATION FUNCTIONS
CHAPTER 13. KEY DERIVATION FUNCTIONS
not
CHAPTER 13. KEY DERIVATION FUNCTIONS
extraction
phase
expansion phase
def
r et ur n
CHAPTER 13. KEY DERIVATION FUNCTIONS
concentrating amplifying
CHAPTER 13. KEY DERIVATION FUNCTIONS
def
” ” ” Ex pands t he k ey , wi t h opt i onal i nf o. ” ” ”
f or in
y i el d
def
” ” ” Col l ec t s out put f r om t he ex pans i on s t ep unt i l enough
has been col l ect ed; t hen r et ur ns t hat out put . ” ” ”
f or in
if
br eak
el s e
# Thi s bl ock i s execut ed when t he f or l oop * i sn’ t *
# t er mi nat ed by t he ‘ ‘ br eak ‘ ‘ s t at ement , whi ch
# happens when we r un out of ‘ ‘ ex pand‘ ‘ out put s
CHAPTER 13. KEY DERIVATION FUNCTIONS
r et ur n
look
CHAPTER 14. RANDOM NUMBER GENERATORS
CHAPTER 14. RANDOM NUMBER GENERATORS
CHAPTER 14. RANDOM NUMBER GENERATORS
r
4kB T f
i =
R
p
v= 4kB T R f
could
never
always
CHAPTER 14. RANDOM NUMBER GENERATORS
CHAPTER 14. RANDOM NUMBER GENERATORS
Dual _EC_DRBG
CHAPTER 14. RANDOM NUMBER GENERATORS
CHAPTER 14. RANDOM NUMBER GENERATORS
CHAPTER 14. RANDOM NUMBER GENERATORS
(r P )
s (sP ) r (r Q)
P Q
CHAPTER 14. RANDOM NUMBER GENERATORS
s
s r
P
r = (sP )
r
Q
r Q
o = ( (r Q))
r P
s= (r P )
x
y
CHAPTER 14. RANDOM NUMBER GENERATORS
216
(r Q)
y2 x 3 + ax + b ( p)
a; b; p
x y
p p
y2 = q = x 3 + ax + b ( p) A = (x; q) =
(x; y)
A rQ
r s
r rQ
Q
CHAPTER 14. RANDOM NUMBER GENERATORS
e eQ = P
e
A rQ
(eA) = (er Q) = (r P ) ( p)
e; P; Q (r P )
s
e
s o
A right A
216 x
x
215 A
rQ
e eQ = P
P Q
CHAPTER 14. RANDOM NUMBER GENERATORS
P p Q0
P d
0
Q = dP
e eQ0 = P d Q0 = dP
e
d
s
P Q
actual
how Q
e
CHAPTER 14. RANDOM NUMBER GENERATORS
Q
d Q = dP d
d
d
219937 1 4 106001
not
CHAPTER 14. RANDOM NUMBER GENERATORS
S i
seed
tempering
i
CHAPTER 14. RANDOM NUMBER GENERATORS
seed
def
f or in
r et ur n
CHAPTER 14. RANDOM NUMBER GENERATORS
0 0= 0 1= 1 0= 0 1 1= 1
def
f or in
if
CHAPTER 14. RANDOM NUMBER GENERATORS
def
r et ur n
bijective one-to-one
CHAPTER 14. RANDOM NUMBER GENERATORS
232 32
def
r et ur n
def
f or in
r et ur n
CHAPTER 14. RANDOM NUMBER GENERATORS
def
f or in
r et ur n
CHAPTER 14. RANDOM NUMBER GENERATORS
CHAPTER 15. SSL AND TLS
CHAPTER 15. SSL AND TLS
CHAPTER 15. SSL AND TLS
CHAPTER 15. SSL AND TLS
CHAPTER 15. SSL AND TLS
<i nput
>
CHAPTER 15. SSL AND TLS
class
CHAPTER 15. SSL AND TLS
CHAPTER 15. SSL AND TLS
before
CHAPTER 15. SSL AND TLS
not
CHAPTER 15. SSL AND TLS
sent
CHAPTER 16. OPENPGP AND GPG
only
CHAPTER 16. OPENPGP AND GPG
CHAPTER 16. OPENPGP AND GPG
CHAPTER 17. OFF-THE-RECORD MESSAGING (OTR)
CHAPTER 17. OFF-THE-RECORD MESSAGING (OTR)
pA ; sA ) (pB ; sB )
E
D
S
CHAPTER 17. OFF-THE-RECORD MESSAGING (OTR)
r x
E (r; gx ) H (gx )
y gy
authenticate
CHAPTER 17. OFF-THE-RECORD MESSAGING (OTR)
s = (gy ) x
s c; c0
m 1; m 01 ; m 2 ; m 02
iB
x
(x; g )
M B = M m 1 (gx ; gy ; pB ; i B )
X B = (pB ; i B ; S(pB ; M B ))
r; E c(X B ); M m 2 (E c(X B ))
MB
r
H (gx )
s = (gx ) y
c; c0; m 1; m 01 ; m 2; m 02 m2
M m 2 (E c(X B ))
c
M B = M m 1 (gx ; gy ; pB ; i B )
S(pB ; M B )
CHAPTER 17. OFF-THE-RECORD MESSAGING (OTR)
iA
(y; gy ) MA = M m 01 (g ; gx ; pA ; i A )
y XA =
pA ; i A ; S(pA ; M A ) E c0(X A ); M m 02 (E c(X B ))
M m 02 (E c(X B ))
XB
E c0(X A ) XA
MA =
M m 01 (gy ; gx ; pA ; i A )
S(pA ; M A )
0
CHAPTER 17. OFF-THE-RECORD MESSAGING (OTR)
APPENDIX A. MODUL AR ARITHMETIC
2+ 5 = 7
APPENDIX A. MODUL AR ARITHMETIC
10 2= 8
(10 + 4) 12 = 2
(2 5) 12 = 9
( 12)
=
APPENDIX A. MODUL AR ARITHMETIC
10 + 4 2 ( 12)
2 5 9 ( 12)
10+ 4 = 14
2 5 9( 12)
APPENDIX A. MODUL AR ARITHMETIC
30 = 2 3 5
360 = 23 32 5
has
unique 2 2
2 2 1 2 2 1 1
not
APPENDIX A. MODUL AR ARITHMETIC
n x = x| + x +{ z: : : + x}
n
a b c
c
( m) b a ( m)
2
5 6 2( 7) 6 5( 7)
5 6 = 30
a
a
1
x x = 1
APPENDIX A. MODUL AR ARITHMETIC
a n
(n)
a 1 ( n)
a
a 1
(n) 1 1
a a ( n)
a 1
p 1
APPENDIX A. MODUL AR ARITHMETIC
p (p) = p 1
a
1 (p) 1
a a ap 2
( p)
an = |a a { z: : : a}
n
220
220 = (210) 2
210
21
APPENDIX A. MODUL AR ARITHMETIC
3209 ( 19)
209 = 1 27 + 1 26 + 0 25 + 1 24 + 0 23 + 0 22 + 0 21 + 1 20
= 1 128 + 1 64 + 0 32 + 1 16 + 0 8 + 0 4 + 0 2 + 1 1
= 128 + 64 + 16 +1
APPENDIX A. MODUL AR ARITHMETIC
316 17 ( 19)
364 (316) 4 174 16 ( 19)
3128 (364) 2 162 9 ( 19)
d
APPENDIX A. MODUL AR ARITHMETIC
k k
P i j
2 2
kj = 1 kj = 0
t
X 1
k= 2i ki
i= 0
ki k i k
t
t 1
t= 3
APPENDIX A. MODUL AR ARITHMETIC
t
X 1
6= 2i ki
i= 0
X2
= 2i ki
i= 0
= k2 22 + k1 21 + k0 20
= 1 22 + 1 21 + 0 20
Lj
t
X 1
Lj = 2i j
ki
i= j
L1 k= 6
X2
L1 = 2i 1
ki
i= 1
= 21 k2 + 20 k1
| {z } | {z }
i= 2 i= 1
= 2 1+ 1 1
= 3
Lj k j
APPENDIX A. MODUL AR ARITHMETIC
multiplying
L j = 2 L j + 1 + kj
k
j
k=
Lj = L2 =
Lj + 1 = L3 =
2 Lj + 1 = 2 L3 =
L2 L3
kj
kj Lj
Hj
Hj = Lj + 1 ( ) Lj = Hj 1
APPENDIX A. MODUL AR ARITHMETIC
L j = 2 L j + 1 + kj
+ (L j + 1 = H j + 1 1)
L j = L j + 1 + kj + H j + 1 1
+ (L j + 1 = H j + 1 1)
L j = 2 H j + 1 + kj 2
Lj
Hj
8
< 2L kj = 0;
j+1
Lj =
: L
j + 1 + Hj + 1 kj = 1:
8
<L
j + 1 + Hj + 1 kj = 0;
Hj =
: 2H kj = 1:
j+1
gk
8
< g2L j + 1 = gL j + 1 2 kj = 0;
gL j =
: gL j + 1 + H j + 1 = gL j + 1 gH j + 1 kj = 1:
8
< gL j + 1 + H j + 1 = gL j + 1 gH j + 1 kj = 0;
gH j =
: g2H j + 1 = gH j + 1 2 kj = 1:
Lj k j L0 k
k gk
gL 0 gL t 1 g
APPENDIX A. MODUL AR ARITHMETIC
k
gL 0 = gk gk
kj = 0 gL j gH j
kj = 1
k
def
f or in
if
el s e
r et ur n
APPENDIX A. MODUL AR ARITHMETIC
bx = y x= by b
x y y b x
36 9( 15) 6 39 ( 15)
intrinsically
APPENDIX A. MODUL AR ARITHMETIC
APPENDIX A. MODUL AR ARITHMETIC
a b (a; b) = 1 multi-
plicativeorder a ( b) k
ak = 1( b)
y2 = x 3 ax + b
x 2 + y2 = 1 + dx 2y2
APPENDIX B. ELLIPTIC CURVES
::: 2; 1; 0; 1; 2; : : :
a b ?
a?b
a b c
(a ? b) ? c = a ? (b ? c)
associativity associative
i a?i = i ?a = a
a+ 0= 0+ a = a
a b
a ? b = b? a = i i
a + ( a) = ( a) + a = 0
APPENDIX B. ELLIPTIC CURVES
a; b a ? b = b ? a
commutativity commutative
P Q P+ Q
P Q R P + (Q + R) =
(P + Q) + R
O
P P + O= O+ P = P
P + Q= Q+ P
P; Q
APPENDIX B. ELLIPTIC CURVES
In Advancesin Cryptology - ASIACRYPT ’96, LNCS1163
BIBLIOGRAPHY
Advancesin Cryptology -
EUROCRYPT ’94 - LectureNotesin Computer Science
BIBLIOGRAPHY
Noticesof theAM S
Des. Codes
Cryptography
BIBLIOGRAPHY
Journal of Cryptology
GLOSSARY
GLOSSARY
GLOSSARY
N once
GLOSSARY
GLOSSARY
GLOSSARY
ACRONYM S
ACRONYM S
ACRONYM S