13.11 MULTIPRECISION ARITHMETIC

The 43rd Mersenne prime contains 9,152,052 digits, not the kind of number we are used to writing out, much less manipulating. Although such numbers usually do not arise in day-to-day computations, some public-key cryptosystems require numbers with several hundred digits. Floating-point computations arising in navigational calculation also require great precision. The basic modular operations addition, multiplication, and division on numbers with a very large number of digits use a pencil and paper, a technique learned in elementary school.

Each n-digit base-b number is represented as a string of characters x:xn−1, xn−2x1x0 where xi is a base-b digit. Addition (multiplication and divison) is performed using digit-by-digit operations. For example, addition

TABLE 13.15 Multiprecision Parameters and Operations

image

image

is carried out in a single DO-loop.

Subtraction, multiplication, and division are implemented similarly. Division is the most tedious, producing a quotient and a remainder. The Montgomery reduction is used to make the computation of am (modulo N) more efficient.

Multiprecision modular arithmetic is needed in cryptography, for example, to implement RSA encipherment. Modular operations combine an addition/multiplication and division step. The parameters ...

Get Computer Security and Cryptography now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.