JP3277220B2 - Operation method of remainder multiplication device - Google Patents
Operation method of remainder multiplication deviceInfo
- Publication number
- JP3277220B2 JP3277220B2 JP05033692A JP5033692A JP3277220B2 JP 3277220 B2 JP3277220 B2 JP 3277220B2 JP 05033692 A JP05033692 A JP 05033692A JP 5033692 A JP5033692 A JP 5033692A JP 3277220 B2 JP3277220 B2 JP 3277220B2
- Authority
- JP
- Japan
- Prior art keywords
- upper digit
- subtracted
- value
- quotient
- divisor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Lifetime
Links
Description
【0001】[0001]
【産業上の利用分野】本発明は、少ないメモリを用いて
処理することが可能な剰余乗算装置の演算方法に関す
る。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a calculation method of a remainder multiplication device which can perform processing using a small amount of memory.
【0002】[0002]
【従来の技術】汎用計算機や、汎用マイクロプロセッサ
を用いるシステムにおいて、正の整数としてA,B,N
が与えられた場合、AとBはNよりも小さく、かつA×
BmodNなるAとBの積をNを法に求める場合を考え
てみる。A,B,Nは対応するメモリに書き込まれ、途
中の経過Cも対応するメモリに書き込まれる。そして、
A,B,N,Cはそれぞれ対応してAi,Bi,Ni,
Cj(0≦i≦n−1,0≦j≦m−1)で示されるn
またはm個のブロックに分けられて、次のように表現さ
れる。2. Description of the Related Art In a general-purpose computer or a system using a general-purpose microprocessor, A, B, N
Given, A and B are smaller than N, and A ×
Consider the case where the product of A and B, which is BmodN, is obtained modulo N. A, B, and N are written to the corresponding memories, and the intermediate progress C is also written to the corresponding memories. And
A, B, N, and C correspond to Ai, Bi, Ni,
N represented by Cj (0 ≦ i ≦ n−1, 0 ≦ j ≦ m−1)
Alternatively, it is divided into m blocks and expressed as follows.
【数1】 次に、rを基数とし、各Ai,Bi,Ni,Cjは0よ
りr−1までの整数で表現されるものとする。このと
き、次の積Cを算出する。(Equation 1) Next, it is assumed that each of Ai, Bi, Ni, and Cj is represented by an integer from 0 to r-1 using r as a radix. At this time, the next product C is calculated.
【数2】 次に、割算を実行して、C<Nなる剰余乗算の結果を得
る。(Equation 2) Next, division is performed to obtain a result of the remainder multiplication in which C <N.
【数3】 なお、ここで、「x」はxを越えない最大の整数を示す
記号である。(Equation 3) Here, “x” is a symbol indicating the largest integer not exceeding x.
【0003】[0003]
【発明が解決しようとする課題】前述のように、A×B
modNなるAとBの積を法Nに対して求める場合、演
算途中のCも、メモリのm個のブロックにそれぞれ書き
込まれる。このような場合、Cのメモリ領域としては、
mブロックで最大2nブロックが必要であるため、IC
カ−ド等を用いたシステムでは、メモリ領域が限定され
ているので、利用困難となる。本発明の目的は、このよ
うな従来の課題を解決し、メモリ領域を限定しても演算
を実行することが可能な剰余乗算装置の演算方法を提供
することにある。As described above, A × B
When the product of A and B, modN, is obtained with respect to the modulus N, C in the middle of the calculation is also written into m blocks of the memory. In such a case, as the memory area of C,
Since up to 2n blocks are required for m blocks, IC
In a system using a card or the like, it is difficult to use the system because the memory area is limited. An object of the present invention is to solve such a conventional problem and to provide a calculation method of a remainder multiplication device capable of executing a calculation even when a memory area is limited.
【0004】[0004]
【課題を解決するための手段】上記目的を達成するた
め、本発明による剰余乗算装置の演算方法は、入力変数
A,B,Nおよび作業変数C,iに対応するレジスタと
してのメモリ領域と、メモリへのデ−タ書き込み読み出
し処理およびメモリ間の加減乗除算ならびに比較を行う
演算回路とを用い、入力変数AとBがNよりも小さく、
A×BmodNなるAとBの積をNを法に求める場合
に、A,B,Nを対応するメモリに書き込み、途中経過
C,iも対応するメモリに書き込み、A,B,N,Cが
それぞれに対応してAi,Bi,Ni,Cj(0≦i≦
n−1,0≦j≦m−1)で示されるnないしm個のブ
ロックに分けられて、In order to achieve the above object, a method of calculating a remainder multiplication device according to the present invention comprises a memory area as a register corresponding to input variables A, B, N and work variables C, i; An arithmetic circuit for performing data write / read processing to the memory and addition / subtraction multiplication / division between the memories and comparison, and the input variables A and B are smaller than N;
When the product of A and B, which is A × BmodN, is obtained modulo N, A, B, and N are written in the corresponding memories, and the progresses C and i are also written in the corresponding memories. Ai, Bi, Ni, Cj (0 ≦ i ≦
n−1, 0 ≦ j ≦ m−1), divided into n to m blocks,
【数1】 と表現され、rを基数として各Ai,Bi,Ni,Cj
は0よりr−1までの整数で表現され、r/2≦Nn-1
とし、mをn+2とするとき、上記演算回路と対応する
メモリ領域間で以下の順序で処理を行うことを特徴とし
ている。すなわち、(1)Cを0に初期化し、iにn−
1を蓄積し、(2)Cをr倍し、これにA×Biを加算
した値でCを更新し、(3)Cの上位桁r×Cn+1+Cn
を、Nの上位桁Nn-1に1を加算した除数で除した商Q
を求め、r×Q×NをCから減じ、(4)Cの上位桁r
×Cn+1+Cnを、Nの上位桁Nn-1に1を加算した除数
で除した商Qを求め、r×Q×NをCから減じ、(5)
Cの上位桁r×Cn+Cn-1がNの上位桁Nn-1に1を加
算した除数にr−1を掛けた値、つまり(r−1)(N
n-1+1)の値以上の時には、Cから(r−1)×Nを
減じ、(6)iから1を減じ、(7)iが正または0の
時、上記(2)に戻り、(8)C<Nの時、下記(12)
に進み、(9)Cの上位桁r×Cn+Cn-1をNの上位桁
Nn-1に1を加算した除数で除した商Qにより、Cから
Q×Nを減じ、(10) C<Nの時、下記(12)に進み、
(11)CからNを減じて、上記(10)に戻り、(12)C
をA×BmodNなる剰余乗算の結果とする。(Equation 1) And each of Ai, Bi, Ni, and Cj is represented by r as a radix.
Is represented by an integer from 0 to r−1, and r / 2 ≦ N n−1
When m is n + 2, processing is performed in the following order between the arithmetic circuit and the corresponding memory area. That is, (1) C is initialized to 0 and i is n-
1 is stored, (2) C is multiplied by r, and C is updated with a value obtained by adding A × Bi to this value. (3) Upper digit r × C n + 1 + Cn of C
Is divided by a divisor obtained by adding 1 to the upper digit N n-1 of N.
And r × Q × N is subtracted from C, and (4) the upper digit r of C
A quotient Q is obtained by dividing × C n + 1 + Cn by a divisor obtained by adding 1 to the upper digit N n−1 of N, and subtracting r × Q × N from C, (5)
Significant digit r × Cn + C n-1 is higher digit N n-1 to a value to the divisor obtained by adding multiplied by r-1 one of N and C, i.e. (r-1) (N
When the value is equal to or larger than ( n-1 +1), (r-1) * N is subtracted from C, (1) is subtracted from (6) i, and when (7) i is positive or 0, the process returns to (2) above. (8) When C <N, the following (12)
And (9) subtracting Q × N from C by the quotient Q obtained by dividing the upper digit r × Cn + C n−1 of C by the divisor obtained by adding 1 to the upper digit N n−1 of N, and (10) C If <N, proceed to (12) below,
(11) N is subtracted from C, and the process returns to (10).
Is the result of the remainder multiplication of A × BmodN.
【0005】[0005]
【作用】本発明においては、i=n−1から開始して、
次式を実行することとする。 C←r×C+A×Bi ・・・・・・・・・・・・・・・・・・・(4) すなわち、A×Bの乗算結果とr×Cの乗算結果とを加
算したものを、途中結果としてCの領域に蓄積する。次
に、下式を計算する。 C←C−Q×N ・・・・・・・・・・・・・・・・・・・・・・(5) すなわち、商Qと法Nの積をCから減算した剰余を、C
の領域に蓄積する。この計算によりCの所要メモリ領域
を減少させる。そして、iを1つずつ減らしていき、i
=n−2,n−3,・・・2,1の順序で上式(4)と
(5)を繰り返し実行する。このとき、次式(6)の割
算を行う。In the present invention, starting from i = n-1,
The following equation is executed. C ← r × C + A × Bi (4) That is, the sum of the multiplication result of A × B and the multiplication result of r × C is Are stored in the area C as an intermediate result. Next, the following equation is calculated. C ← C−Q × N (5) That is, the remainder obtained by subtracting the product of the quotient Q and the modulus N from C is represented by C
Accumulates in the area. This calculation reduces the required memory area of C. Then, reduce i one by one, i
= N−2, n−3,..., 2, 1 are repeatedly executed in the above equations (4) and (5). At this time, the following equation (6) is divided.
【数4】 上式(6)の商Qを用いることが本発明の最も重要な特
徴である。上式(4)、(5)で示される加算、減算、
乗算により、A×Bの上位の部分積から順番に処理する
ことができるので、Cのブロック数mはn程度で済む。
また、上式(6)の商Qを用いるため、次式(7)の関
係が成立し、上式(5)で処理されるCは、上位桁どう
しの近似計算を行っているにもかかわらず、常に正であ
ることが保証される。このため、Cが負の値を扱う処理
は不要になるとともに、「C/N」を直接扱う場合に比
べて処理が簡単となる。(Equation 4) The use of the quotient Q in the above equation (6) is the most important feature of the present invention. Addition, subtraction, expressed by the above equations (4) and (5),
By multiplication, processing can be performed in order from the upper partial product of A × B, so that the number m of blocks of C can be reduced to about n.
Further, since the quotient Q of the above equation (6) is used, the relationship of the following equation (7) is established, and C processed in the above equation (5) does not have to be calculated even though the upper digits are approximated. And is always guaranteed to be positive. For this reason, the process for handling a negative value of C is not required, and the process is simpler than in the case where C / N is directly handled.
【数5】 (Equation 5)
【0006】[0006]
【実施例】以下、本発明の実施例を、図面により詳細に
説明する。図2は、本発明が適用される剰余乗算装置の
ブロック図である。図2において、11は演算回路、1
0はメモリ領域である。メモリ領域10には、A,B,
C,N,iを蓄積する領域として、C0〜Cn+1、N0〜
Nn-1、A0〜An-1、B0〜Bn-1、iの各領域がある。
なお、演算回路11の他に、一連の処理をするための制
御回路があるが、これは記載を省略する。図1は、本発
明の一実施例を示す剰余乗算装置の処理フロ−チャ−ト
である。図1では、基数をrとして説明するが、例え
ば、8ビットが1ブロックの場合、r=256=2の8
乗の場合に相当する。 (イ)予め、A,B,Nが与えられる(ステップ10
1)。 (ロ)次に、Cの各ブロック領域に0を、iの領域にn
−1を蓄積する(ステップ102)。上位から順序に演
算を実行する。 (ハ)Cをr倍し、これにA×Biを加算した値でCを
更新する。 (ニ)Cの上位桁Cn+1‖CnをNの上位桁Nn-1に1を
加算した除数で除した商Qにより、r×Q×NをCから
減じる。なお、Cn+1‖Cn=rCn+1+Cnである。
(ホ)Cの上位桁Cn+1‖CnをNの上位桁Nn-1に1を
加算した除数で除した商Qにより、r×Q×NをCから
減じる(ステップ103)。Embodiments of the present invention will be described below in detail with reference to the drawings. FIG. 2 is a block diagram of a modular multiplication device to which the present invention is applied. 2, reference numeral 11 denotes an arithmetic circuit, 1
0 is a memory area. A, B,
C 0 -C n + 1 , N 0-
There are areas of N n−1 , A 0 to A n−1 , B 0 to B n−1 and i.
In addition to the arithmetic circuit 11, there is a control circuit for performing a series of processes, but the description is omitted. FIG. 1 is a processing flowchart of a modular multiplication apparatus according to an embodiment of the present invention. Although FIG. 1 illustrates the radix as r, for example, when 8 bits are one block, r = 256 = 2 = 8
It corresponds to the case of the power. (A) A, B, and N are given in advance (Step 10)
1). (B) Next, 0 is set in each block area of C, and n is set in the area of i.
-1 is accumulated (step 102). Perform operations in order from the top. (C) C is multiplied by r, and C is updated with a value obtained by adding A × Bi to C. (D) r × Q × N is subtracted from C by a quotient Q obtained by dividing the upper digit C n + 1 ‖Cn of C by a divisor obtained by adding 1 to the upper digit N n−1 of N. Incidentally, it is C n + 1 ‖Cn = rC n + 1 + Cn.
(E) r × Q × N is subtracted from C by a quotient Q obtained by dividing the upper digit C n + 1 ‖Cn of C by a divisor obtained by adding 1 to the upper digit N n−1 of N (step 103).
【0007】(ヘ)Cの上位桁Cn‖Cn-1がNの上位桁
Nn-1に1を加算した除数にr−1を掛けた値、つまり
(r−1)(Nn-1+1)の値以上のときには、Cから
(r−1)×Nを減じる(ステップ104,105)。
なお、Cn‖Cn-1=r×Cn+Cn-1である。 (ト)iから1を減じる(ステップ106)。すなわ
ち、次位の桁の演算に移る。(チ)iが正または0の時
には、ステップ103に戻り(ステップ107)、Cを
r倍し、これにA×Biを加算した値でCを更新する。 (リ)C<Nの時、つまり法であるNよりCの値が小さ
いときには(ステップ108)、Cの値を剰余乗算の結
果として出力する(ステップ112)。 (ヌ)逆にC≧Nであれば、Cの上位桁Cn‖Cn-1をN
の上位桁Nn-1に1を加算した除数で除した商Qによ
り、CからQ×Nを減算する(ステップ109)。 (ル)C<Nの時には(ステップ110)、Cの値を剰
余乗算の結果として出力する(ステップ112)。 (ワ)また、C≧Nであれば、CからNを減じて(ステ
ップ111)、ステップ110に戻り再びC<Nである
か否かを判定する。 (カ)C<Nであれば、CをA×BmodNの剰余乗算
の結果として出力し、終了する(ステップ112)。以
上で、一連の剰余乗算処理を完了する。[0007] (f) The upper digit Cn‖C value n-1 is multiplied by the high-order digit N n-1 to r-1 to the divisor obtained by adding 1 N and C, i.e. (r-1) (N n- If it is equal to or greater than 1 + 1), (r-1) * N is subtracted from C (steps 104 and 105).
It should be noted that Cn - 1Cn -1 = r.times.Cn + Cn -1 . (G) 1 is subtracted from i (step 106). That is, the operation proceeds to the calculation of the next digit. (H) When i is positive or 0, the process returns to step 103 (step 107), where C is multiplied by r, and C is updated with a value obtained by adding A × Bi to this. (I) When C <N, that is, when the value of C is smaller than the modulus N (step 108), the value of C is output as the result of the remainder multiplication (step 112). (Nu) Conversely, if C ≧ N, the upper digit Cn‖C n−1 of C is set to N
Then, Q × N is subtracted from C by a quotient Q obtained by dividing the upper digit N n−1 by 1 with a divisor (step 109). (L) When C <N (step 110), the value of C is output as the result of the remainder multiplication (step 112). (C) If C ≧ N, N is subtracted from C (step 111), and the process returns to step 110 to determine whether C <N again. (F) If C <N, C is output as the result of the modular multiplication of A × BmodN, and the processing is terminated (step 112). Thus, a series of remainder multiplication processes is completed.
【0008】以下、本発明の具体例を説明する。624
×623mod625の例を述べる。基数r=10(1
0進法)を例にとる。なお、デ−タ構造は、 C=C4‖C3‖C2‖C1‖C0 N= N2‖N1‖N0=6‖2‖5 A= A2‖A1‖A0=6‖2‖4 B= B2‖B1‖B0=6‖2‖3 10進法のために誤解の心配がないので、以下は区切り
符号‖の記載を省略する。前述の実施例の(イ)〜
(カ)の手順に従って、剰余乗算を実行する。 (イ)予め、A,B,Nが与えられる(上記の通り)。 (ロ)次に、Cの各ブロック領域に0を、iの領域にn
−1を蓄積する。C=00000,i=2、 上位か
ら順序に演算を実行する。 (ハ)Cをr倍し、これにA×Biを加算した値でCを
更新する。 C=00000+624×6=03744 (ニ)Cの上位桁Cn+1‖CnをNの上位桁Nn-1に1を
加算した除数で除した商Qにより、r×Q×NをCから
減じる。なお、Cn+1‖Cn=rCn+1+Cnである。Q=
「03/7」=0であるため、Cはそのまま。 (ホ)Cの上位桁Cn+1‖CnをNの上位桁Nn-1に1を
加算した除数で除した商Qにより、r×Q×NをCから
減じる。これにより、除算した結果の剰余が求められ
る。Q=「03/7」=0であるため、Cはそのまま。 (ヘ)Cの上位桁Cn‖Cn-1がNの上位桁Nn-1に1を
加算した除数にr−1を掛けた値、つまり(r−1)
(Nn-1+1)の値以上のときには、Cから(r−1)
×Nを減じる。なお、Cn‖Cn-1=r×Cn+Cn-1であ
る。37<9×7より、Cはそのまま。 (ト)iから1を減じる。すなわち、次位の桁の演算に
移る。 i=2−1=1 (チ)iが正または0の時には、上記(ハ)に戻る。Hereinafter, specific examples of the present invention will be described. 624
An example of × 623 mod 625 will be described. Radix r = 10 (1
0) is taken as an example. Incidentally, De - data structures, C = C 4 ‖C 3 ‖C 2 ‖C 1 ‖C 0 N = N 2 ‖N 1 ‖N 0 = 6‖2‖5 A = A 2 ‖A 1 ‖A 0 = 6‖2‖4 B = B 2 ‖B 1 ‖B 0 = 6‖2‖3 Since there is no fear of misunderstanding because of the decimal system, the description of the delimiter ‖ is omitted below. (A)-of the above embodiment
The remainder multiplication is performed according to the procedure (f). (A) A, B, and N are given in advance (as described above). (B) Next, 0 is set in each block area of C, and n is set in the area of i.
Store -1. C = 00000, i = 2, Perform the operation in order from the top. (C) C is multiplied by r, and C is updated with a value obtained by adding A × Bi to C. C = 00000 + 624 × 6 = 03744 (d) r × Q × N is converted from C by a quotient Q obtained by dividing the upper digit C n + 1 of C by the divisor obtained by adding 1 to the upper digit N n−1 of N. Reduce. Incidentally, it is C n + 1 ‖Cn = rC n + 1 + Cn. Q =
Since “03/7” = 0, C remains unchanged. (E) r × Q × N is subtracted from C by a quotient Q obtained by dividing the upper digit C n + 1 ‖Cn of C by a divisor obtained by adding 1 to the upper digit N n−1 of N. Thereby, the remainder of the result of the division is obtained. Since Q = “03/7” = 0, C remains unchanged. (F) higher digit Cn‖C n-1 indicates the high-order digits N n-1 to a value to the divisor obtained by adding multiplied by r-1 one of N and C, i.e. (r-1)
When the value is equal to or more than the value of (N n-1 +1), from C, (r-1)
× N is reduced. It should be noted that Cn - 1Cn -1 = r.times.Cn + Cn -1 . From 37 <9 × 7, C remains as it is. (G) Subtract 1 from i. That is, the operation proceeds to the calculation of the next digit. i = 2-1 = 1 (h) When i is positive or 0, the process returns to (c).
【0009】(ハ)Cをr倍し、これにA×Biを加算
した値でCを更新する。 C=10×03744+624×2=38688 (ニ)Q=「38/7」=5,C=38688−5×10
×625=07438 (ホ)Q=「07/7」=1,C=38688−1×10
×625=01188 (ヘ)11<9×7より、Cはそのまま。 (ト)i=1−1=0 (チ)iが0であるため、上記(ハ)に戻る。 (ハ)Cをr倍し、これにA×Biを加算した値でCを
更新する。 C=10×01188+624×3=13752 (ニ)Q=「13/7」=1,C=13752−1×10
×625=07502 Q=「07/7」=1,C=07502−1×10×62
5=01252 (ホ)12<9×7より、Cはそのまま。 (ト)i=0−1=−1 (チ)iが負であるため、(リ)に行く。 (リ)C=01252>N=625より、法NよりCの
値が大きいので、(ヌ)に行く 。(ヌ)Cの上位桁Cn‖Cn-1をNの上位桁Nn-1に1
を加算した除数で除した商Qにより、CからQ×Nを減
算する。 Q=「12/7」=1,C=01252−1×625=0
0627 (ル)C=00627>N=625より、(ワ)に行
く。 (ワ)CからNを減じる。C=00627−625=0
0002、ここで上記(ル)に戻る。 (ル)C=00002<N=625より、(カ)に行
く。 (カ)Cを、A×BmodNの剰余乗算の結果として出
力し、終了する。C=00002が結果として出力され
る。 以上が、一連の剰余乗算処理である。(C) C is multiplied by r, and C is updated with a value obtained by adding A × Bi to C. C = 10 × 03744 + 624 × 2 = 38688 (d) Q = “38/7” = 5, C = 38688−5 × 10
× 625 = 074438 (e) Q = “07/7” = 1, C = 38688-1 × 10
× 625 = 01188 (f) From 11 <9 × 7, C remains unchanged. (G) i = 1-1 = 0 (h) Since i is 0, the process returns to (c). (C) C is multiplied by r, and C is updated with a value obtained by adding A × Bi to C. C = 10 × 01188 + 624 × 3 = 13752 (d) Q = “13/7” = 1, C = 13752-1 × 10
× 625 = 07752 Q = “07/7” = 1, C = 075502-1 × 10 × 62
5 = 01252 (e) From 12 <9 × 7, C remains as it is. (G) i = 0-1 = -1 (h) Since i is negative, go to (l). (I) Since C = 01252> N = 625, the value of C is larger than the modulus N, so go to (nu). (Nu) The upper digit Cn‖C n-1 of C is set to 1 as the upper digit N n-1 of N.
Q × N is subtracted from C by a quotient Q divided by a divisor obtained by adding Q = “12/7” = 1, C = 01252-1 × 625 = 0
0627 (l) Since C = 00627> N = 625, go to (W). (W) subtract N from C. C = 00627-625 = 0
0002. Here, the process returns to (l). (R) From C = 00002 <N = 625, go to (F). (F) Output C as the result of the remainder multiplication of A × BmodN, and terminate. C = 00002 is output as a result. The above is a series of remainder multiplication processes.
【0010】このように、本実施例では、限定された範
囲のメモリ領域により剰余乗算処理を実行することが可
能となる。例えば、暗号・認証等の分野においては、素
因数分解の困難性や離散対数問題の困難性を安全性の根
拠とする方式がある。このような方式では、安全性の確
保の点からは大きな法の剰余乗算が必須である一方、メ
モリ領域が限定された環境では、その演算処理が困難と
なる。しかし、本発明によれば、限定された範囲のメモ
リ領域により剰余乗算処理を実行することが可能である
ため、上記問題が解決される。また、十分なメモリ領域
が存在する場合でも、経済性確保の点から、アクセスス
ピ−ドの高い少メモリとアクセススピ−ドの低い多くの
メモリとを使い分けてシステムを構成することができる
という点でも利点がある。As described above, in the present embodiment, it is possible to execute the remainder multiplication processing with a limited range of the memory area. For example, in the fields of encryption and authentication, there is a method in which the difficulty of factorization of a factor or the difficulty of a discrete logarithm problem is used as a basis for security. In such a method, a large modulo multiplication is indispensable from the viewpoint of ensuring security, but in an environment where the memory area is limited, its arithmetic processing becomes difficult. However, according to the present invention, the above problem can be solved because the remainder multiplication process can be performed using a limited range of memory area. Further, even when a sufficient memory area exists, the system can be configured by selectively using a small memory having a high access speed and a large number of memories having a low access speed from the viewpoint of securing economy. But there are benefits.
【0011】[0011]
【発明の効果】以上説明したように、本発明によれば、
限られた範囲のメモリ領域で剰余乗算処理を実行するこ
とができるので、ICカ−ド等のメモリ領域が限定され
ているシステムでも剰余乗算処理を行わせることが可能
となる。As described above, according to the present invention,
Since the remainder multiplication can be performed in a limited range of memory area, the remainder multiplication can be performed even in a system having a limited memory area such as an IC card.
【0012】[0012]
【図1】本発明の一実施例を示す剰余乗算処理のフロ−
チャ−トである。FIG. 1 is a flowchart of a modular multiplication process according to an embodiment of the present invention.
It is a chart.
【図2】本発明を適用する演算装置のブロック図であ
る。FIG. 2 is a block diagram of an arithmetic unit to which the present invention is applied.
10 メモリ領域 11 演算回路 A,B 入力変数 N 法となる変数 C,i 作業変数 r 基数 Reference Signs List 10 memory area 11 arithmetic circuit A, B input variable N method variable C, i work variable r radix
───────────────────────────────────────────────────── フロントページの続き (58)調査した分野(Int.Cl.7,DB名) G06F 7/52 310 G06F 7/72 ──────────────────────────────────────────────────続 き Continued on the front page (58) Field surveyed (Int.Cl. 7 , DB name) G06F 7/52 310 G06F 7/72
Claims (1)
iに対応するレジスタとしてのメモリ領域と、該メモリ
へのデータ書き込み読み出し処理および該メモリ間の加
減乗除算ならびに比較を行う演算回路とを用い、入力変
数AとBがNよりも小さく、A×BmodNなるAとB
の積をNを法に求める場合に、A,B,Nを対応するメ
モリに書き込み、途中経過C,iも対応するメモリに書
き込み、A,B,N,Cがそれぞれに対応してAi,B
i,Ni,Cj(0≦i≦n−1,0≦j≦m−1)で
示されるnないしm個のブロックに分けられて、 【数1】 と表現され、rを基数として各Ai,Bi,Ni,Cj
は0よりr−1までの整数で表現され、r/2≦Nn-1
とし、mをn+2とするとき、上記演算回路と対応する
メモリ領域間で以下の順序で処理を行うことを特徴とす
る剰余乗算装置の演算方法。 (1)Cを0に初期化し、iにn−1を蓄積し、 (2)Cをr倍し、これにA×Biを加算した値でCを
更新し、 (3)Cの上位桁r×Cn+1+Cnを、Nの上位桁Nn-1
に1を加算した除数で除した商Qを求め、r×Q×Nを
Cから減じ、 (4)Cの上位桁r×Cn+1+Cnを、Nの上位桁Nn-1
に1を加算した除数で除した商Qを求め、r×Q×Nを
Cから減じ、 (5)Cの上位桁r×Cn+Cn-1がNの上位桁Nn-1に
1を加算した除数にr−1を掛けた値、つまり(r−
1)(Nn-1+1)の値以上の時には、Cから(r−
1)×Nを減じ、 (6)iから1を減じ、 (7)iが正または0の時、上記(2)に戻り、 (8)C<Nの時、下記(12)に進み、 (9)Cの上位桁r×Cn+Cn-1をNの上位桁Nn-1に
1を加算した除数で除した商Qにより、CからQ×Nを
減じ、 (10)C<Nの時、下記(12)に進み、 (11)CからNを減じて、上記(10)に戻り、 (12)CをA×BmodNなる剰余乗算の結果とする。1. An input variable A, B, N and a work variable C,
A memory area as a register corresponding to i and an arithmetic circuit for performing data write / read processing to the memory and addition / subtraction / multiplication / division between the memories and comparison are used, and input variables A and B are smaller than N, and A × A and B become BmodN
When the product of N is obtained modulo N, A, B, N are written in the corresponding memory, and the intermediate progresses C, i are also written in the corresponding memory, and A, B, N, C correspond to Ai, Ai, respectively. B
Divided into n to m blocks represented by i, Ni, Cj (0 ≦ i ≦ n−1, 0 ≦ j ≦ m−1), And each of Ai, Bi, Ni, and Cj is represented by r as a radix.
Is represented by an integer from 0 to r-1, and r / 2≤Nn-1
Wherein when m is n + 2, processing is performed in the following order between the arithmetic circuit and a memory area corresponding to the arithmetic circuit. (1) Initialize C to 0, accumulate n-1 in i, (2) Update C by a value obtained by multiplying C by r and adding A × Bi to this, and (3) Upper digit of C r × Cn + 1 + Cn is replaced by the upper digit Nn−1 of N
To obtain a quotient Q obtained by dividing by 1 and subtracting r × Q × N from C. (4) The upper digit r × Cn + 1 + Cn of C is converted to the upper digit Nn−1 of N
The quotient Q obtained by dividing by 1 to the divisor is obtained, and r × Q × N is subtracted from C. (5) The upper digit r × Cn + Cn−1 of C is the divisor obtained by adding 1 to the upper digit Nn−1 of N Multiplied by r−1, that is, (r−
1) When the value is equal to or larger than the value of (Nn-1 + 1), (r−
1) subtracting N, (6) subtracting 1 from i, (7) when i is positive or 0, return to (2) above , (8) when C <N, proceed to (12) below, (9) Q × N is subtracted from C by a quotient Q obtained by dividing the upper digit r × Cn + Cn−1 of C by a divisor obtained by adding 1 to the upper digit Nn−1 of N. (10) When C <N, Proceeding to (12) below, (11) N is subtracted from C, and the process returns to (10). (12) Let C be the result of the remainder multiplication of A × BmodN.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP05033692A JP3277220B2 (en) | 1992-03-09 | 1992-03-09 | Operation method of remainder multiplication device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP05033692A JP3277220B2 (en) | 1992-03-09 | 1992-03-09 | Operation method of remainder multiplication device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH05250144A JPH05250144A (en) | 1993-09-28 |
| JP3277220B2 true JP3277220B2 (en) | 2002-04-22 |
Family
ID=12856079
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP05033692A Expired - Lifetime JP3277220B2 (en) | 1992-03-09 | 1992-03-09 | Operation method of remainder multiplication device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP3277220B2 (en) |
-
1992
- 1992-03-09 JP JP05033692A patent/JP3277220B2/en not_active Expired - Lifetime
Also Published As
| Publication number | Publication date |
|---|---|
| JPH05250144A (en) | 1993-09-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3467489B2 (en) | RSA encoding device | |
| US5274707A (en) | Modular exponentiation and reduction device and method | |
| JPH06222918A (en) | Mask for selection of multibit element at inside of compound operand | |
| JPH03105614A (en) | Matrix computation circuit | |
| JP3129392B2 (en) | Two-dimensional IDCT circuit | |
| US7003537B1 (en) | Apparatus and method to compute in Jacobian of hyperelliptic curve defined over Galois field of characteristic 2 | |
| JP3277220B2 (en) | Operation method of remainder multiplication device | |
| US7167885B2 (en) | Emod a fast modulus calculation for computer systems | |
| JP3074910B2 (en) | Division device | |
| CN114706557A (en) | ASIC chip and implementation method and device of Montgomery modular multiplication | |
| JP2737933B2 (en) | Division device | |
| US20030074383A1 (en) | Shared multiplication in signal processing transforms | |
| JP2777265B2 (en) | High radix square root arithmetic unit | |
| JP3415569B2 (en) | Decimal data division method and program recording medium therefor | |
| JP2889244B2 (en) | Image processing device | |
| KR20000009759A (en) | Modular multiplier | |
| JP2953918B2 (en) | Arithmetic unit | |
| JPH06180640A (en) | Device and method for division | |
| JP2705162B2 (en) | Arithmetic processing unit | |
| JP3390966B2 (en) | Remainder arithmetic device modulo square number and program recording medium therefor | |
| JP2835366B2 (en) | Address information generator for fast Fourier transform | |
| JPH06176054A (en) | Matrix decomposing device | |
| JP3099255B2 (en) | Remainder multiplier | |
| JPH06259230A (en) | Multiplicative residue computing device | |
| JPH04182731A (en) | Arithmetic method and arithmetic unit |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090215 Year of fee payment: 7 |
|
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090215 Year of fee payment: 7 |
|
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100215 Year of fee payment: 8 |
|
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110215 Year of fee payment: 9 |
|
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110215 Year of fee payment: 9 |
|
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120215 Year of fee payment: 10 |
|
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130215 Year of fee payment: 11 |
|
| EXPY | Cancellation because of completion of term | ||
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130215 Year of fee payment: 11 |