Professional Documents
Culture Documents
10 Numth Annotated PDF
10 Numth Annotated PDF
Nota3on
Dan
Boneh
Background
We
will
use
a
bit
of
number
theory
to
construct:
• Key
exchange
protocols
• Digital
signatures
• Public-‐key
encryp3on
Nota3on:
Can
do
addi3on
and
mul3plica3on
modulo
N
Dan
Boneh
Modular
arithme3c
Examples:
let
N
=
12
9
+
8
=
5
in
5
×
7
=
11
in
5
−
7
=
10
in
Arithme3c
in
works
as
you
expect,
e.g
x⋅(y+z)
=
x⋅y
+
x⋅z
in
Dan
Boneh
Greatest
common
divisor
Def:
For
ints.
x,y:
gcd(x,
y)
is
the
greatest
common
divisor
of
x,y
Fact:
for
all
ints.
x,y
there
exist
ints.
a,b
such
that
a⋅x
+
b⋅y
=
gcd(x,y)
a,b
can
be
found
efficiently
using
the
extended
Euclid
alg.
Example: let N be an odd integer. The inverse of 2 in is
Dan
Boneh
Modular
inversion
Which
elements
have
an
inverse
in
?
Lemma:
x
in
has
an
inverse
if
and
only
if
gcd(x,N)
=
1
Proof:
gcd(x,N)=1
⇒
∃
a,b:
a⋅x
+
b⋅N
=
1
gcd(x,N)
>
1
⇒
∀a:
gcd(
a⋅x,
N
)
>
1
⇒
a⋅x
≠
1
in
Dan
Boneh
More
nota3on
Def:
=
(set
of
inver3ble
elements
in
)
=
= { x∈ : gcd(x,N) = 1 }
Examples:
1. for
prime
p,
2.
=
{
1,
5,
7,
11}
Dan
Boneh
End
of
Segment
Dan
Boneh
Online
Cryptography
Course
Dan
Boneh
Dan
Boneh
Review
N
denotes
an
n-‐bit
posi3ve
integer.
p
denotes
a
prime.
=
{
x∈ZN
:
gcd(x,N)
=
1
}
Can
find
inverses
efficiently
using
Euclid
alg.:
3me
=
O(n2)
Dan
Boneh
Fermat’s
theorem
(1640)
Thm:
Let
p
be
a
prime
∀
x
∈
(Zp)*
:
xp-‐1
=
1
in
Zp
Example:
p=5.
34
=
81
=
1
in
Z5
So:
x
∈
(Zp)*
⇒
x⋅xp-‐2
=
1
⇒
x−1
=
xp-‐2
in
Zp
another
way
to
compute
inverses,
but
less
efficient
than
Euclid
Dan
Boneh
Applica3on:
genera3ng
random
primes
Suppose
we
want
to
generate
a
large
random
prime
say,
prime
p
of
length
1024
bits
(
i.e.
p
≈
21024
)
Step
1:
choose
a
random
integer
p
∈
[
21024
,
21025-‐1
]
Step
2:
test
if
2p-‐1
=
1
in
Zp
If
so,
output
p
and
stop.
If
not,
goto
step
1
.
Simple
algorithm
(not
the
best).
Pr[
p
not
prime
]
<
2-‐60
Dan
Boneh
The
structure
of
(Zp)*
Thm
(Euler):
(Zp)*
is
a
cyclic
group,
that
is
∃ g∈(Zp)* such that {1, g, g2, g3, …, gp-‐2} = (Zp)*
Example: p=7. {1, 3, 32, 33, 34, 35} = {1, 3, 2, 6, 4, 5} = (Z7)*
Not
every
elem.
is
a
generator:
{1,
2,
22,
23,
24,
25}
=
{1,
2,
4}
Dan
Boneh
Order
For
g∈(Zp)*
the
set
{1
,
g
,
g2,
g3,
…
}
is
called
the
group
generated
by
g,
denoted
<g>
Def: the order of g∈(Zp)* is the size of <g>
Dan
Boneh
Online
Cryptography
Course
Dan
Boneh
Dan
Boneh
Modular
e’th
roots
We
know
how
to
solve
modular
linear
equa3ons:
a⋅x
+
b
=
0
in
ZN
Solu3on:
x
=
−b⋅a-‐1
in
ZN
What
about
higher
degree
polynomials?
Example:
let
p
be
a
prime
and
c∈Zp
.
Can
we
solve:
x2
–
c
=
0
,
y3
–
c
=
0
,
z37
–
c
=
0
in
Zp
Dan
Boneh
Modular
e’th
roots
Let
p
be
a
prime
and
c∈Zp
.
Def:
x∈Zp
s.t.
xe
=
c
in
Zp
is
called
an
e’th
root
of
c
.
Examples:
71/3
=
6
in
31/2
=
5
in
21/2
does
not
exist
in
11/3
=
1
in
Dan
Boneh
The
easy
case
When
does
c1/e
in
Zp
exist?
Can
we
compute
it
efficiently?
Dan
Boneh
The
case
e=2:
square
roots
If
p
is
an
odd
prime
then
gcd(
2,
p-‐1)
≠
1
x
−x
Fact:
in
,
x
⟶
x2
is
a
2-‐to-‐1
func3on
x2
Example:
in
:
1
10
2
9
3
8
4
7
5
6
1
4
9
5
3
Def:
x
in
is
a
quadra5c
residue
(Q.R.)
if
it
has
a
square
root
in
p
odd
prime
⇒
the
#
of
Q.R.
in
is
(p-‐1)/2
+
1
Dan
Boneh
Euler’s
theorem
Thm:
x
in
(Zp)*
is
a
Q.R.
⟺
x(p-‐1)/2
=
1
in
Zp
(p
odd
prime)
Example:
in
:
15,
25,
35,
45,
55,
65,
75,
85,
95,
105
=
1
-‐1
1
1
1,
-‐1,
-‐1,
-‐1,
1,
-‐1
1/2
Note:
x≠0
⇒
x(p-‐1)/2
=
(x ) =
11/2
∈
{
1,
-‐1
}
in
Z
p-‐1
p
Def:
x(p-‐1)/2
is
called
the
Legendre
Symbol
of
x
over
p
(1798)
Dan
Boneh
Compu3ng
square
roots
mod
p
Suppose
p
=
3
(mod
4)
Lemma:
if
c∈(Zp)*
is
Q.R.
then
√c
=
c(p+1)/4
in
Zp
Proof:
When
p
=
1
(mod
4),
can
also
be
done
efficiently,
but
a
bit
harder
Dan
Boneh
End
of
Segment
Dan
Boneh
Online
Cryptography
Course
Dan
Boneh
Arithme3c algorithms
Dan
Boneh
Represen3ng
bignums
Represen3ng
an
n-‐bit
integer
(e.g.
n=2048)
on
a
64-‐bit
machine
32
bits
32
bits
32
bits
⋯
32
bits
n/32
blocks
Note:
some
processors
have
128-‐bit
registers
(or
more)
and
support
mul3plica3on
on
them
Dan
Boneh
Arithme3c
Given:
two
n-‐bit
integers
Dan
Boneh
End
of
Segment
Dan
Boneh
Online
Cryptography
Course
Dan
Boneh
Intractable problems
Dan
Boneh
Easy
problems
• Given
composite
N
and
x
in
ZN
find
x-‐1
in
ZN
Def: We say that DLOG is hard in G if for all efficient alg. A:
Pr
g⟵G,
x
⟵Z
[
A(
G,
q,
g,
gx
)
=
x
]
<
negligible
q
Example
candidates:
(1)
(Zp)*
for
large
p,
(2)
Ellip3c
curve
groups
mod
p
Dan
Boneh
Compu3ng
Dlog
in
(Zp)*
(n-‐bit
prime
p)
Best
known
algorithm
(GNFS):
run
3me
exp(
)
Ellip3c
Curve
cipher
key
size
modulus
size
group
size
80
bits
1024
bits
160
bits
128
bits
3072
bits
256
bits
256
bits
(AES)
15360
bits
512
bits
As a result: slow transi3on away from (mod p) to ellip3c curves
Dan
Boneh
An
applica3on:
collision
resistance
Choose
a
group
G
where
Dlog
is
hard
(e.g.
(Zp)*
for
large
p)
Let
q
=
|G|
be
a
prime.
Choose
generators
g,
h
of
G
For
x,y
∈
{1,…,q}
define
H(x,y)
=
gx
⋅
hy
in
G
Lemma: finding collision for H(.,.) is as hard as compu3ng Dlogg(h)
Best known alg. (NFS): run 3me exp( ) for n-‐bit integer
Dan
Boneh
End
of
Segment
Dan Boneh