Appendix D: Calculation Times

Team-Fly

CALCULATION TIMES FOR SEVERAL FLINT/C functions, calculated with a Pentium III processor running at 500 MHz and 64 Mbyte main memory, are given in Tables D.1 and D.2. The times for n operations were measured and then divided by n. Depending on the functions, n ranged between 100 and 5 million. An additional table shows, for comparison, calculation times that were measured for several functions in the GNU Multi Precision Arithmetic library (GMP, version 2.0.2); cf. page 420.

Table D.1: Calculation times for several C functions (without assembler support)
 

Binary digits of the arguments; time in seconds

 

128

256

512

768

1024

2048

add_l

3.8 × 107

5.5 × 107

8.8 × 107

1.2 × 106

1.5 × 106

2.2 × 106

mul_l

1.9 × 106

5.1 × 106

1.6 × 105

3.3 × 105

5.6 × 105

2.1 × 104

sqr_l

1.5 × 106

3.7 × 106

1.1 × 105

2.1 × 105

3.5 × 105

1.3 × 104

div_l[a]

2.6 × 106

5.8 × 106

7.6 × 105

2.7 × 105

5.1 × 105

7.8 × 104

mmul_l

7.5 × 106

2.1 × 105

6.6 × 105

1.4 × 104

2.3 × 104

8.9 × 104

msqr_l

7.3 × 106

1.9 × 105

6.1 × 105

1.2 × 104

2.1 × 104

8.1 × 104

mexpk_l

1.2 × 103

6.4 × 103

3.8 × 102

1.2 × 101

2.1 × 101

1.9

mexpkm_l

5.4 × 104

2.9 × 103

1.7 × 102

5.2 × 102

1.2 × 101

8.6 × 101

[a]For the function div_l the number of digits refers to the dividend, while the divisor has half that number of digits.

Table D.2: Calculation times for several C functions (with 80×86 assembler support)
 

Binary digits of the arguments; time in seconds

 

128

256

512

768

1024

2048

mul_l

4.3 × 106

6.9 × 106

1.5 × 105

2.9 × 105

4.7 × 105

1.6 × 104

sqr_l

2.5 × 106

4.6 × 106

1.0 × 105

1.8 × 105

2.9 × 105

9.5 × 105

div_l[a]

2.7 × 106

4.6 × 106

1.0 × 105

1.8 × 105

2.9 × 105

9.5 × 105

mmul_l

8.0 × 106

1.3 × 105

3.3 × 105

6.4 × 105

1.0 × 104

3.8 × 104

msqr_l

7.2 × 106

1.1 × 105

2.9 × 105

5.6 × 105

9.0 × 105

3.1 × 104

mexpk_l

1.3 × 103

4.3 × 103

1.9 × 102

5.3 × 102

1.1 × 101

8.7 × 101

mexpkm_l

7.6 × 104

3.3 × 103

1.7 × 102

4.9 × 102

1.1 × 101

7.8 × 101

[a]For the function div_l the number of digits refers to the dividend, while the divisor has half that number of digits.

One can see clearly the savings that squaring achieves over multiplication. Even the advantage realized by Montgomery exponentiation in mexpkm_l() can been seen, which requires less than half the time for the exponentiation with mexpk_l(). An RSA step with a 2048-bit key can thereby, with application of the Chinese remainder theorem (cf. page 199), be computed in one-fourth of a second.

Table D.2 demonstrates the difference in time that results from the use of assembler routines. Assembler support results in a speed advantage of about 70% for the modular functions. The gap between multiplication and squaring remains stable at about 50%.

Since the two functions mulmon_l() and sqrmon_l() do not exist as assembler routines, in this comparison the exponentiation function mexpk_l() can catch up significantly to the Montgomery exponentiation mexpm_l(). Both functions are roughly equally fast. There exists here an interesting potential for further improvement in the performance (cf. Chapter 18) by suitable assembler extensions.

In the comparison between the FLINT/C and GMP functions (see Table D.3) one may see that the GMP multiplication and division are faster by 30% and 40% than the corresponding FLINT/C functions. However, with the routine of modular exponentiation, the functions of both libraries amount more or less to the same thing, which turns out to be the same for arguments with 4096 digits as well. Since the GMP is considered the fastest of the available libraries for large-integer arithmetic, we need not be dissatisfied with this result.

Table D.3: Calculation times for several GMP functions (with 80×86 assembler support)
 

Binary digits of the arguments; time in seconds

 

128

256

512

768

1024

2048

mpz_add

2.4 × 107

3.2 × 107

3.6 × 107

4.2 × 107

4.5 × 107

6.9 × 107

mpz_mul

9.8 × 107

3.0 × 106

1.1 × 105

2.2 × 105

4.1 × 105

4.8 × 105

mpz_mod[a]

5.2 × 107

1.8 × 106

5.0 × 106

6.4 × 106

1.6 × 105

4.0 × 105

mpz_powm

4.5 × 104

2.6 × 103

1.7 × 102

5.2 × 102

1.7 × 101

7.8 × 101

[a]For the function mpz_mod the number of digits refers to the dividend, while the divisor has half that number of digits.


Team-Fly


Cryptography in C and C++
Cryptography in C and C++
ISBN: 189311595X
EAN: 2147483647
Year: 2001
Pages: 127

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net