• No results found

TYPES Workshop, june 2006 p. 1/22. The Elliptic Curve Factorization method

N/A
N/A
Protected

Academic year: 2021

Share "TYPES Workshop, june 2006 p. 1/22. The Elliptic Curve Factorization method"

Copied!
72
0
0

Loading.... (view fulltext now)

Full text

(1)

.

The Elliptic Curve Factorization method

Laurent Fousse

laurentkomite.net

LORIA Université Henri Poinaré Nany I

(2)

Outline

1. Introduction

2. Factorization method principle 3. Elliptic Curves

4. Fast modular multiplication 5. ECM in practice: GMP-ECM 6. Conclusion

(3)

Why factor?

interesting arithmetic problems

(4)

Why factor?

interesting arithmetic problems

factorize numbers of a given family (Fermat, Cunningham)

(5)

Why factor?

interesting arithmetic problems

factorize numbers of a given family (Fermat, Cunningham) link to cryptography

(6)

Why factor?

interesting arithmetic problems

factorize numbers of a given family (Fermat, Cunningham) link to cryptography

used for primality proving

(7)

Why factor?

interesting arithmetic problems

factorize numbers of a given family (Fermat, Cunningham) link to cryptography

used for primality proving for fun and records breaking

(8)

Factorization method principle

Let

n

be the number to be factored, and

p

an unknown prime factor of

n

.

(9)

Factorization method principle

Let

n

be the number to be factored, and

p

an unknown prime factor of

n

. 1. Pick an abelian group

G

p where operations are compatible with

modular arithmetics.

(10)

Factorization method principle

Let

n

be the number to be factored, and

p

an unknown prime factor of

n

. 1. Pick an abelian group

G

p where operations are compatible with

modular arithmetics.

2. Perform all operations mod

n

in the structure

G

n.

(11)

Factorization method principle

Let

n

be the number to be factored, and

p

an unknown prime factor of

n

. 1. Pick an abelian group

G

p where operations are compatible with

modular arithmetics.

2. Perform all operations mod

n

in the structure

G

n. 3. Operations done mod

n

reduce naturally to

G

p.

(12)

Factorization method principle

Let

n

be the number to be factored, and

p

an unknown prime factor of

n

. 1. Pick an abelian group

G

p where operations are compatible with

modular arithmetics.

2. Perform all operations mod

n

in the structure

G

n. 3. Operations done mod

n

reduce naturally to

G

p.

4. Pick an element

P

0

G

n, a positive integer

x

and compute

x

·

P

.

(13)

Factorization method principle

Let

n

be the number to be factored, and

p

an unknown prime factor of

n

. 1. Pick an abelian group

G

p where operations are compatible with

modular arithmetics.

2. Perform all operations mod

n

in the structure

G

n. 3. Operations done mod

n

reduce naturally to

G

p.

4. Pick an element

P

0

G

n, a positive integer

x

and compute

x

·

P

. 5. If

o

Gp

(

P

0

)

|

x

the computation of

x

·

P

0 will give a factor of

n

(probably).

(14)

Factorization method principle

Example:

(15)

Factorization method principle

Example:

For the P-1 factorization method, we have

G

p

= (

Z

/p

Z

)

∗.

(16)

Factorization method principle

Example:

For the P-1 factorization method, we have

G

p

= (

Z

/p

Z

)

∗. For the P+1 factorization method, we have

G

p

=

GF

(

p

2

)

(17)

Factorization method principle

Example:

For the P-1 factorization method, we have

G

p

= (

Z

/p

Z

)

∗. For the P+1 factorization method, we have

G

p

=

GF

(

p

2

)

∗ (more correctly

GF

(

p

2

)

/GF

(

p

)

∗.

(18)

Factorization method principle

Example:

For the P-1 factorization method, we have

G

p

= (

Z

/p

Z

)

∗. For the P+1 factorization method, we have

G

p

=

GF

(

p

2

)

∗ (more correctly

GF

(

p

2

)

/GF

(

p

)

∗.

For ECM, we chose an elliptic curve

E

a,b.

(19)

A simple P-1 example

Take

n

= 10090019171

,

P

0

= 42

and

x

= 42

.

(20)

A simple P-1 example

Take

n

= 10090019171

,

P

0

= 42

and

x

= 42

. We notive that

gcd(

P

0x

1

, n

) = 1009

so we found a non trivial factor

p

= 1009

of

n

.

(21)

A simple P-1 example

Take

n

= 10090019171

,

P

0

= 42

and

x

= 42

. We notive that

gcd(

P

0x

1

, n

) = 1009

so we found a non trivial factor

p

= 1009

of

n

. The order of

42

in

(

Z

/p

Z

)

∗ is

21

and

21

|

42

.

(22)

A simple P-1 example

Take

n

= 10090019171

,

P

0

= 42

and

x

= 42

. We notive that

gcd(

P

0x

1

, n

) = 1009

so we found a non trivial factor

p

= 1009

of

n

. The order of

42

in

(

Z

/p

Z

)

∗ is

21

and

21

|

42

. Moreover

p

1 = 2

4

·

3

2

·

7

(23)

A simple P-1 example

Take

n

= 10090019171

,

P

0

= 42

and

x

= 42

. We notive that

gcd(

P

0x

1

, n

) = 1009

so we found a non trivial factor

p

= 1009

of

n

. The order of

42

in

(

Z

/p

Z

)

∗ is

21

and

21

|

42

. Moreover

p

1 = 2

4

·

3

2

·

7

n

=

p

·

q

where

q

is prime and

q

1 = 2

·

7

2

·

67

·

1523

(24)

A simple P-1 example

Take

n

= 10090019171

,

P

0

= 42

and

x

= 42

. We notive that

gcd(

P

0x

1

, n

) = 1009

so we found a non trivial factor

p

= 1009

of

n

. The order of

42

in

(

Z

/p

Z

)

∗ is

21

and

21

|

42

. Moreover

p

1 = 2

4

·

3

2

·

7

n

=

p

·

q

where

q

is prime and

q

1 = 2

·

7

2

·

67

·

1523

and the order of

42

in

(

Z

/q

Z

)

∗ is

102041

>

42

.

(25)

A simple P-1 example

Take

n

= 10090019171

,

P

0

= 42

and

x

= 42

. We notive that

gcd(

P

0x

1

, n

) = 1009

so we found a non trivial factor

p

= 1009

of

n

. The order of

42

in

(

Z

/p

Z

)

∗ is

21

and

21

|

42

. Moreover

p

1 = 2

4

·

3

2

·

7

n

=

p

·

q

where

q

is prime and

q

1 = 2

·

7

2

·

67

·

1523

and the order of

42

in

(

Z

/q

Z

)

∗ is

102041

>

42

.

So we were able to factorize

n

.

(26)

Elliptic Curve

An elliptic curve over a field

K

of characteristic other than

2

or

3

is the set of point

(

X, Y

)

such that

Y

2

=

X

3

+

AX

+

B

where

A, B

K

and

4

A

3

+ 27

B

3

6

= 0

, and a point at infinity

0

E.

(27)

Elliptic Curve

An elliptic curve over a field

K

of characteristic other than

2

or

3

is the set of point

(

X, Y

)

such that

Y

2

=

X

3

+

AX

+

B

where

A, B

K

and

4

A

3

+ 27

B

3

6

= 0

, and a point at infinity

0

E. This is called the Weierstrass representation of the curve.

(28)

Elliptic Curve

An elliptic curve over a field

K

of characteristic other than

2

or

3

is the set of point

(

X, Y

)

such that

Y

2

=

X

3

+

AX

+

B

where

A, B

K

and

4

A

3

+ 27

B

3

6

= 0

, and a point at infinity

0

E. This is called the Weierstrass representation of the curve.

Switching to Montgomery and homogeneous form the equation of the curve becomes

by

2

z

=

x

3

+

ax

2

z

+

xz

2

which is more suited for computations.

(29)

Elliptic Curve

The geometric interpretation of the group operation is that three aligned points sum to zero.

(infinity) :

0

E

= (0 : 1 : 0)

b

b

b

b

(30)

Elliptic Curve

The geometric interpretation of the group operation is that three aligned points sum to zero.

(infinity) :

0

E

= (0 : 1 : 0)

b

P

b

Q

b b

(31)

Elliptic Curve

The geometric interpretation of the group operation is that three aligned points sum to zero.

(infinity) :

0

E

= (0 : 1 : 0)

b

P

b

Q

b b

(32)

Elliptic Curve

The geometric interpretation of the group operation is that three aligned points sum to zero.

(infinity) :

0

E

= (0 : 1 : 0)

b

P

b

Q

b b

P

+

Q

(33)

Arithmetic on the curve

A point on the curve is a triplet

(

x

:

y

:

z

)

.

(34)

Arithmetic on the curve

A point on the curve is a triplet

(

x

:

y

:

z

)

.

We can forget

y

and identify

P

with

P

to get simpler formulas.

(35)

Arithmetic on the curve

A point on the curve is a triplet

(

x

:

y

:

z

)

.

We can forget

y

and identify

P

with

P

to get simpler formulas. To compute

P

+

Q

:

x

P+Q

= 4

z

PQ

·

(

x

P

x

Q

z

P

z

Q

)

2

z

P+Q

= 4

x

PQ

·

(

x

P

z

Q

z

P

x

Q

)

2

so we need to have computed

P

Q

already. Formulas for doubling omitted.

(36)

Comparison of ECM with other methods

Group Order

Z

/p

Z

p

1 = Π

1

(

p

)

GF

(

p

2

)

p

+ 1 = Π

2

(

p

)

“Generic cyclotomic”

Π

d

(

p

)

E

a,b

mod

p

|

o

(

p

+ 1)

|

<

2

p

(37)

Complexity of ECM

Let

L

α,c

(

p

) =

e

c(log p)α(log logp)1−α. Then the expected time complexity of ECM to find a factor

p

of

n

is

O

(

L

1 2,

2

(

p

)

M

(log

n

))

where

M

(log

n

)

is the complexity of multiplication mod

n

.

(38)

Complexity of ECM

Let

L

α,c

(

p

) =

e

c(log p)α(log logp)1−α. Then the expected time complexity of ECM to find a factor

p

of

n

is

O

(

L

1 2,

2

(

p

)

M

(log

n

))

where

M

(log

n

)

is the complexity of multiplication mod

n

. for NFS

O

(

L

1

3,c

(

n

))

(where

c <

2

).

(39)

Complexity of ECM

Let

L

α,c

(

p

) =

e

c(log p)α(log logp)1−α. Then the expected time complexity of ECM to find a factor

p

of

n

is

O

(

L

1 2,

2

(

p

)

M

(log

n

))

where

M

(log

n

)

is the complexity of multiplication mod

n

. for NFS

O

(

L

1

3,c

(

n

))

(where

c <

2

). ECM won’t break RSA any time soon.

(40)

Complexity of ECM

Let

L

α,c

(

p

) =

e

c(log p)α(log logp)1−α. Then the expected time complexity of ECM to find a factor

p

of

n

is

O

(

L

1 2,

2

(

p

)

M

(log

n

))

where

M

(log

n

)

is the complexity of multiplication mod

n

. for NFS

O

(

L

1

3,c

(

n

))

(where

c <

2

). ECM won’t break RSA any time soon.

huge numbers with expected relatively small factors are out of reach for NSF: ECM can be used there.

(41)

How to chose

x

The hope is to pick

P

0 and

x

such that

x

|

o

Gp

(

P

0

)

. Use two bounds

B

1

, B

2

(42)

How to chose

x

The hope is to pick

P

0 and

x

such that

x

|

o

Gp

(

P

0

)

. Use two bounds

B

1

, B

2

“cover” all primes up to

B

1,

(43)

How to chose

x

The hope is to pick

P

0 and

x

such that

x

|

o

Gp

(

P

0

)

. Use two bounds

B

1

, B

2

“cover” all primes up to

B

1,

permit an additional prime factor in

[

B

1

, B

2

]

.

(44)

How to chose

x

The hope is to pick

P

0 and

x

such that

x

|

o

Gp

(

P

0

)

. Use two bounds

B

1

, B

2

“cover” all primes up to

B

1,

permit an additional prime factor in

[

B

1

, B

2

]

. This explains naturally the two stages method used in GMP-ECM.

(45)

High level algorithm description

INPUT: a number n, integer bounds B1 ≤ B2.

OUTPUT: a factor p of n or FAIL.

1: Choose a random elliptic curve Ea,b mod n and a point P0 = (x0 : y0 : z0) on it. 2: Compute Q = Qπ≤B 1 π ⌊log B1/logπ⌋P 0. 3: for π prime, B1 < π ≤ B2 do 4: (xπ : yπ : zπ) ← πQ 5: g ← gcd(n, zπ) 6: if g 6= 1 then 7: return g 8: end if 9: end for 10: return FAIL

(46)

Algorithmic challenges

An implementation of ECM is faced with the following algorithmic challenges:

(47)

Algorithmic challenges

An implementation of ECM is faced with the following algorithmic challenges:

fast modular arithmetic

(48)

Algorithmic challenges

An implementation of ECM is faced with the following algorithmic challenges:

fast modular arithmetic efficient curve operations

(49)

Algorithmic challenges

An implementation of ECM is faced with the following algorithmic challenges:

fast modular arithmetic efficient curve operations

fast polynomial evaluation (stage 2)

(50)

Algorithmic challenges

An implementation of ECM is faced with the following algorithmic challenges:

fast modular arithmetic efficient curve operations

fast polynomial evaluation (stage 2)

In order to be fast, we use algorithmic improvements tailored to the size of the numbers used (with thresholds) as well as assembly code.

(51)

Modular arithmetic

Operations on the curve translate into residue arithmetic operations (addition, multiplication and division mod

n

).

(52)

Modular arithmetic

Operations on the curve translate into residue arithmetic operations (addition, multiplication and division mod

n

).

divisions can be performed by way of multiplications

(53)

Modular arithmetic

Operations on the curve translate into residue arithmetic operations (addition, multiplication and division mod

n

).

divisions can be performed by way of multiplications

the most interesting operation to optimize is therefore multiplication.

(54)

Modular arithmetic

An example of algorithmic improvement for the operation:

(55)

Modular arithmetic

An example of algorithmic improvement for the operation:

c

a

·

b

mod

n

(56)

Modular arithmetic

An example of algorithmic improvement for the operation:

c

a

·

b

mod

n

The naive approach uses:

a full

log

n

×

log

n

2 log

n

multiplication,

(57)

Modular arithmetic

An example of algorithmic improvement for the operation:

c

a

·

b

mod

n

The naive approach uses:

a full

log

n

×

log

n

2 log

n

multiplication,

a modular reduction

2 log

n

by

log

n

(as costly as a division).

(58)

Modular arithmetic

Instead we can use Montgomery representation. Let

β

be the integer base (usually

β

= 2

32

)

and

l

smallest integer such that

β

l

> n

(59)

Modular arithmetic

Instead we can use Montgomery representation. Let

β

be the integer base (usually

β

= 2

32

)

and

l

smallest integer such that

β

l

> n

The Montgomery representation gives:

a

a

=

β

l

a

mod

n

(60)

Modular arithmetic

Instead we can use Montgomery representation. Let

β

be the integer base (usually

β

= 2

32

)

and

l

smallest integer such that

β

l

> n

The Montgomery representation gives:

a

a

=

β

l

a

mod

n

b

b

=

β

l

b

mod

n

(61)

Modular arithmetic

Instead we can use Montgomery representation. Let

β

be the integer base (usually

β

= 2

32

)

and

l

smallest integer such that

β

l

> n

The Montgomery representation gives:

a

a

=

β

l

a

mod

n

b

b

=

β

l

b

mod

n

a

·

b

β

l

a

·

b

= (

a

b

β

−l

) mod

n

= REDC(

a

b

)

(62)

Algorithm REDC

INPUT: numbers T, βl, n, n′ such that 0 ≤ T < βln and nn′ = −1 mod βl.

OUTPUT: T β−l mod n.

1: m ← T n′ mod βl ⊲ Lower half multiplication

2: t ← (T + mn)/βl ⊲ Upper half multiplication 3: if t ≤ n then

4: return t − n

5: else

6: return t 7: end if

(63)

Algorithm REDC

INPUT: numbers T, βl, n, n′ such that 0 ≤ T < βln and nn′ = −1 mod βl.

OUTPUT: T β−l mod n.

1: m ← T n′ mod βl ⊲ Lower half multiplication

2: t ← (T + mn)/βl ⊲ Upper half multiplication 3: if t ≤ n then 4: return t − n 5: else 6: return t 7: end if

mn

=

T n

n

=

T

mod

β

l

(64)

Algorithm REDC

INPUT: numbers T, βl, n, n′ such that 0 ≤ T < βln and nn′ = −1 mod βl.

OUTPUT: T β−l mod n.

1: m ← T n′ mod βl ⊲ Lower half multiplication

2: t ← (T + mn)/βl ⊲ Upper half multiplication 3: if t ≤ n then 4: return t − n 5: else 6: return t 7: end if

mn

=

T n

n

=

T

mod

β

l

l

=

T

mod

n

so

t

=

T β

−l

mod

n

(65)

Algorithm REDC

INPUT: numbers T, βl, n, n′ such that 0 ≤ T < βln and nn′ = −1 mod βl.

OUTPUT: T β−l mod n.

1: m ← T n′ mod βl ⊲ Lower half multiplication

2: t ← (T + mn)/βl ⊲ Upper half multiplication 3: if t ≤ n then 4: return t − n 5: else 6: return t 7: end if

mn

=

T n

n

=

T

mod

β

l

l

=

T

mod

n

so

t

=

T β

−l

mod

n

0

T

+

mn < β

l

n

+

β

l

n

so

0

t <

2

n

.

(66)

An example ECM factorization with GMP-ECM

Let

N

= 14421499473850156964908748714733530694523632245

48199639497786788488662355550896284406444518825

58206114371958127980496626323628808250533258921

4668868374102124472638792350353190035972075401

of 187 digits. We chose

B

1

= 433993

, the curve parameterized by

σ

= 550048451

(Suyama).

(67)

An example ECM factorization with GMP-ECM

$ em -v -v -sigma 550048451 433993 < omposite GMP-ECM 6.1 [powered by GMP 4.2℄ [ECM℄

Input number is [...℄ (187 digits) Using MODMULN

Using B1=433993, B2=347971482, polynomial Dikson(3), sigma=550048451 Expeted number of urves to find a fator of n digits:

20 25 30 35 40 45 50 55 60 65

6 33 241 2322 27856 401319 6767926 1.3e+08 2.9e+09 7.1e+10 Step 1 took 39656ms

Step 2 took 12204ms

********** Fator found in step 2: 344518986834068356794510012742065462371

Found probable prime fator of 39 digits: 344518986834068356794510012742065462371 Composite ofator 41...1 has 148 digits

(68)

Conclusion

ECM has seen numerous improvements, both mathematical and in the implementations since its discovery by H. W. Lenstra, Jr in 1985.

(69)

Conclusion

ECM has seen numerous improvements, both mathematical and in the implementations since its discovery by H. W. Lenstra, Jr in 1985.

easy to adapt to distributed computing (each computer runs a curve)

(70)

Conclusion

ECM has seen numerous improvements, both mathematical and in the implementations since its discovery by H. W. Lenstra, Jr in 1985.

easy to adapt to distributed computing (each computer runs a curve)

packaged in Debian

(71)

Conclusion

ECM has seen numerous improvements, both mathematical and in the implementations since its discovery by H. W. Lenstra, Jr in 1985.

easy to adapt to distributed computing (each computer runs a curve)

packaged in Debian why not try it today?

(72)

Some words from our sponsors

RNC7 Conference More Digits competition LORIA, Nancy July 10-12

http://rn7.loria.fr/ompetition.html

sequel to the "Many Digits" competition improve your numerical package

measure your accuracy (don’t be the “little guy” in the club anymore) it is not too late to join!

only doctor approved formulas! satisfaction guaranteed!

References

Related documents

Based on the important role of the capital market, and the staggering negative impact of the global financial crisis on capital market development Nigeria, the government

The cloud and shadow detection is done using window based thresholding approach [5] by considering hypothesis that, regions of the image covered by clouds

Detection through Macula Pigment Carotenoid Macula pigment (MP) formed of oxy-carotenoids of lutein and zeaxanthin and have higher concentration in macular compared

A Novel Rank Ordered Filter Based Edge Enhancement of Medical Images Using Intuitionistic Fuzzy Set Theory. In International Conference on Methods and Models in Computer

This thesis compares the effectiveness of three of the more well-known adaptive digital filter algorithms at removing 60 Hz harmonic noise from an actual distribution power line

ABSTRACT : Tall concrete buildings experience time-dependent axial shortening which may be interpreted as either absolute or differential, the former being with respect to a

Mice were trained using the auditory fear conditio- ning with a low-intensity footshock (0.3 mA) as above, and immediately after conditioning, they received intra- striatum infusion