Claims
- 1. A method of modular reduction processing of a number which is represented by a sequence of digits, comprising:
receiving a number x, wherein number x is provided in radix b form and is represented by sequence of 2k digits such that {xi|i=0, 1, 2, . . . , 2k−1}; dividing x by bk+1 to produce q1; multiplying q1 by μ to produce q2, wherein μ is given in radix b form and is represented by sequence of k+1 digits such that μ=└b2k/m┘, wherein m is modulus given in radix b form and is represented by sequence of k digits such that {mi|i=0,1, 2, . . . , 2k−1} wherein mk−1≠0); dividing q2 by bk+1 to produce q3; multiplying q3 by m; reducing the product of q3 multiplied by m modulo bk+1 to produce r2; reducing x modulo bk+1 to produce r1; subtracting r2 from r1 to produce r; and determining which of the following is true:
r is non-negative and ra1 is negative, wherein ra1 is r−m; r is non-negative and ra1 is non-negative and ra2 is negative, wherein ra2 is r−2m; r is non-negative and ra2 is non-negative; r is negative and rpa1 is negative, wherein rpa1=r+bk+1−m; r is negative and rpa1 is non-negative and rpa2 is negative, wherein rpa2=r+bk+1−2m; and r is negative and rpa2 is non-negative, wherein if r is non-negative and ra1 is negative, x mod m=r, wherein if r is non-negative and ra1 is non-negative and ra2 is negative, x mod m=r−m, wherein if r is non-negative and ra2 is non-negative, x mod m=r−2m, wherein if r is negative and rpa1 is negative, x mod m=r+bk+1, wherein if r is negative and rpa1 is non-negative and rpa2 is negative, x mod m=r+bk+1−m, and wherein if r is negative and rpa2 is non-negative, x mod m=r+bk+1−2m.
- 2. The method according to claim 1, wherein x is received least significant digit first and in digits in increasing order of significance thereafter.
- 3. The method according to claim 1, wherein b is a power of 2.
- 4. The method according to claim 3, wherein dividing x by bk−1 comprise removing the k−1 least significant digits from x.
- 5. The method according to claim 1, wherein reducing the product of q3 multiplied by m modulo bk+1 to produce r2 comprises taking the k+1 least significant digits of q3m mod bk+1.
- 6. The method according to claim 1, wherein subtracting r2 from r1 to produce r comprises sequentially subtracting r2 from r1 to produce r.
- 7. A method of sequential multiplication for multiplying two numbers, each number having no more than kN bits, comprising:
a. receiving a first number a, wherein a is represented by a sequence of k digits such that {ai|i=0, 1, 2, . . . , k−1} and each as is a radix b digit having N bits; b. receiving a second number c, wherein c is represented by a sequence of k digits such that {ci|i=0, 1, 2, . . . , k−1} and each ci is a radix b digit having N bit; c. producing a sum y=Σi=02k−2y′ibi, wherein y′i=Σj=0iajci−j, such that y′i can be represented as a sequence of 2k−1 digits such that {y′i|i=0, 1, 2, . . . , 2k−2}, wherein y is the product of a and c and can be represented by a sequence of 2k digits such that {yi|i=0, 1, 2, . . . , 2k−1} and each y1 is a radix b digit having N bits.
- 8. The method according to claim 7, wherein producing the sum y comprises:
a. inputting a least significant digit of a into a first register of a shift register; b. inputting a least significant digit of c into first register of a register file and setting the remaining registers of the register file to zero; c. multiplying a value of each register of the shift register by a value of a corresponding register of the register file and adding the products to produce a first sum; d. selecting the least significant N bits of the first sum as the least significant N bits of a product of a and c; e. selecting the most significant N+└log2k┘=1 bits of the first sum and saving the most significant N+└log2k┘+1 bits of the first sum in a carry register; f. inputting the next least significant digit of a into the first register of the shift register and shifting the shift register values; g. inputting the next least significant digit of c into the next register of the register file; h. multiplying the value of each register of the shift register by the value of a corresponding register of the register file and adding the products to produce a next first sum; i. adding the first sum to the value of the carry register to produce a second sum; j. selecting the least significant N bits of the second sum as the next least significant N bits of a product of a and c; k. selecting the most significant N+└log2k┘=1 bits of the second sum and saving the most significant N+└log2k┘+1 bits of the second sum in the carry register; l. inputting the next least significant digit of a into the first register of the shift register and shifting the shift register values; m. inputting the next least significant digit of c into the next register of the register file; n. multiplying the value of each register of the shift register by the value of the corresponding register of the register file and adding the products to produce a next first sum; o. adding the next first sum to the value of the carry register to produce a next second sum; p. selecting the least significant N bits of the next second sum as the next least significant N bits of the product of a and c; q. selecting the most significant N+└log2k┘+1 bits of the next second sum and saving the most significant N+└log2k┘+1 bits of the next second sum in the carry register; r. repeating steps j through o k−3 times; s. inputting a zero into the first register of the shift register and shifting the shift register values; t. multiplying the value of each register of the shift register by the value of the corresponding register file and adding the products to produce a next first sum; u. adding the next first sum to the value of the carry register to produce a next second sum; v. selecting the least significant N bits of the next second sum as the next least significant N bits of the product of a and c; w. selecting the most significant N+└log2k┘+1 bits of the next second sum in the carry register; x. repeating steps s through w k−1 times; and y. selecting the value in the carry register as the most significant N bits of the product of a and c.
- 9. A method of modular reduction processing of a product of two numbers, comprising:
receiving a first number a, wherein a is provided in radix b form and is represented by a sequence of k digits such that {ai |i=0, 1, 2, . . . , k−1}; receiving a second number c, wherein c is provided in radix b form and is represented by a sequence of k digits such that {ci|i=0, 1, 2, . . . , k−1}; multiplying the first number and the second number to produce a product which is represented by a sequence of 2k digits; inputting the product into a modular reduction processor, wherein the modular reduction processor outputs one or more of the following:
r, r−m, r−2m, r+bk+1, r+bk+1−m, and r+bk+1−2m, wherein r=x mod bk+1−m[[μ(x/bk−1)]/bk+1] mod bk+1, into a means for determining which of the following is true:
r is non-negative and ra1 is negative, wherein ra1 is r−m; r is non-negative and ra1 is non-negative and ra2 is negative, wherein ra2 is r−2m; r is non-negative and ra2 is non-negative; r is negative and rpa1 is negative, wherein rpa1=r+bk+1−m; r is negative and rpa1 is non-negative and rpa2 is negative, wherein rpa2=r+bk+1−2m; and r is negative and rpa2 is non-negative, wherein if r is non-negative and ra1 is negative, x mod m=r, wherein if r is non-negative and ra1 is non-negative and ra2 is negative, x mod m=r−m, wherein if r is non-negative and ra2 is non-negative, x mod m=r−2m, wherein if r is negative and rpa1 is negative, x mod m=r+bk+1, wherein if r is negative and rpa1 is non-negative and rpa2 is negative, x mod m=r+bk+1−m, and wherein if r is negative and rpa2 is non-negative, x mod m=r+bk+1−2m.
CROSS-REFERENCE TO A RELATED APPLICATION
[0001] This application claims priority from provisional patent application U.S. Ser. No. 60/324,718; filed Sep. 24, 2001 and provisional patent application U.S. Ser. No. 60/274,893; filed Mar. 9, 2001.
Provisional Applications (2)
|
Number |
Date |
Country |
|
60324718 |
Sep 2001 |
US |
|
60274893 |
Mar 2001 |
US |