Abstract:
In the modular exponentiation calculation apparatus of the present invention, a computer calculates a modular exponentiation C=M  E  modN (M,N: integral number, E: exponent expressed in base m, C: calculation result expressed in base b). A table generation section calculates values of M j  • b i  modN (b,n,m: constant, j=1,2, . . . , m-1, i=0,1, . . . , n-1) and generates a table having (m-1)-columns and n-rows in which the calculation values are stored as corresponding elements. A first calculation section calculates a multiplication sum ##EQU1## (Ci: value of each digit of C, ej: non-zero value of j-th digit of E, M ej  • b i  modN: row elements of ej-column of the table) as updated C. A second calculation section calculates C m  modN for the updated C. A control section controls the first calculation section and the second calculation section to repeat the calculation for each non-zero value of each digit of E from MSB to LSB by unit of digit.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a modular exponentiation calculation apparatus and method for quickly calculating the modular exponentiation in the technical region of data transmission and data processing. 
     2. Description of the Related Art 
     In case of transmitting data, it is necessary to encipher the data. In this case, a modular exponentiation calculation is well known as a public key method as follows. 
     
         C=M.sup.E modN 
    
     In the above equation, M is a plain text to be enciphered, N and E are encryption keys, and C is an encryption result (M,E,N: integral number). &#34;mode N&#34; represents an operation to compute the remainder of the division operation, M E  /N. FIG. 1 is a block diagram of data transmission system including an encryption section (transmission side) and a decryption section (receiving side). When the plain text M is inputted, the encryption section enciphers M according to the encryption keys N,E and transmits the encryption result C to the decryption section. The decryption section deciphers the encryption result C according to decryption key N, D=f(E) and outputs the plain text (decryption result) M. In this case, a large number of bits of N is necessary in order to keep a secret of the plain text M. For example, in trade cipher, 512 bits or 1024 bits as length of N is used. As a result, calculation quantity of the modular exponentiation increases heavily and a method to fastly calculate the modular exponentiation is necessary. In case of calculating the modular exponentiation, the modular exponentiation calculation is expanded as a series of modular multiplications. In various kinds of expansion method, a base m calculation method as excellent expansion method is well known. FIG. 2 is a flow chart of processing of base m modular exponentiation calculation method according to the prior art. Assumed that modular exponent E is expanded in base m as follows. ##EQU2## 
     In the above equation, ej represents each digit of E so that (0≦e j  ≦m-1). After the plain text M and the encryption keys N,E are inputted (S21), M, M  2  modN, M 3  modN, . . . , M m-1  mod N are calculated and stored in memory A 1 , A 2 , A 3 , . . . , A m-1  respectively (S22). Parameter (j) is initialized as (1-1) and variable (c) is initialized as 1 (S23). Then, modular exponent E is scanned from MSB (most-significant-digit) to LSB (least-significant-digit) by unit of digit. The following calculation is repeated according to value of each digit ej (S24). 
     
         C←C×A.sub.ej modN (A.sub.ej : M e.sub.j modN) (S25) (1) 
    
     
         C←C.sup.m modN (S27)                                  (2) 
    
     In this place, when LSB (e o ) is scanned, the above calculation (2) is not executed (S26). 
     The above calculation (1) consists of multiplication and division. FIG. 3 is a block diagram of a calculation circuit for the above calculation (1). In the calculation circuit, calculation quantity of the multiplication is same as that of the division. Therefore, in order to execute the above calculation (1), two times of calculation quantity of the multiplication is necessary. 
     In this place, in repeat loop of the flow chart in FIG. 2, M and N are constants and do not change in the loop. Therefore, M, M 2  modN, M  3  modN, . . . , M m-1  modN are also constants. Therefore, the above calculation (1) is exponentiation which variable C is multiplied by constant and divided by N. This is called multiplication with a constant multiplier. Therefore, in comparison with prior method using multiplication and division, new calculation method to reduce the processing time has been considered. For example, in case of &#34;m=2&#34; or binary in the above calculation, the exponentiation is executed using the minimum amount of memory. As for binary, the multiplication with constant multiplication as calculation quantity of one time of multiplication is disclosed in reference (Shin-ichi Kawamura, Kyoko Takabayashi, and Atsushi Shimbo: &#34;A fast modular exponentiation algorism&#34;, IEICE Trans.. Vol. E74, No. 8, pp. 2136-2143, August 1991). In the above reference, in case of &#34;m=2&#34;, the multiplication with constant multiplier is executed by calculation quantity of one time of multiplication. However, in case of &#34;m&gt;2&#34;, it is not possible to quickly calculate the multiplication with constant multiplier. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a modular exponentiation calculation apparatus and method to quickly calculate the modular exponentiation for modular algorithm in base m (m&gt;2). 
     According to the present invention, there is provided a modular exponentiation calculation apparatus for calculating a modular exponentiation C=M E  modN (M,N: integral number, E: exponent in base m, C: base b), comprising: table generation means for calculating value of M j  • b i  modN (b,n,m: constant, j=1,2 . . . , m-1, i=0,1, . . . , n-1), and for generating a table of (m-1)-column and n-row in which the calculation values are stored as corresponding elements; first calculation means for calculating a multiplication sum: ##EQU3## as updated c wherein Ci is the value of each digit of c, ej is a non-zero value of j-th digit of E, M ej  • b i  modN are row elements of ej-column of the table; second calculation means for calculating C m  modN for the updated C calculated by said first calculation means; and control means for controlling said first calculation means and second calculation means to repeat the calculation for non-zero value of each digit of E from MSB to LSB by unit of digit. 
     Further in accordance with the present invention, there is provided a method for calculating a modular exponentiation C=M E  modN (M,N: integral number, E: exponent in base m, C: base b), comprising the steps of: calculating value of M j  • b i  modN (b,n,m: constant, j=1,2 . . . , m-1, i=0,1, . . . , n-1), generating a table in a machine readable memory having (m-1)-column and n-row in which the calculation values are stored as corresponding element; first-calculating a multiplication sum ##EQU4## as updated C wherein Ci is a value of each digit of C, ej is a non-zero value of j-th digit of E, M  ej  • b i  modN are row elements of ej-colunm of the table; second-calculating C  m  modN for the updated C calculated at the first-calculating step; and repeating the first-calculating step and the second-calculating step for non-zero value of each digit of E from MSB to LSB by unit of digit. 
     Further in accordance with the present invention, there is provided a computer readable memory containing computer-readable instructons to calculate a modular exponentiation C=M E  modN (M,N: integral number, E: exponent of m-ary, C: b-ary), comprising: instruction means for causing a computer to calculate value of M j  • b i  modN (b,n,m: constant, j=1,2 . . . , m-1, i=0,1, . . . , n-1); instruction means for causing a computer to generate a table of (m-1)-column and n-row in which the calculation values are stored as corresponding element; instruction means, for causing a computer to calculate a multiplication sum ##EQU5## as updated C wherein Ci is a value of each digit of C, ej is a non-zero value of j-th digit of E, M ej  • b i  modN are row elements of ej-colmun of the table) as updated C; instruction means for causing a computer to calculate C m  modN for the updated C; and instruction means for causing a computer to repeat the calcution of the multiplication sum and C m  modN for non-zero value of each digit of E from MBS to LSB by unit of digit. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a schematic diagram of an encryption-decription system including a modular exponentiation calculation apparatus. 
     FIG. 2 is a flow chart of processing of the modular exponentiation calculation method according to the prior art. 
     FIG. 3 is a schematic diagram of a part of the modular exponentiation calculation apparatus according to the prior art. 
     FIG. 4 is a block diagram of the modular exponentiation calculation apparatus according to the present invention. 
     FIG. 5 is a flow chart of processing of the modular exponentiation calculation method according to the present invention. 
     FIG. 6 is a flow chart of processing of generating a reference table according to the present invention. 
     FIG. 7 is a block diagram of a table generation section corresponding to a first half processing of generating the reference table according to the present invention. 
     FIG. 8 is a block diagram of the table generation section corresponding to a second half processing of generating the reference table according to the present invention. 
     FIG. 9 is a schematic diagram of the reference table in case of retrieving element of (ej) th-column according to the present invention. 
     FIG. 10 is a block diagram of (C×A ej  modN) calculation section of the modular exponentiation calculation apparatus according to the present invention. 
     FIG. 11 is a schematic diagram of relative processing time of the modular exponentiation calculation method according to the prior art and the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     The embodiments of the present invention are described below with reference to the drawings. 
     The present invention may be embodied in a modular exponentiation calculation apparatus used in, for example, data transmission or data transfer. Exponentiation calculations are useful in encryption devices such as coders or decoders. A disital data processor and machine readable memories may be included in the modular exponentiation calculation apparatus. 
     FIG. 4 is a block diagram of the modular exponentiation calculation apparatus according to the present invention. FIG. 5 is a flow chart of processing of the modular exponentiation calculation method according to the present invention. First, the plain text M, and the encryption keys N, E are inputted through an input section 1 and stored in a memory (M) 2a, a memory (N) 2b and a memory (E) 2c respectively (S51). A table generation section 3 generates a reference table 4 of (m-1) column×n row according to M,N (S52). As shown in the reference table of FIG. 4, entry (element) of 1st-column from 1st row to (n-1)th row is M, M • b modN, M • b 2  modN, . . . , M • B  n-1  modN. &#34;b&#34; is a unit of processing (processing block) of the multiplication with constant multiplier and normally set as power of 2 in a binary computer. In case of &#34;N=1 bit&#34;, 1=nlog 2  (b). The entry of 2nd-column is M 2  • modN, M 2  •bmodN, . . . , M 2  • b n-1  modN. The entry of 2nd-column is M times as much as the entry of 1st-column. The entry of 3rd-column is M 2  times as much as the entry of 1st column. The entry of (m-1) th-column is M m-1  times as much as the entry of 1st column. In the above-mentioned reference, the table reference method uses only the 1st-column of the reference table 4 in FIG. 4. However, in the present invention, each element of 1st-column is expanded along side direction in order to normalize as elements of (m-1) th column (m&gt;2). By referring to the table, the modular exponentiation calculation (S55 in FIG. 5) is quickly executed. 
     FIG. 6 is a flow chart of processing of generating the reference table 4 according to the present invention. In this processing, each element of the 1st-column of the reference table 4 is firstly calculated. Each element of the 2nd-column (3rd-column and so on) is calculated using the elements of the 1st-column to effectively generate the reference table. First, the elements (M, M • b modN, M • b 2  modN, . . . , M • b n-1  modN) of the 1st-column are calculated using M, N (S61). Second, an element &#34;M 2  modN&#34; of the 2nd-column and the 1st-row is calculated using the elements of the 1st-column (S62). 
     FIG. 7 is a block diagram of calculation circuit to execute S62. As shown in FIG. 7, each element of the 1st-column is stored in register 71 and each digit (n-digits) of M is stored in register 72. Each multiplication Q  0 , . . . , Q n-1  multiplies each digit of M with the corresponding element of the 1st-column (one multiplication may orderly multiply the each digit of M with the corresponding element of the 1st-column). The multiplication results from the multiplication Q  0 , . . . , Q n-1  are sumed by an adder section 73. In this way, the element &#34;M  2  modN&#34; of the 2nd-column and 1st-row is calculated. Next, the elements (M  2  • bmodN, M 2  • b 2  modN, . . . , M 2 . b m-1  modN) of 2nd-column except for &#34;M 2  modN&#34; are calculated using M 2  modN and N (S63). FIG. 8 is a block diagram of calculation circuit to execute S63. As shown in FIG. 8, &#34;M  2  modN&#34; is stored in a register 81. 
     In case of &#34;b=2 B  &#34;, B bits of &#34;0&#34; are added to &#34;M 2  modN&#34; as LSB in a register 82. The value of the register 82 represents &#34;(M 2  modN)b&#34;. Then, &#34;(M 2  modN)b&#34; of the register 82 is divided by &#34;N&#34; of a register 83. The division result &#34;M 2  • b modN&#34; of a register 84 is an element of 2nd-column and 2nd-row. In the same way, B bits of &#34;0&#34; are added to &#34;M 2  • b modN&#34; as &#34;(M 2  • b modN)b&#34; of a register 85. &#34;(M  2  bmodN)b&#34; of the register 85 is divided by &#34;N&#34; of a register 86. The division result &#34;M 2  • b 2  b modN&#34; of a register 87 is an element of 2nd-column and 3rd-row. In this way, the division calculation is repeated till &#34;M 2  • b n-1  modN&#34; as an element of 2nd-column and (n-1) row is calculated. Next, an element &#34;M 3  modN&#34; of 3rd-column and 1st-row is calculated using &#34;M modN&#34; and the elements of 1st-column (S64). This calculation is executed by, the circuit of FIG. 7. Next, the elements of 3rd-column except for &#34;M  3  modN&#34; are calculated using &#34;M 3  modN&#34; and N (S65). This calculation is executed by the circuit of FIG. 8. The above calculation using circuit of FIG. 7 and FIG. 8 is repeated untill the elements of (m-1)th column are calculated using &#34;M  m-1  modN&#34; and N (S66). 
     As the above-mentioned, an element of i-th column and 1st-row is calculated using the element of (i-1)th column and 1st-row, and the elements of 1st-column. The other elements of i-th column are calculated using the elements of i-th column and 1st-row. This calculation is repeated to generate all elements of the reference table 4. 
     In return to FIG. 5, after generating the reference table 4, parameter (j) is intialized as (l-1) and variable C is initialized as &#34;1&#34; (S53). In this place, modular exponent E is expanded in base m. Therefore, each digit ej (corresponding to 1 ˜m-1) is decided to be &#34;0&#34; or not from the digit of MSB (S54). In case that the digit is &#34;0&#34;, processing of S55 is skipped. In case that the digit is not &#34;0&#34;, processing of S55 is executed. In this case, (C×A ej  modN) calculation section 5 calculates &#34;C× ej  modN&#34; using the reference table 4 (S55). Then, (C m  modN) calculation section 7 calculates C m  modN (S57). The calculations of (C×A ej  modN) calculation section 5 and (C m  modN) calculation section 7 are executed alternatively. The calculation result C by (C×A ej  modN) calculation section 5 and (C  m  modN) calculation section 7 is alternatively stored in a memory (C) 6. In this way, the modular exponentiation calculation is effectively executed. 
     In this place, the processing of multiplication with constant multiplier (S55) is explained in detail referring to FIG. 9 and FIG. 10. FIG. 9 is a schematic diagram of the reference table in case of retrieving elements of (ej)th-column. FIG. 10 is a block diagram of (C×A ej  modN) calculation section 5 in FIG. 4. As mentioned above, the modular exponent E is expanded in base m as follows. ##EQU6## 
     As shown in FIG. 9, the reference table 4 stores the elements of each column by unit of address (ej). In short, a number of the columns is m-1. Therefore, in processing of S55 in FIG. 5, in case that value of ej is not &#34;0&#34;, the elements of (ej)th-column are retrieved according to address (ej). The retrieved elements of (ej)-th column are supplied to the (C×A ej  modN) calculation section 5. In the elements of (ej)th-column, variable C is expanded with base b as follows. ##EQU7## 
     As shown in FIG. 10, when the variable C is inputted to the (C×A ej  modN) calculation section 5, each digit (Co, . . . Cn-1) of the variable C is stored in a register 91. On the other hand, the retrieved elements of (ej)th-column are stored in n numbers of registers 92. Then, each digit Ci of the variable C is multiplied with corresponding element &#34;M ej  • b i  modN&#34; of (ej)th-column. Then n numbers of the multiplication for Ci (0≦i≦m-1) are added to update c as follows. ##EQU8## 
     In FIG. 10, the multiplier Q 0 , Q 1 , . . . , Q n-1  respectively multiplies each digit Ci with corresponding element M ej  • b i  modN. The multiplication result from the multiplier Q 0 , Q 1 , . . . , Q n-1  are summed by the adder section 93. C&#39; calculation section 94 outputs the sum C&#39; of the multiplication result. The sum C&#39; equals the final result C based on (modN). However, in comparison with the final result C, the sum C&#39; includes an error of a multiple of N. Therefore, a correction section 95 subtracts the multiple of N from the sum C&#39;• C calculation section 96 outputs the final result C (C&gt;N). 
     As shown in FIG. 10, most part of processing time of S55 is multiplication of each digit (Ci) 91 and corresponding element (M ej  • b i  modN) 92. This processing time is equal to a multiplication of two multiprecision integral number, In short, the processing is executed at one cycle. However, in the prior art, a multiplication of (C) and (M ej  modN) is firstly calculated and the multiplication result is secondly divided by N. In short, the processing is executed at two cycles. Therefore, the processing time of the prior art is two times of the processing time of the present invention. FIG. 11 shows a relative processing time of calculation method of the prior art and the table method. In the table method, the case of &#34;m=16&#34; corresponds to processing of the present invention. In the example of FIG. 11, assumed that modulus N is a 512-bit number, and b=2  16  &#34;. As shown in FIG. 11, the processing time &#34;76&#34; of the present invention is short in comparison with the prior art. 
     In return to the flow chart of FIG. 5, after the multiplication with constant multiplier (S55) is calculated, the parameter (j) is decided to be &#34;0&#34; or not (S56). If the parameter (j) is not &#34;0&#34;, the (C m  modN) calculation section 7 calculates &#34;C  m  modN&#34; for the present variable C (S57). If the parameter (j) is &#34;0&#34;, processing of all digit (ej) of E is finished. Therefore, the variable C as final result is outputted (S59) and all processing finishes. 
     A memory can be used to store instructions for performing the process described above, such a memory can be a CD-ROM, floppy disk, hard disk, magnetic tape, semiconductor memory, and so on. 
     Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the invention being indicated by the following claims.