File: ecm.1

package info (click to toggle)
gmp-ecm 7.0.4+ds-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,728 kB
  • sloc: asm: 36,431; ansic: 34,057; xml: 885; python: 799; sh: 698; makefile: 348
file content (505 lines) | stat: -rw-r--r-- 13,465 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
'\" t
.\"     Title: ECM
.\"    Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\"      Date: 03/01/2013
.\"    Manual: April 22, 2003
.\"    Source: April 22, 2003
.\"  Language: English
.\"
.TH "ECM" "1" "03/01/2013" "April 22, 2003" "April 22, 2003"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ecm \- integer factorization using ECM, P\-1 or P+1
.SH "SYNOPSIS"
.HP \w'\fBecm\fR\ 'u
\fBecm\fR [\fBoptions\fR] \fIB1\fR [\fIB2min\fR\-\fIB2max\fR | \fIB2\fR]
.br

.SH "DESCRIPTION"
.PP
ecm is an integer factoring program using the Elliptic Curve Method (ECM), the P\-1 method, or the P+1 method\&. The following sections describe parameters relevant to these algorithms\&.
.SH "STEP 1 AND STEP 2 BOUND PARAMETERS"
.PP
\fB\fIB1\fR\fR
.RS 4
\fIB1\fR
is the step 1 bound\&. It is a mandatory parameter\&. It can be given either in integer format (for example 3000000) or in floating\-point format (3000000\&.0 or 3e6)\&. The largest possible
\fIB1\fR
value is 9007199254740996 for P\-1, and ULONG_MAX or 9007199254740996 (whichever is smaller) for ECM and P+1\&. All primes 2 <= p <=
\fIB1\fR
are processed in step 1\&.
.RE
.PP
\fB\fIB2\fR\fR
.RS 4
\fIB2\fR
is the step 2 bound\&. It is optional: if omitted, a default value is computed from
\fIB1\fR, which should be close to optimal\&. Like
\fIB1\fR, it can be given either in integer or in floating\-point format\&. The largest possible value of
\fIB2\fR
is approximately 9e23, but depends on the number of blocks
\fIk\fR
if you specify the
\fB\-k\fR
option\&. All primes
\fIB1\fR
<= p <=
\fIB2\fR
are processed in step 2\&. If
\fIB2\fR
<
\fIB1\fR, no step 2 is performed\&.
.RE
.PP
\fB\fIB2min\fR\fR\fB\-\fR\fB\fIB2max\fR\fR
.RS 4
alternatively one may use the
\fIB2min\fR\-\fIB2max\fR
form, which means that all primes
\fIB2min\fR
<= p <=
\fIB2max\fR
should be processed\&. Thus specifying
\fIB2\fR
only corresponds to
\fIB1\fR\-\fIB2\fR\&. The values of
\fIB2min\fR
and
\fIB2max\fR
may be arbitrarily large, but their difference must not exceed approximately 9e23, subject to the number of blocks
\fIk\fR\&.
.RE
.SH "FACTORING METHOD"
.PP
\fB\-pm1\fR
.RS 4
Perform P\-1 instead of the default method (ECM)\&.
.RE
.PP
\fB\-pp1\fR
.RS 4
Perform P+1 instead of the default method (ECM)\&.
.RE
.SH "GROUP AND INITIAL POINT PARAMETERS"
.PP
\fB\-x0 \fR\fB\fIx\fR\fR
.RS 4
[ECM, P\-1, P+1] Use
\fIx\fR
(arbitrary\-precision integer or rational) as initial point\&. For example,
\fB\-x0 1/3\fR
is valid\&. If not given,
\fIx\fR
is generated from the sigma value for ECM, or at random for P\-1 and P+1\&.
.RE
.PP
\fB\-sigma \fR\fB\fIs\fR\fR
.RS 4
[ECM] Use
\fIs\fR
(arbitrary\-precision integer) as curve generator\&. If omitted,
\fIs\fR
is generated at random\&.
.RE
.PP
\fB\-A \fR\fB\fIa\fR\fR
.RS 4
[ECM] Use
\fIa\fR
(arbitrary\-precision integer) as curve parameter\&. If omitted, is it generated from the sigma value\&.
.RE
.PP
\fB\-go \fR\fB\fIval\fR\fR
.RS 4
[ECM, P\-1, P+1] Multiply the initial point by
\fIval\fR, which can any valid expression, possibly containing the special character N as place holder for the current input number\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
ecm \-pp1 \-go "N^2\-1" 1e6 < composite2000
.fi
.if n \{\
.RE
.\}
.sp
.RE
.SH "STEP 2 PARAMETERS"
.PP
\fB\-k \fR\fB\fIk\fR\fR
.RS 4
[ECM, P\-1, P+1] Perform
\fIk\fR
blocks in step 2\&. For a given
\fIB2\fR
value, increasing
\fIk\fR
decreases the memory usage of step 2, at the expense of more cpu time\&.
.RE
.PP
\fB\-treefile \fR\fB\fIfile\fR\fR
.RS 4
Stores some tables of data in disk files to reduce the amount of memory occupied in step 2, at the expense of disk I/O\&. Data will be written to files
\fIfile\fR\&.1,
\fIfile\fR\&.2 etc\&. Does not work with fast stage 2 for P+1 and P\-1\&.
.RE
.PP
\fB\-power \fR\fB\fIn\fR\fR
.RS 4
[ECM, P\-1] Use x^\fIn\fR
for Brent\-Suyama\'s extension (\fB\-power 1\fR
disables Brent\-Suyama\'s extension)\&. The default polynomial is chosen depending on the method and B2\&. For P\-1 and P+1, disables the fast stage 2\&. For P\-1,
\fIn\fR
must be even\&.
.RE
.PP
\fB\-dickson \fR\fB\fIn\fR\fR
.RS 4
[ECM, P\-1] Use degree\-\fIn\fR
Dickson\'s polynomial for Brent\-Suyama\'s extension\&. For P\-1 and P+1, disables the fast stage 2\&. Like for
\fB\-power\fR,
\fIn\fR
must be even for P\-1\&.
.RE
.PP
\fB\-maxmem \fR\fB\fIn\fR\fR
.RS 4
Use at most
\fIn\fR
megabytes of memory in stage 2\&.
.RE
.PP
\fB\-ntt\fR, \fB\-no\-ntt\fR
.RS 4
Enable or disable the Number\-Theoretic Transform code for polynomial arithmetic in stage 2\&. With NTT, dF is chosen to be a power of 2, and is limited by the number suitable primes that fit in a machine word (which is a limitation only on 32 bit systems)\&. The \-no\-ntt variant uses more memory, but is faster than NTT with large input numbers\&. By default, NTT is used for P\-1, P+1 and for ECM on numbers of size at most 30 machine words\&.
.RE
.SH "OUTPUT"
.PP
\fB\-q\fR
.RS 4
Quiet mode\&. Found factorizations are printed on standard output, with factors separated by white spaces, one line per input number (if no factor was found, the input number is simply copied)\&.
.RE
.PP
\fB\-v\fR
.RS 4
Verbose mode\&. More information is printed, more
\fB\-v\fR
options increase verbosity\&. With one
\fB\-v\fR, the kind of modular multiplication used, initial x0 value, step 2 parameters and progress, and expected curves and time to find factors of different sizes for ECM are printed\&. With
\fB\-v \-v\fR, the A value for ECM and residues at the end of step 1 and step 2 are printed\&. More
\fB\-v\fR
print internal data for debugging\&.
.RE
.PP
\fB\-timestamp\fR
.RS 4
Print a time stamp whenever a new ECM curve or P+1 or P\-1 run is processed\&.
.RE
.SH "MODULAR ARITHMETIC OPTIONS"
.PP
Several algorithms are available for modular multiplication\&. The program tries to find the best one for each input; one can force a given method with the following options\&.
.PP
\fB\-mpzmod\fR
.RS 4
Use GMP\'s mpz_mod function (sub\-quadratic for large inputs, but induces some overhead for small ones)\&.
.RE
.PP
\fB\-modmuln\fR
.RS 4
Use Montgomery\'s multiplication (quadratic version)\&. Usually best method for small input\&.
.RE
.PP
\fB\-redc\fR
.RS 4
Use Montgomery\'s multiplication (sub\-quadratic version)\&. Theoretically optimal for large input\&.
.RE
.PP
\fB\-nobase2\fR
.RS 4
Disable special base\-2 code (which is used when the input number is a large factor of 2^n+1 or 2^n\-1, see
\fB\-v\fR)\&.
.RE
.PP
\fB\-base2\fR \fIn\fR
.RS 4
Force use of special base\-2 code, input number must divide 2^\fIn\fR+1 if
\fIn\fR
> 0, or 2^|\fIn\fR|\-1 if
\fIn\fR
< 0\&.
.RE
.SH "FILE I/O"
.PP
The following options enable one to perform step 1 and step 2 separately, either on different machines, at different times, or using different software (in particular, George Woltman\'s Prime95/mprime program can produce step 1 output suitable for resuming with GMP\-ECM)\&. It can also be useful to split step 2 into several runs, using the
\fIB2min\-B2max\fR
option\&.
.PP
\fB\-inp \fR\fB\fIfile\fR\fR
.RS 4
Take input from file
\fIfile\fR
instead of from standard input\&.
.RE
.PP
\fB\-save \fR\fB\fIfile\fR\fR
.RS 4
Save result of step 1 in
\fIfile\fR\&. If
\fIfile\fR
exists, an error is raised\&. Example: to perform only step 1 with
\fIB1\fR=1000000 on the composite number in the file "c155" and save its result in file "foo", use
.sp
.if n \{\
.RS 4
.\}
.nf
ecm \-save foo 1e6 1 < c155
.fi
.if n \{\
.RE
.\}
.sp
.RE
.PP
\fB\-savea \fR\fB\fIfile\fR\fR
.RS 4
Like
\fB\-save\fR, but appends to existing files\&.
.RE
.PP
\fB\-resume \fR\fB\fIfile\fR\fR
.RS 4
Resume residues from
\fIfile\fR, reads from standard input if
\fIfile\fR
is "\-"\&. Example: to perform step 2 following the above step 1 computation, use
.sp
.if n \{\
.RS 4
.\}
.nf
ecm \-resume foo 1e6
.fi
.if n \{\
.RE
.\}
.sp
.RE
.PP
\fB\-chkpoint \fR\fB\fIfile\fR\fR
.RS 4
Periodically write the current residue in stage 1 to
\fIfile\fR\&. In case of a power failure, etc\&., the computation can be continued with the
\fB\-resume\fR
option\&.
.sp
.if n \{\
.RS 4
.\}
.nf
ecm \-chkpnt foo \-pm1 1e10 < largenumber\&.txt 
.fi
.if n \{\
.RE
.\}
.sp
.RE
.SH "LOOP MODE"
.PP
The
\(lqloop mode\(rq
(option
\fB\-c \fR\fB\fIn\fR\fR) enables one to run several curves on each input number\&. The following options control its behavior\&.
.PP
\fB\-c \fR\fB\fIn\fR\fR
.RS 4
Perform
\fIn\fR
runs on each input number (default is one)\&. This option is mainly useful for P+1 (for example with
\fIn\fR=3) or for ECM, where
\fIn\fR
could be set to the expected number of curves to find a d\-digit factor with a given step 1 bound\&. This option is incompatible with
\fB\-resume, \-sigma, \-x0\fR\&. Giving
\fB\-c 0\fR
produces an infinite loop until a factor is found\&.
.RE
.PP
\fB\-one\fR
.RS 4
In loop mode, stop when a factor is found; the default is to continue until the cofactor is prime or the specified number of runs are done\&.
.RE
.PP
\fB\-b\fR
.RS 4
Breadth\-first processing: in loop mode, run one curve for each input number, then a second curve for each one, and so on\&. This is the default mode with
\fB\-inp\fR\&.
.RE
.PP
\fB\-d\fR
.RS 4
Depth\-first processing: in loop mode, run
\fIn\fR
curves for the first number, then
\fIn\fR
curves for the second one and so on\&. This is the default mode with standard input\&.
.RE
.PP
\fB\-I \fR\fB\fIn\fR\fR
.RS 4
In loop mode, multiply
\fIB1\fR
by a factor depending on
\fIn\fR
after each curve\&. Default is one which should be optimal on one machine, while
\fB\-I 10\fR
could be used when trying to factor the same number simultaneously on 10 identical machines\&.
.RE
.SH "SHELL COMMAND EXECUTION"
.PP
These options allow for executing shell commands to supplement functionality to GMP\-ECM\&.
.PP
.RE
.SH "MISCELLANEOUS"
.PP
\fB\-stage1time \fR\fB\fIn\fR\fR
.RS 4
Add
\fIn\fR
seconds to stage 1 time\&. This is useful to get correct expected time with
\fI\-v\fR
if part of stage 1 was done in another run\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Display a short description of ecm usage, parameters and command line options\&.
.RE
.PP
\fB\-printconfig\fR
.RS 4
Prints configuration parameters used for the compilation and exits\&.
.RE
.SH "INPUT SYNTAX"
.PP
The input numbers can have several forms:
.PP
Raw decimal numbers like 123456789\&.
.PP
Comments can be placed in the file: everything after
\(lq//\(rq
is ignored, up to the end of line\&.
.PP
Line continuation\&. If a line ends with a backslash character
\(lq\e\(rq, it is considered to continue on the next line\&.
.PP
Common arithmetic expressions can be used\&. Example:
\fI3*5+2^10\fR\&.
.PP
Factorial: example
\fI53!\fR\&.
.PP
Multi\-factorial: example
\fI15!3\fR
means 15*12*9*6*3\&.
.PP
Primorial: example
\fI11#\fR
means 2*3*5*7*11\&.
.PP
Reduced primorial: example
\fI17#5\fR
means 5*7*11*13*17\&.
.PP
Functions: currently, the only available function is
\fIPhi(x,n)\fR\&.
.SH "EXIT STATUS"
.PP
The exit status reflects the result of the last ECM curve or P\-1/P+1 attempt the program performed\&. Individual bits signify particular events, specifically:
.PP
Bit 0
.RS 4
0 if normal program termination, 1 if error occurred
.RE
.PP
Bit 1
.RS 4
0 if no proper factor was found, 1 otherwise
.RE
.PP
Bit 2
.RS 4
0 if factor is composite, 1 if factor is a probable prime
.RE
.PP
Bit 3
.RS 4
0 if cofactor is composite, 1 if cofactor is a probable prime
.RE
.PP
Thus, the following exit status values may occur:
.PP
0
.RS 4
Normal program termination, no factor found
.RE
.PP
1
.RS 4
Error
.RE
.PP
2
.RS 4
Composite factor found, cofactor is composite
.RE
.PP
6
.RS 4
Probable prime factor found, cofactor is composite
.RE
.PP
8
.RS 4
Input number found
.RE
.PP
10
.RS 4
Composite factor found, cofactor is a probable prime
.RE
.PP
14
.RS 4
Probable prime factor found, cofactor is a probable prime
.RE
.SH "BUGS"
.PP
Report bugs to <ecm\-discuss@lists\&.gforge\&.inria\&.fr>, after checking <http://www\&.loria\&.fr/~zimmerma/records/ecmnet\&.html> for bug fixes or new versions\&.
.SH "AUTHORS"
.PP
Pierrick Gaudry <gaudry at lix dot polytechnique dot fr> contributed efficient assembly code for combined mul/redc;
.PP
Jim Fougeron <jfoug at cox dot net> contributed the expression parser and several command\-line options;
.PP
Laurent Fousse <laurent at komite dot net> contributed the middle product code, the autoconf/automake tools, and is the maintainer of the Debian package;
.PP
Alexander Kruppa <(lastname)al@loria\&.fr> contributed estimates for probability of success for ECM, the new P+1 and P\-1 stage 2 (with P\&.\-L\&. Montgomery), new AMD64 asm mulredc code, and some other things;
.PP
Dave Newman <david\&.(lastname)@jesus\&.ox\&.ac\&.uk> contributed the Kronecker\-Schoenhage and NTT multiplication code;
.PP
Jason S\&. Papadopoulos contributed a speedup of the NTT code
.PP
Paul Zimmermann <zimmerma at loria dot fr> is the author of the first version of the program and chief maintainer of GMP\-ECM\&.
.PP
Note: email addresses have been obscured, the required substitutions should be obvious\&.