JP2003216032A - Device and method for operating residue - Google Patents

Device and method for operating residue

Info

Publication number
JP2003216032A
JP2003216032A JP2002017285A JP2002017285A JP2003216032A JP 2003216032 A JP2003216032 A JP 2003216032A JP 2002017285 A JP2002017285 A JP 2002017285A JP 2002017285 A JP2002017285 A JP 2002017285A JP 2003216032 A JP2003216032 A JP 2003216032A
Authority
JP
Japan
Prior art keywords
remainder
arithmetic
multiplication
value
control means
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.)
Granted
Application number
JP2002017285A
Other languages
Japanese (ja)
Other versions
JP4080754B2 (en
Inventor
Masanobu Koike
正修 小池
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP2002017285A priority Critical patent/JP4080754B2/en
Publication of JP2003216032A publication Critical patent/JP2003216032A/en
Application granted granted Critical
Publication of JP4080754B2 publication Critical patent/JP4080754B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

<P>PROBLEM TO BE SOLVED: To efficiently execute division by a residue operation system when the product of some basic elements of the residue operation system is a division modulus. <P>SOLUTION: Under the control of a control device 30, each of arithmetic units 20<SB>1</SB>to 20<SB>n</SB>subtracts xi (=x mod a<SB>i</SB>) from the value of each residue operation system expression of x as the multiple of a<SB>i</SB>and multiplies the subtraction result by the inverse element of multiplication to obtain a division result. <P>COPYRIGHT: (C)2003,JPO

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、剰余演算系に基づ
き、大きな整数の演算を並列処理により高速に計算する
剰余演算装置及び方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a residue calculation device and method for calculating a large integer operation at high speed by parallel processing based on a residue calculation system.

【0002】[0002]

【従来の技術】公開鍵暗号の重要性が増すにつれて、大
きな整数の剰余演算を効率よく行うための方法及び装置
への要望が高まっている。例えば現在事実上の標準(デ
ファクトスタンダード)であるRSA(Rivest−Shamir
−Adleman)方式では、1,024ビットの整数による剰余演
算を高速に行う必要がある。
2. Description of the Related Art With the increasing importance of public key cryptography, there is an increasing demand for a method and apparatus for efficiently performing a remainder operation of a large integer. For example, RSA (Rivest-Shamir), which is currently the de facto standard.
In the −Adleman) method, it is necessary to perform the remainder operation with an integer of 1,024 bits at high speed.

【0003】このための高速演算方法の一つとして、剰
余演算系(Residue Number Systems)が知られている。
この剰余演算系は、互いに素な比較的小さな整数の組
{a,a,…,a}を用意し、演算対象の大きな
整数をこれらの整数で割った余りの組で表現する手法で
ある。以後、この余りの組{a,a,…,a}を
剰余演算系の基底と呼び、基底を構成する要素の個数n
を基底のサイズと呼ぶ。また、基底の集合をa=
{a,a,…,a}で表す。
As one of high-speed calculation methods for this purpose, a residue number system is known.
This remainder arithmetic system prepares a pair of relatively small integers {a 1 , a 2 , ..., A n } that are disjoint and expresses the remainder by dividing a large integer to be operated by these integers. Is. Hereinafter, this remainder set {a 1 , a 2 , ..., A n } is referred to as a base of the remainder operation system, and the number n of elements forming the base is n.
Is called the base size. In addition, the set of bases is a =
It is represented by {a 1 , a 2 , ..., An }.

【0004】例えば、整数xと基底{a,a,…,
}が与えられたとき、整数xを基底要素a(i=
1,2,…,n)で割った余りxの組(x,x
…,x)がxの剰余演算系表現である。なお、x
x mod aである。ここで、整数xは、基底の全要
素の積A=a…aを法として一意的に表現でき
る。すなわち、xがA未満の正整数のとき、xとその剰
余演算系表現(x,x,…,x)は一対一に対応
する。なお、この一対一の対応関係は、中国剰余定理に
より保証されている。
For example, an integer x and a base {a 1 , a 2 , ...,
a n } is given, the integer x is converted to the basis element a i (i =
1, 2, ..., N) divided by the set of remainders x i (x 1 , x 2 ,
..., x n ) is the remainder arithmetic expression of x. Note that x i =
x mod a i . Here, the integer x can uniquely express the product A = a 1 a 2 ... a n of all the elements of the base modulo. That is, when x is a positive integer less than A, x and its remainder operation system representation (x 1 , x 2 , ..., X n ) have a one-to-one correspondence. This one-to-one correspondence is guaranteed by the Chinese Remainder Theorem.

【0005】係る剰余演算系表現では、2つの整数x,
yの積を計算する際に、各要素毎の積(x・y
…,x・y)を求め、得られた積を、対応する基底
で除した余り(x・y mod a,…,x
・y mod a)を求める。
In the remainder arithmetic system expression, two integers x,
When calculating the product of y, the product (x 1 · y 1 ,
, X n · y n ) and the obtained product divided by the corresponding basis a i (x 1 · y 1 mod a 1 , ..., x n
-Calculate y n mod a n ).

【0006】この演算は、一般的に言い換えると、各要
素毎に、対応する基底aを法とする積を計算すること
により、基底要素の積Aを法とする積が求められること
と表現される。加算及び減算についても同様であり、基
底aに対応する要素x,yについて、aを法と
する加算あるいは減算をすればよい。
In other words, this operation is generally expressed as calculating a product modulo the corresponding base a i for each element to obtain a product modulo the product A of the base elements. To be done. The same applies to addition and subtraction. For elements x i and y i corresponding to the basis a i , addition or subtraction modulo a i may be performed.

【0007】このような剰余演算系における乗算、加
算、減算は、各要素毎に独立に対応する基底を法とする
演算を行えばよいので、例えば基底として計算機のワー
ド長以内の値を採用することにより、非常に大きな整数
の演算を単精度の演算の繰り返しによって実現できる。
For multiplication, addition, and subtraction in such a remainder operation system, since it is sufficient to perform an operation modulo the basis independently corresponding to each element, for example, a value within the word length of the computer is adopted as the basis. As a result, a very large integer operation can be realized by repeating single-precision operation.

【0008】また、それらの単精度演算は、基底毎に独
立して実行可能なので、複数の演算器による並列処理が
可能になる。例えば、基底サイズがnの場合、剰余演算
機能付のn個の乗算器を並列に動作させることにより、
1回の単精度剰余付き乗算と同じ時間内で基底要素の積
Aを法とする乗算を終了できる。
Further, since these single precision operations can be executed independently for each base, parallel processing by a plurality of arithmetic units becomes possible. For example, when the base size is n, by operating n multipliers with a residue arithmetic function in parallel,
The multiplication modulo the product A of the base elements can be completed within the same time as one multiplication with a single-precision remainder.

【0009】現在の計算機内では、通常、2進数表現が
用いられている。2進数表現に基づく大きな整数の演算
では、LSB(Least Significant Bit)からMSB(Mos
t Significant Bit)に向けて桁上がりが伝播し、大きな
整数の全桁数(あるいはビット長)に比例した処理時間
がかかる。従って、2進数表現による演算は、剰余演算
系による並列処理に比べ、処理速度の点で不利である。
In modern computers, binary representation is usually used. In the operation of a large integer based on the binary number representation, LSB (Least Significant Bit) to MSB (Mos
Carry propagates toward the t Significant Bit) and takes a processing time proportional to the total number of digits (or bit length) of a large integer. Therefore, the operation using the binary number representation is disadvantageous in terms of processing speed as compared with the parallel processing using the remainder operation system.

【0010】一方、剰余演算系による演算は、ワード間
の桁上がりが生じないので、2進数表現に代表される基
数法に比べ、大きい整数の乗算、加算、減算を効率よく
行う方式として古くから知られてきている。
On the other hand, since the arithmetic operation by the remainder arithmetic system does not cause carry between words, it has long been known as a method for efficiently performing multiplication, addition, and subtraction of large integers as compared with the radix method represented by a binary number expression. Has been known.

【0011】しかしながら、剰余演算系では、除算や2
数の大小比較については基数法に比べ、効率よく行う手
段が知られていない。このため、剰余演算系は、公開鍵
暗号のような大きな整数の演算を高速に行う応用に適し
ていると考えられながら、剰余算への適用の仕方が知ら
れていない。
However, in the remainder calculation system, division or 2
Compared to the radix method, there is no known efficient method for comparing numbers. For this reason, the modulo arithmetic system is considered to be suitable for applications such as public key cryptography that perform arithmetic on large integers at high speed, but the method of application to modulo arithmetic is not known.

【0012】一方、剰余演算系表現した数値同士による
剰余乗算の方法がポッシュ(Posch)ら(IEEE Transact
ion on Parallel and Distributed Systems, Vol.6, N
o.5, May 1995, pp.449-454に掲載された“Modulo Redu
ction in Residue Number Systems”、及びComputer &
Security誌Vol.17, pp.637-650, 1998に掲載された“RN
S−Modulo Reduction Upon a Restricted Base Value S
et and its Applicability to RSA Cryptography”)、
川村(特開2001−194993)によって提案され
ている。
On the other hand, the method of modular multiplication by the numerical values expressed in the modular system is Posch et al. (IEEE Transact
ion on Parallel and Distributed Systems, Vol.6, N
“Modulo Redu” published on May 5, 1995, pp.449-454.
ction in Residue Number Systems ”, and Computer &
“RN published in Security magazine Vol.17, pp.637-650, 1998.
S-Modulo Reduction Upon a Restricted Base Value S
et and its Applicability to RSA Cryptography ”),
It has been proposed by Kawamura (JP 2001-194993 A).

【0013】これらの方法は、剰余演算系表現での演算
において不利な除算を避けるために、モンゴメリ(Mont
gomery)がMathematics of Computation, Vol.44, No.
170,pp.519-521, April, 1985に掲載された“Modular
Multiplication without Trial Division”で提案した
剰余乗算方法(以下、モンゴメリ乗算と呼ぶ)を利用す
ることで、剰余演算系における除算を行わずに剰余乗算
を実現している。
These methods use the Montgomery (Montgomery) method in order to avoid disadvantageous division in the operation in the remainder arithmetic system representation.
gomery) is Mathematics of Computation, Vol.44, No.
170, pp. 519-521, April, 1985, "Modular
By using the modular multiplication method proposed in "Multiplication without Trial Division" (hereinafter referred to as Montgomery multiplication), modular multiplication is realized without performing division in the modular arithmetic system.

【0014】しかし、モンゴメリ乗算は、整数にモンゴ
メリ定数と呼ばれる定数を乗じる必要があるが、このモ
ンゴメリ定数の計算には除算が必要であり、この除算を
剰余演算系で行う効率的な方法が知られていないため、
モンゴメリ定数を基数表現で計算している。
However, in the Montgomery multiplication, it is necessary to multiply an integer by a constant called a Montgomery constant. However, calculation of this Montgomery constant requires division, and an efficient method for performing this division by a remainder arithmetic system is known. Because it is not
The Montgomery constant is calculated in base notation.

【0015】ここでは、モンゴメリ乗算を例に挙げた
が、モンゴメリ乗算に限らず、剰余算を行うアルゴリズ
ムにおいては除算を行う必要性が生じる。
Although Montgomery multiplication has been taken as an example here, it is necessary to perform division not only in Montgomery multiplication but also in algorithms for performing remainder calculation.

【0016】[0016]

【発明が解決しようとする課題】以上説明したように、
剰余演算系における除算の効率的なアルゴリズムが要望
されるものの、未だにその要望を満たせない状況にあ
る。
As described above,
Although there is a demand for an efficient algorithm for division in the remainder calculation system, the demand is still not satisfied.

【0017】本発明は上記実情を考慮してなされたもの
で、剰余演算系で除算を効率的に実行し得る剰余演算装
置及び方法を提供することを目的とする。
The present invention has been made in consideration of the above circumstances, and an object of the present invention is to provide a remainder arithmetic device and method capable of efficiently performing division in a remainder arithmetic system.

【0018】また、本発明の他の目的は、特に、剰余演
算系の基底の幾つかの要素の積が除算の法の場合に、剰
余演算系で除算を効率的に実行し得ることにある。
Another object of the present invention is to efficiently perform division in the remainder arithmetic system, especially when the product of some elements of the base of the remainder arithmetic system is the modulus of the division. .

【0019】[0019]

【課題を解決するための手段】第1の発明は、剰余演算
系の基底を{a,a,…,a}(nは整数)とし
且つA=a…aとした際に、{a,a
…,a}から任意に1つの基底要素a(1≦i≦
n)を選択し、このaの選択情報及びA未満の正の整
数xが入力されたとき、前記xをaで除した商zを出
力可能な、剰余演算機能を有する複数の演算ユニットを
備えた剰余演算装置において、前記選択情報に基づい
て、前記xの剰余演算系表現の各値x,…,xから
前記基底要素a に対応する値xを減じるように、前
記各演算ユニットを制御する減算制御手段と、前記減算
制御手段により得られた各値(x−x),…,(x
−x)(但し、(x−x)を除く)に対し、前
記基底要素aの乗法逆元a -1を乗じるように、前記
各演算ユニットを制御する乗算制御手段と、前記乗算制
御手段により得られた乗算結果を商zとして出力する出
力手段と、を備えた剰余演算装置である。
A first invention is a remainder operation.
The basis of the system is {a1, ATwo, ..., an} (N is an integer)
And A = a1aTwo... anThen, when {a1, ATwo
…, An} Arbitrarily one base element ai(1 ≦ i ≦
n) and select this aiSelection information and positive integer less than A
When the number x is input, the x is aiGive the quotient z divided by
Multiple calculation units with a remainder calculation function
In the remainder arithmetic device provided, based on the selection information
And each value x of the remainder arithmetic expression of x1, ..., xnFrom
The base element a iThe value x corresponding toiTo reduce
Note: subtraction control means for controlling each arithmetic unit, and the subtraction
Each value (x1-Xi), ..., (x
n-Xi) (However, (xi-Xi) Except))
Base element aiMultiplicative inverse element ai -1To multiply by
Multiplication control means for controlling each arithmetic unit;
Output the multiplication result obtained by the control means as a quotient z
And a remainder calculation device including a force means.

【0020】このように、減算制御手段の制御により、
各演算ユニットがxの剰余演算系表現の各値からxi
(=x mod a)を減じてaの倍数としておき、
乗算制御手段の制御により、各演算ユニットが減算結果
に乗法逆元を乗算して除算結果を得るので、剰余演算系
で除算を効率的に実行することができる。
Thus, by the control of the subtraction control means,
Each arithmetic unit calculates xi from each value of the remainder arithmetic system expression of x.
(= X mod a i ) is subtracted and set as a multiple of a i ,
Under the control of the multiplication control means, each arithmetic unit multiplies the subtraction result by the multiplicative inverse element to obtain the division result, so that the division can be efficiently executed in the remainder arithmetic system.

【0021】なお、第1の発明は、「装置」として表現
したが、「システム」、「方法」、「プログラム」又は
「記憶媒体」等として表現してもよいことは言うまでも
ない。
Although the first invention is expressed as "apparatus", it goes without saying that it may be expressed as "system", "method", "program", "storage medium" or the like.

【0022】[0022]

【発明の実施の形態】以下、本発明の各実施形態につい
て図面を参照して説明する。 (第1の実施形態)図1は本発明の第1の実施形態に係
る剰余演算装置の主要部分の構成を示す模式図である。
この剰余演算装置10は、n個の演算ユニット20
20が制御装置30に接続されている。
BEST MODE FOR CARRYING OUT THE INVENTION Embodiments of the present invention will be described below with reference to the drawings. (First Embodiment) FIG. 1 is a schematic diagram showing a configuration of a main part of a remainder calculation device according to a first embodiment of the present invention.
The remainder arithmetic device 10 includes n arithmetic units 20 1 to 20 1 .
20 n is connected to the control device 30.

【0023】ここで、各演算ユニット20〜20
は、それぞれ対応する添字のROM21〜21
RAM22〜22及び積和回路23〜23を備
えている。
Here, each of the arithmetic units 20 1 to 20
n is the corresponding subscript ROM 21 1 to 21 n ,
The RAMs 22 1 to 22 n and the sum of products circuits 23 1 to 23 n are provided.

【0024】ROM21〜21は、制御装置30に
より読出制御される読出専用メモリであり、対応する積
和回路23〜23で用いる剰余演算系の基底要素a
,…,a、及び他の基底要素a(j≠1,…,
n)の乗法逆元値a -1を保持し、保持内容を制御装置
30からの制御により、対応する積和回路23〜23
に転送可能となっている。
ROM 211~ 21nTo the controller 30
Is a read-only memory that is read-controlled by
Sum circuit 231~ 23nBase element a of the remainder operation system used in
1, ..., an, And other base elements aj(J ≠ 1, ...,
n) multiplicative inverse aj -1Hold and hold contents control device
Under the control from 30, the corresponding product-sum circuit 231~ 23
nIt is possible to transfer to.

【0025】なお、剰余演算系のn個の基底要素a
…,aは、どの2つ同士も互いに素な正の整数が使用
されている。また、一般には剰余演算系の基底要素
,…,aの個数と、積和回路23〜23の個
数とは一致しなくてよいが、ここでは簡単のため、共に
n個とする。また、基底としては、2のべき又は2のべ
きに近接する値が用いられる。
It should be noted that the n base elements a 1 ,
.., a n are used as positive integers that are relatively prime to each other. In general the base element a 1 of remainder operation system, ..., and the number of a n, may not coincide with the number of product-sum circuit 23 1 ~ 23 n. Here, for simplicity includes n both To do. As the base, a power of 2 or a value close to the power of 2 is used.

【0026】乗法逆元値a -1は、剰余演算系の基底が
定まれば決まる値なので、事前計算して格納するが、R
OM21〜21に限らず、RAM22〜22
図示しない他のメモリ(例えばEEPROM)に格納さ
れていてもよい。
Since the multiplicative inverse element value a j -1 is a value determined when the basis of the remainder operation system is determined, it is precalculated and stored.
It may be stored not only in the OMs 21 1 to 21 n but also in the RAMs 22 1 to 22 n and other memories not shown (for example, EEPROM).

【0027】RAM22〜22は、制御装置30に
より読出/書込制御される随時書込読出メモリであり、
積和回路23〜23への入力データや、積和回路2
〜23からの演算の中間結果データ、及び演算ユ
ニット20〜20外部への出力データ、といった各
データを保持するために用いられる。
RAMs 22 1 to 22 n are occasional write / read memories which are read / write controlled by the controller 30.
Input data to the product-sum circuits 23 1 to 23 n and the product-sum circuit 2
It is used to hold each data such as intermediate result data of the operations from 3 1 to 23 n and output data to the outside of the operation units 20 1 to 20 n .

【0028】制御装置30は、図2に示す除算アルゴリ
ズムに基づいて、各演算ユニット20〜20や入出
力データを制御することにより、所定の演算を実行させ
る機能をもっている。
The control device 30 has a function of executing a predetermined operation by controlling each of the operation units 20 1 to 20 n and input / output data based on the division algorithm shown in FIG.

【0029】なお、以上のような各ユニット20〜2
及び装置30はそれぞれハードウェア、ソフトウェ
ア又はその組合せにより構成可能となっている。ここ
で、各ユニット20〜20及び装置30がソフトウ
ェアにより構成される場合、後述する各機能を実現させ
るための剰余演算プログラムが予め剰余演算装置10の
コンピュータにインストールされている。なお、ハード
ウェア及び/又はソフトウェアにより各ユニット20
〜20及び装置30を個別に構成可能な旨の説明は、
以下の各実施形態にも適用される。
The units 20 1 to 2 as described above
0 n and the device 30 can be configured by hardware, software, or a combination thereof. Here, when each of the units 20 1 to 20 n and the device 30 is configured by software, a residue calculation program for realizing each function described below is installed in advance in the computer of the residue calculation device 10. It should be noted that each unit 20 1
To 20 n and the description of the device 30 that an individually configurable is
It is also applied to each of the following embodiments.

【0030】次に、以上のように構成された剰余演算装
置の除算動作を図2及び図3を用いて説明する。始め
に、図2を用いて原理的に述べ、その後、図3を用いて
計算例を述べる。
Next, the division operation of the remainder arithmetic device configured as described above will be described with reference to FIGS. 2 and 3. First, the principle will be described with reference to FIG. 2, and then the calculation example will be described with reference to FIG.

【0031】剰余演算装置10は、図2の左側に示すよ
うに、剰余演算系での除算を行う。なお、図2の右側
は、説明の便宜上、対応する基数表現を示している。例
えばStep1では、剰余演算系の表現が(x,x
…,x,…,xn-1,x)であり、これに対応する
基数表現がxであることを示している。なお、従来の技
術で述べたように、x=x mod a(j=1,
2,…,n)の関係がある。この関係は、基数表現の正
の整数xが剰余演算系の全ての基底要素の積A=a
…aより小さいとき(x<A)、一対一の対応関係
となる。
The remainder arithmetic unit 10 performs division in the remainder arithmetic system as shown on the left side of FIG. The right side of FIG. 2 shows a corresponding radix representation for convenience of explanation. For example, in Step 1, the expression of the remainder arithmetic system is (x 1 , x 2 ,
, X i , ..., X n-1 , x n ), and indicates that the corresponding radix expression is x. As described in the related art, x j = x mod a j (j = 1,
2, ..., N). In this relationship, a positive integer x in radix representation is a product of all basis elements of the remainder arithmetic system A = a 1 a
2 ... is smaller than a n (x <A), the one-to-one correspondence.

【0032】続いて、入力(x<A)と、任意に選んだ
1つの基底要素aからx/aの商を求める方法を図
2の各ステップST1〜ST5に沿って述べる。
Next, a method for obtaining a quotient of x / a i from an input (x <A) and one arbitrarily selected base element a i will be described along steps ST1 to ST5 of FIG.

【0033】(ST1) 制御装置30は、入力データ
〜xを対応する各RAM22 〜22に書込
む。
(ST1) The controller 30 receives the input data
x1~ XnEach corresponding RAM 22 1~ 22nWrite to
Mu.

【0034】(ST2) 制御装置30は、選択した基
底要素aに基づいて、対応するRAM22内の値x
を調べ、各積和回路23〜23に対応するRAM
22 〜23内の値x〜xからxを減じるよう
に命令する。
(ST2) The controller 30 selects the selected base.
Bottom element aiBased on the corresponding RAM 22iValue within x
iEach sum-of-products circuit 231~ 23nRAM corresponding to
22 1~ 23nValue within x1~ XnFrom xiTo reduce
To order.

【0035】(ST3) 各積和回路23(j=1,
2,…,n)は、y=xj−mod aを実行
し、結果yを各RAM22jに格納する。基数表現で
の対応する演算はy=x−xである。
(ST3) Each product-sum circuit 23 j (j = 1,
2, ..., N) executes y j = x j− x i mod a j and stores the result y j in each RAM 22j. The corresponding operation in radix representation is y = x−x i .

【0036】(ST4) 制御装置30は、n−1個の
積和回路23j(j=1,2,…,n、j≠i)に対し
て、RAM22j内の値yにaの乗法逆元a -1
mod aを乗じるように命令する。但し、この命令
は、xに対応する積和回路23iには与えない。な
お、剰余演算系における乗法逆元の乗算は、基数表現に
おける除算に相当する。
(ST4) The controller 30 multiplies the value y j in the RAM 22j by a i for the n-1 product-sum circuits 23j (j = 1, 2, ..., N, j ≠ i). Inverse element a i -1
Command to multiply by mod a j . However, this instruction is not given to the sum-of-products circuit 23i corresponding to x i . The multiplication of the multiplicative inverse element in the remainder arithmetic system corresponds to division in the radix representation.

【0037】(ST5) 各積和回路23j(j=1,
2,…,n、j≠i)は、z=y ×a -1 mod
を実行し、結果zを各RAM12jに格納する。
なお、yは、前述した通り、xからx(=x mod
)を減じた値であるのでaの倍数である。このた
め、除算の商y/aは整数となる。従って、z=y/
が対応する基数表現での演算となる。
(ST5) Each product-sum circuit 23j (j = 1,
2, ..., N, j ≠ i) is zj= Y j× ai -1 mod
ajAnd the result zjIs stored in each RAM 12j.
Note that y is from x to x as described above.i(= X mod
ai) Is subtracted, so aiIs a multiple of. others
Therefore, the division quotient y / aiIs an integer. Therefore, z = y /
aiIs the operation in the corresponding radix representation.

【0038】この5ステップの結果、RAM22j(j
=1,2,…,n、j≠i)に格納された計算結果z
が商zの剰余演算系表現となっている。但し、基底要素
に対応するzの成分(z)が未計算のため(図2
のステップST5では未計算を示すため、zの箇所に
×という印をつけている)、zで表現できる最大の数
はA/aとなる。しかしながら、商z=y/a≦x
/a<A/aであるので、この計算結果zは、商
zの正しい値を表現している。
As a result of these 5 steps, RAM 22j (j
= 1, 2, ..., N, j ≠ i) calculation result z j stored in
Is the remainder arithmetic expression of the quotient z. However, since the z component (z i ) corresponding to the base element a i has not been calculated (see FIG.
In step ST5 of (1), uncalculated is indicated, so that the part of z i is marked with x), and the maximum number that can be represented by z j is A / a i . However, the quotient z = y / a i ≦ x
Since / a i <A / a i , this calculation result z j represents the correct value of the quotient z.

【0039】以上により、x/aを剰余演算装置10
で計算することができる。
From the above, x / a i is calculated by the remainder computing device 10
Can be calculated by

【0040】次に、選ばれた基底要素が2個以上の場合
について説明する。この場合も上述した5つのステップ
を選ばれた基底要素の個数分だけ繰り返すことで実現で
きる。以下、図3を用いて具体例で説明する。図3に示
すように、剰余演算系の基底の要素数n=4とし、各要
素a,a,a,aの値をそれぞれ7、11、1
3、17としている。この例は、入力x=4567<a
=17017であり、基底要素から
,aを選んで商4567/(7×17)=38を
剰余演算系で求める手順を表している。
Next, the case where the number of selected base elements is two or more will be described. In this case as well, it can be realized by repeating the above-mentioned five steps for the number of selected base elements. Hereinafter, a specific example will be described with reference to FIG. As shown in FIG. 3, the number of elements of the base of the remainder arithmetic system is set to n = 4, and the values of the elements a 1 , a 2 , a 3 , and a 4 are 7, 11, and 1 , respectively.
3 and 17. In this example, input x = 4567 <a
1 a 2 a 3 a 4 = 17017, which represents a procedure for selecting a 1 and a 4 from the base elements and obtaining a quotient 4567 / (7 × 17) = 38 in the remainder calculation system.

【0041】(ST1’) 制御装置30は、入力デー
タ3,2,4,11を各RAM22 〜22に書込
む。なお、各入力データ3,2,4,11は、入力x=
4567を剰余演算系で表したものである。例えばx
=4567 mod7=3なので、a=7の下に3と
記述されている。
(ST1 ') The controller 30 controls the input data
RAM3,2,4,11 1~ 22FourWrite to
Mu. In addition, each input data 3, 2, 4, 11 is input x =
4567 is a residue calculation system. For example x1
= 4567 mod7 = 3, so a1= 3 under 3
It has been described.

【0042】(ST2’) 制御装置30は、選択した
基底要素a,aのうち、まず、一方の基底要素a
に基づき、対応するRAM22内の値x=3を読出
し、各積和回路23〜23に、対応するRAM22
〜22内の値3,2,4,11から3を減じるよう
に命令する。
(ST2 ') The controller 30 first selects one of the selected base elements a 1 and a 4 as the base element a 1.
Based on, reads the value x 1 = 3 in the corresponding RAM22 1, each product-sum circuit 23 1 to 23 4, the corresponding RAM22
Commands from the value 3,2,4,11 of 1-22 4 so as to reduce the 3.

【0043】(ST3’) その結果、各成分の値はス
テップST3’に示した値0,10,1,8になる。対
応する基数表現での値は、4567−3=4564であ
る。
(ST3 ') As a result, the value of each component becomes the value 0, 10, 1, 8 shown in step ST3'. The corresponding radix value is 4567-3 = 4564.

【0044】(ST4’) 制御装置30は、3個の積
和回路23〜23に対し、RAM22〜22
値10,1,8にその基底要素を法とするaの乗法逆
元7 -1を乗じるように命令する。例えばa -1 mod
=8であるから、aの成分は10×8 mod 1
1=3となる。但し基底要素aに対してはaの乗法
逆元が存在しないので、aの成分に対応する積和回路
23には命令を出さない。
(ST4 ') The controller 30 produces three products.
Sum circuit 23Two~ 23FourIn contrast, RAM22Two~ 22Fourof
A modulo its base element to the value 10, 1, 81Multiplicative inverse
Ex 7 -1Order to multiply by. For example, a1 -1 mod
aTwo= 8, aTwoThe component of is 10 × 8 mod 1
1 = 3. However, the base element a1For a1Multiplication of
Since there is no inverse element, a1Sum-of-products circuit corresponding to the components of
231I will not give you an order.

【0045】(ST5’) aの乗法逆元a -1の乗
算の結果、各成分の値はステップST5’で表示した値
×,3,2,6になる。但しaの成分×は無視する。
この場合、剰余演算系で一意的に表示できる数はa
=2431までという制約がつくが、元の入力x
<aであったので、a=7での除算結
果x/a<aとなり、正しく表現できてい
る。対応する基数表現での値は4564/7=652で
ある。無視したaの成分は、以下では演算を行わな
い。
[0045] (ST5 ') The result of the multiplication of a 1 of multiplicative inverse a 1 -1, the value of each component step ST5' value × viewed in becomes 3,2,6. However, the component x of a 1 is ignored.
In this case, the number that can be uniquely displayed in the remainder calculation system is a 2 a
3 a 4 = 2431 constraint that to arrive, but the original input x
Since it was <a 1 a 2 a 3 a 4 , the result of division when a 1 = 7 is x / a 1 <a 2 a 3 a 4 and can be expressed correctly. The corresponding radix value is 4564/7 = 652. The ignored component of a 1 is not calculated below.

【0046】さて図2の説明では選択した基底要素が1
個だけだったのでこれで除算が終了したが、図3の例で
は基底要素を2個選択しているので、2個目の選択した
基底要素aに対しても図2と同じ演算を行う。但し1
個目で選択した基底要素aで表現している値は、ステ
ップST5’終了時では計算されていないので、以下で
はこの基底要素aに対応する演算を行わない。
In the explanation of FIG. 2, the selected base element is 1
Since the number of the base elements is only 4, the division is completed. However, in the example of FIG. 3, since two base elements are selected, the same operation as in FIG. 2 is performed on the second selected base element a 4 . . However, 1
Since the value represented by the base element a 1 selected by the item is not calculated at the end of step ST5 ′, the calculation corresponding to this base element a 1 will not be performed below.

【0047】(ST2”) 次に選んだ基底要素a
17に注目する。aの成分は6であるから、各成分か
ら6を減じる。
(ST2 ") Next selected base element a 4 =
Note 17 Since the component of a 4 is 6, subtract 6 from each component.

【0048】(ST3”)その結果、各成分の値はステ
ップST3”に表示した値になる。対応する基数表現で
の値は、652−6=646である。
(ST3 ") As a result, the value of each component becomes the value displayed in step ST3". The corresponding radix value is 652-6 = 646.

【0049】(ST4”) ステップST3”の値に対
し、a=17の乗法逆元17-1を乗算する。但し基底
要素aに対してはaの乗法逆元が存在しないのでa
の成分に対する演算を行わない。
(ST4 ") The value of step ST3" is multiplied by the multiplicative inverse element 17 -1 of a 4 = 17. However a so for the base element a 4 no multiplicative inverse of a 4
No calculation is performed on the component of 4 .

【0050】(ST5”) aの乗法逆元17-1の乗
算の結果、各成分の値はステップST5”で表示した値
になる。但しaの値は無視する。剰余演算系で一意的
に表示できる数はaまでだが、ステップST5’
で述べた理由と同じ理由により、この2つの基底での表
現で正しく表現できている。対応する基数表現での値は
646/17=38である。
(ST5 ″) As a result of multiplication of the multiplicative inverse element 17 −1 of a 4 , the value of each component becomes the value displayed in step ST5 ″. However, the value of a 4 is ignored. The number that can be uniquely indicated by the remainder operation system's up a 2 a 3, but the step ST5 '
For the same reason as described above, the expression in these two bases can be correctly expressed. The corresponding radix value is 646/17 = 38.

【0051】以上で選んだ基底要素a,aについて
全て演算が終わったので、基底要素aとaに保持し
ている値(5及び12)が求めたい商の基底{a,a
}の下での剰余演算系表現となる。
Since the calculation is completed for all the base elements a 1 and a 4 selected above, the values (5 and 12) held in the base elements a 2 and a 3 are the bases of the quotient {a 2 , a
3 }, the remainder operation system expression is obtained.

【0052】上述したように本実施形態によれば、剰余
演算系の基底のいくつかの要素の積が除算の法の場合
に、剰余演算系で除算を効率的に行うことができる。
As described above, according to the present embodiment, when the product of some elements of the base of the remainder operation system is the modulus of division, the remainder operation system can efficiently perform the division.

【0053】また、剰余演算系表現で演算を行う場合、
途中で除算処理が生じても基数表現に変更することな
く、そのまま剰余演算系表現で処理を行えるため、処理
の高速化を期待することができる。
In addition, when performing an arithmetic operation with a remainder arithmetic system expression,
Even if a division process occurs in the middle of the process, the process can be performed in the remainder arithmetic system representation without changing to the radix representation, so that it is possible to expect a high speed process.

【0054】(第2の実施形態)図4は本発明の第2の
実施形態に係る剰余演算装置の主要部分の構成を示す模
式図であり、図1と同一部分には同一符号を付し、変形
した部分には記号(’)を付して重複した説明を省略
し、ここでは異なる部分について主に述べる。なお、以
下の各実施形態も同様にして重複した説明を省略する。
(Second Embodiment) FIG. 4 is a schematic diagram showing the structure of the main part of a remainder calculation device according to a second embodiment of the present invention. The same parts as those in FIG. A symbol (') is attached to the deformed portion to omit duplicate description, and different portions will be mainly described here. It should be noted that in each of the following embodiments as well, duplicated description will be omitted.

【0055】すなわち、本実施形態は、第1の実施形態
の変形例であり、バレット・リダクションアルゴリズム
への適用を図るものであって、具体的には、図4に示す
ように、制御装置30に代えて、バレット・リダクショ
ンアルゴリズム及び川村の手法(特開2001−194
993)を利用可能な制御装置30’を設け、また川村
の手法に述べられるビット選択部41及び補正項演算ユ
ニット42を備えている。また、各積和回路23’〜
23’は、補正項演算ユニット42から制御可能なも
のとなっている。
That is, this embodiment is a modification of the first embodiment and is intended to be applied to the bullet reduction algorithm. Specifically, as shown in FIG. Instead of the bullet reduction algorithm and Kawamura's method (Japanese Patent Laid-Open No. 2001-194).
993) is provided, and the bit selection unit 41 and the correction term calculation unit 42 described in the method of Kawamura are provided. Also, each sum-of-products circuit 23 1 ′-
23 n ′ can be controlled by the correction term calculation unit 42.

【0056】まず、基数表現(b進数、bは正の整数)
におけるバレット・リダクションアルゴリズムを説明す
る(P. D. Barrett, “Implementing the Rivest, Sham
ir and Adleman Public Key Encryption Algorithm on
a Standard Digital SignalProcessor”, Advances in
Cryptology, Proc. Crypto ’86, pp.311-323, 198
7.)。
First, the radix representation (b-adic number, b is a positive integer)
Barrett, “Implementing the Rivest, Sham.
ir and Adleman Public Key Encryption Algorithm on
a Standard Digital SignalProcessor ”, Advances in
Cryptology, Proc. Crypto '86, pp.311-323, 198
7.).

【0057】なお、以下の説明では、正の整数sのb進
数での表現をs=(sk-1 …s と表す。これ
はs=sk-1k-1+…+sb+sである旨を意味し
ている。
In the following explanation, the positive integer s is a b-ary
The numerical representation is s = (sk-1 … S1s 0)bExpress. this
Is s = sk-1bk-1+ ... + s1b + s0Means that
ing.

【0058】バレット・リダクションは、剰余算を、試
行割算を用いずに加算と乗算のみで行なうアルゴリズム
であり、x mod Nの計算において、Nの倍数でxを
近似する際に、上位桁で近似するという特色がある。具
体的にはバレット・リダクションは、x=(x2k-1…x
、N=(Nk-1…N、Nk-1≠0を
入力としたとき、z=x mod Nを出力するもので、
次の8ステップST11〜ST18からなる。
Bullet reduction is an algorithm for performing remainder calculation only by addition and multiplication without using trial division, and in the calculation of x mod N, when x is approximated by a multiple of N, high-order digits are used. There is a feature that it approximates. Specifically, Barrett reduction is x = (x 2k-1 ... x
When 1 x 0 ) b , N = (N k-1 ... N 1 N 0 ) b , N k-1 ≠ 0 are input, z = x mod N is output.
It consists of the following eight steps ST11 to ST18.

【0059】事前計算:μ= Quot(b2k/N) (ST11) q← Quot(x/bk-1) (ST12) q←q・μ (ST13) q← Quot(q/bk+1) (ST14) r← x mod bk+1 (ST15) r ← q・m mod bk+1 (ST16) z ← r−r (ST17) もしz<0ならz←z+bk+1 (ST18) z≧Nである間、z←z−N ここで、Quot(s/t)はsをtで割ったときの商を表
す。
Pre-calculation: μ = Quot (b 2k / N) (ST11) q 1 ← Quot (x / b k-1 ) (ST12) q 2 ← q 1 μ (ST13) q 3 ← Quot (q 2 / B k + 1 ) (ST14) r 1 ← x mod b k + 1 (ST15) r 2 ← q 3 · m mod b k + 1 (ST16) z ← r 1 -r 2 (ST17) If z <0 Then z ← z + b k + 1 (ST18) While z ≧ N, z ← z−N where Quot (s / t) represents a quotient when s is divided by t.

【0060】これを剰余演算系で行うために、以下のよ
うに若干変更する。
In order to do this in the remainder calculation system, the following modifications are made.

【0061】まず{b,b,…,b,bk+1
…,b2k,b2k+1}を剰余演算系の基底とし、b<b
2k+1とする。Nをb…bk-1<N<b…b
を満たす整数とする。このときx<Nなるxに対し
て、z=x mod Nは次の6ステップST21〜ST
26で計算される。
First, {b 1 , b 2 , ..., B k , b k + 1 ,
, B 2k , b 2k + 1 } is the basis of the remainder operation system, and b k <b
Set to 2k + 1 . N is b 1 b 2 ... b k-1 <N <b 1 b 2 ... b
Let k be an integer. At this time, for x with x <N 2 , z = x mod N has the following 6 steps ST21 to ST
Calculated at 26.

【0062】事前計算:μ= Quot(b…b2k
N) (ST21) q← Quot(x/b…bk-1) (ST22) q←q・μ (ST23) q← Quot(q/bk+1…b2k) (ST24) r← q・N (ST25) z ← x−r (ST26) z≧Nである間、z←z−N 基数表現でのバレット・リダクションと比較すると、基
数bを剰余演算系の基底要素に置き換えているのが大き
な違いである。基数表現では、基数bが一定であるため
ステップST11などではbのべき乗が使われていた
が、剰余演算系では基底の要素が互いに異なるため、ス
テップST21のように基底要素の積に置き換わってい
る。
Pre-calculation: μ = Quot (b 1 b 2 ... b 2k /
N) (ST21) q 1 ← Quot (x / b 1 b 2 ... b k-1 ) (ST22) q 2 ← q 1 · μ (ST23) q 3 ← Quot (q 2 / b k b k + 1 ... b 2k ) (ST24) r 2 ← q 3 · N (ST25) z ← x−r 2 (ST26) While z ≧ N, z ← z−N is a radix b compared with Barrett reduction in radix representation. The major difference is that is replaced by the base element of the remainder arithmetic system. In the radix representation, since the radix b is constant, the power of b is used in step ST11 and the like, but since the elements of the bases are different from each other in the remainder operation system, they are replaced by the product of the base elements as in step ST21. .

【0063】その点を考慮すると、上のアルゴリズムの
事前計算、ステップST21〜ST23は、基数表現で
のバレット・リダクションに対応した演算となってい
る。ステップST24,ST25は、基数表現でのステ
ップST14〜ST16に対応しているが、剰余演算系
では大小関係の比較が困難なため、基数表現におけるm
od bk+1に対応する演算を省略している。
Considering that point, the pre-calculations of the above algorithm, steps ST21 to ST23, are operations corresponding to the bullet reduction in the radix representation. Although steps ST24 and ST25 correspond to steps ST14 to ST16 in the radix representation, since it is difficult to compare the magnitude relations in the remainder arithmetic system, m in the radix representation is represented.
The calculation corresponding to od b k + 1 is omitted.

【0064】本実施形態は、このような演算により、基
数表現でのステップST17での比較操作を回避でき
る。なぜなら、qは本来の商をQ= Quot(x/N)
としたとき、Q−2≦q≦Qの範囲にあるので、ステ
ップST25の減算結果の出力zが必ず正になるからで
ある。
According to this embodiment, the comparison operation in step ST17 in the radix representation can be avoided by such an operation. Because q 3 is the original quotient Q = Quot (x / N)
Is in the range of Q−2 ≦ q 3 ≦ Q, the output z of the subtraction result of step ST25 is always positive.

【0065】またqのこの評価式より、ステップST
25の出力は、本来のx mod NをRとしたとき、
R、R+N、R+2Nのいずれかとなる。R+N、R+
2Nだったときの場合のため、ステップST26で正し
いRの値に調節する。
From this evaluation formula of q 3 , step ST
When the original x mod N is R, the output of 25 is
One of R, R + N, and R + 2N. R + N, R +
In the case of 2N, the correct R value is adjusted in step ST26.

【0066】また、演算の途中結果は全て基底の積b
…b2k2k+1以下になっている必要があるが、b
<b2k+1となるようにb2k+1を選んであるので、これを
満たしていることも確認できる。
All intermediate results of the calculation are the product of bases b 1
b 2 ... b 2k b 2k + 1 or less, but b k
Since b 2k + 1 is selected so that <b 2k + 1 holds , it can be confirmed that this is also satisfied.

【0067】上で説明した剰余演算系でのバレット・リ
ダクションを剰余演算装置10’を用いて行う手法につ
いて説明する。ここで図4における積和回路23’〜
23 ’の個数nと、剰余演算系の基底要素の個数2k
+1とは、一般には一致しなくてよいが、ここでは簡単
のためn=2k+1とする。
Barrett Lee in the remainder arithmetic system described above
For the method of performing the subtraction using the remainder arithmetic device 10 '
And explain. Here, the product-sum circuit 23 in FIG.1’~
23 n′ 'And the number of base elements of the remainder operation system 2k
Generally +1 does not have to match, but here it is easy
Therefore, n = 2k + 1.

【0068】また、整数x<Nの剰余演算系の表現を
x=(x,x,…,x2k,x2k +1)とする。ここで
=x mod bであるのは前述の通りである。
Further, the expression of the remainder arithmetic system with integer x <N 2 is x = (x 1 , x 2 , ..., X 2k , x 2k +1 ). Here, x i = x mod b i is as described above.

【0069】(事前計算) μ= Quot(b…b
2k/N)は、基数表現の下での除算を行うことで実現す
る。この結果を剰余演算系表現した(μ,μ,…,
μ2k,μ2k+1)をそれぞれ図4の対応するRAM22
に格納する。
(Preliminary calculation) μ = Quot (b 1 b 2 ... b
2k / N) is realized by performing division under the radix representation. This result is expressed as a remainder operation system (μ 1 , μ 2 , ...,
μ 2k , μ 2k + 1 ) respectively corresponding to the RAM 22 i of FIG.
To store.

【0070】(ST21) 商qを求める計算は、第
1の実施形態で説明した手法により行う。入力は、x及
び、基底要素としてb,b,…,bk-1のk−1個
を選んだという情報である。この商計算の結果qとし
て、各RAM22に格納された値qを図5のST2
1に示す。
(ST21) The calculation for obtaining the quotient q 1 is performed by the method described in the first embodiment. The input is the information that x and k−1 pieces of b 1 , b 2 , ..., B k−1 are selected as the base elements. As the result q 1 of this quotient calculation, the value q 1 stored in each RAM 22 i is set to ST2 in FIG.
Shown in 1.

【0071】選択した基底要素がb,b,…,b
k-1であったので、前述同様に、対応する剰余演算系表
現の値が未計算となる。換言すると、qの剰余演算系
表示は、基底{b,bk+1,…,b2k+1 }の下で(q
1_k,q1_(k+1),…,q1_ (2k+1))と表現され、基
底要素b,b,…,bk-1にはqの剰余演算系表
現の値が格納されない。
The selected base elements are b 1 , b 2 , ..., B
Since it is k−1 , the value of the corresponding remainder arithmetic system expression is uncalculated as described above. In other words, the remainder operation system display of q 1 is based on the basis {b k , b k + 1 , ..., B 2k + 1. } (Q
1_k , q 1_ (k + 1) , ..., q 1_ (2k + 1) ), and the base element b 1 , b 2 , ..., b k-1 has the value of the residue arithmetic system representation of q 1. Not stored.

【0072】そこで、川村の基底拡張の手法により、
(q1_k,q1_(k+1),…,q1_(2 k+1))から図5の
ST21−2に示すように、qを全ての基底{b
,…,b,bk+1,…,b2k,b2k+1}に拡張し
た剰余演算系表現を求める。
Therefore, according to Kawamura's base extension method,
From (q 1_k , q 1_ (k + 1) , ..., q 1_ (2 k + 1) ) to ST 21-2 of FIG. 5, q 1 is set to all bases {b 1 ,
b 2, ..., b k, b k + 1, ..., b 2k, b 2k + 1 determine the remainder operation based expressions which have been expanded}.

【0073】(ST22) このようにして拡張された
商qにμを乗じる。この乗算は各積和回路23’〜
23’での並列乗算で実現できる。
(ST22) The quotient q 1 thus extended is multiplied by μ. This multiplication is performed by each product-sum circuit 23 1 ′-
It can be realized by parallel multiplication with 23 n '.

【0074】(ST23) 再び第1の実施形態で説明
した手法により、入力q及び基底要素としてb,b
k+1,…,b2kのk+1個を選んだという選択情報で商
を求める。求められた商q3は、図6のST23に
示すように、基底{b,b ,…,bk-1,b2k+1
の下での表現なので、ST21と同様に基底拡張を用い
て全ての基底{b,b,…,b,bk+1,…,b
2k,b2k+1}を用いた剰余演算系表現にする(図6:S
T23−2)。
(ST23) Again explained in the first embodiment
The input qTwoAnd b as a base elementk, B
k + 1, ..., b2kQuotient with the selection information that you have selected k + 1
qThreeAsk for. The obtained quotient q3 is ST23 of FIG.
As shown, the basis {b1, B Two, ..., bk-1, B2k + 1}
Since it is the expression below, use the base extension as in ST21.
And all bases {b1, BTwo, ..., bk, Bk + 1, ..., b
2k, B2k + 1} Is used to represent the remainder operation system (FIG. 6: S
T23-2).

【0075】(ST24) このように拡張されたq
にNを乗じる。この乗算は各積和回路23’〜2
’での並列乗算で実現できる。
(ST24) q 3 extended in this way
Is multiplied by N. This multiplication is performed by each product-sum circuit 23 1 ′ to 2
It can be realized by parallel multiplication with 3 n '.

【0076】(ST25) 各積和回路23’〜23
’での並列減算で実現できる。
(ST25) Each product-sum circuit 23 1 ′ -23
It can be realized by parallel subtraction at n '.

【0077】(ST26) この演算は大小比較がある
ので、ステップST25で得られたzを基数表現に戻し
てから行う。
(ST26) Since this operation has a size comparison, it is performed after the z obtained in step ST25 is returned to the radix representation.

【0078】上述したように本実施形態によれば、x
mod Nを求めるバレット・リダクションを剰余演算
系表現で並列処理することができ、基数表現で行う場合
よりも処理の高速化を期待することができる。
As described above, according to this embodiment, x
Bullet reduction for finding mod N can be parallel-processed by a residue arithmetic system expression, and higher processing speed can be expected as compared with the case of radix expression.

【0079】(第3の実施形態)次に、本発明の第3の
実施形態に係る剰余演算装置について図4を参照しなが
ら図7を用いて説明する。この剰余演算装置は、図4と
同一要素からなる装置であって、バレット・リダクショ
ンを用いてRSA暗号などに用いられる,べき乗剰余算
を行うものである。
(Third Embodiment) Next, a remainder calculation device according to a third embodiment of the present invention will be described with reference to FIG. 4 and FIG. This modulo arithmetic device is a device composed of the same elements as in FIG. 4, and performs a modular exponentiation operation used for RSA encryption or the like by using bullet reduction.

【0080】べき乗剰余算は、C=ME mod N とい
う式で表される。この演算は一般に次の5つのステップ
ST31〜ST35のように行われる。
The modular exponentiation is expressed by the equation C = M E mod N. This calculation is generally performed as in the following five steps ST31 to ST35.

【0081】Eの2進数での表現をE=(Em-1
、Em-1≠0とするとき、 (ST31) C ← 1 (ST32) i=m−1から0まで以下のST33と
ST34をループ (ST33) C ← C mod N (ST34) もしE=1ならC ← C×M mod
N (ST35) Cを出力 本実施形態は、ステップST33,ST34の演算を剰
余演算系で行うものである。ステップST33,ST3
4の剰余乗算は、乗算後にNでの剰余を求めるという手
法を用いる。乗算は、剰余演算系で並列乗算で実現でき
る。Nでの剰余を求める際に、第2の実施形態で説明し
たバレット・リダクションアルゴリズムST21〜ST
26を利用する。
The binary representation of E is E = (E m-1 E 1 E
0 ) 2 and E m-1 ≠ 0, (ST31) C ← 1 (ST32) i = m−1 to 0, the following ST33 and ST34 are looped (ST33) C ← C 2 mod N (ST34) If E i = 1 then C ← C × M mod
N (ST35) C is output In this embodiment, the arithmetic operations of steps ST33 and ST34 are performed by the remainder arithmetic system. Steps ST33, ST3
The remainder multiplication of 4 uses a method of obtaining a remainder in N after the multiplication. The multiplication can be realized by parallel multiplication in the remainder arithmetic system. When obtaining the remainder in N, the bullet reduction algorithms ST21 to ST described in the second embodiment are used.
26 is used.

【0082】(ST30) 図7ではまず、べき指数E
と剰余演算系表示したM=(M,M,…,M2k+1
を入力する。
(ST30) In FIG. 7, first, the power index E
M = (M 1 , M 2 , ..., M 2k + 1 )
Enter.

【0083】(ST31) 次に(C,C,…,C
2k+1)を全て1に初期化する。
(ST31) Next, (C 1 , C 2 , ..., C
2k + 1 ) is initialized to all 1.

【0084】(ST32) ステップST31の初期設
定のもと、i=m−1から0までループを行う。
(ST32) Under the initial setting of step ST31, a loop is executed from i = m-1 to 0.

【0085】(ST33−1) 2乗算(C,C
…,C2k+1)←(C,C,…,C2k+1)×(C
,…,C2k+1)を行なう。これは剰余演算系で並列
乗算で実現できる。2乗算の結果をmod Nするため
にバレット・リダクションBRを行なう(ST33−
2)。
(ST33-1) 2 multiplication (C 1 , C 2 ,
…, C 2k + 1 ) ← (C 1 , C 2 ,…, C 2k + 1 ) × (C 1 ,
C 2 , ..., C 2k + 1 ). This can be realized by parallel multiplication in the residue arithmetic system. Bullet reduction BR is performed to mod N the result of 2 multiplication (ST33-
2).

【0086】(ST34−0) E=1である場合に
演算を行なう。
(ST34-0) When E i = 1 is calculated.

【0087】(ST34−1) 乗算(C,C
…,C2k+1)←(C,C,…,C 2k+1)×(M
,…,M2k+1)は、剰余演算系で並列乗算で実現で
きる。乗算結果をバレット・リダクションでmod N
する(ST34−2)。
(ST34-1) Multiplication (C1, CTwo
…, C2k + 1) ← (C1, CTwo,,, C 2k + 1) × (M1
MTwo, ..., M2k + 1) Can be realized by parallel multiplication in the remainder arithmetic system.
Wear. Multiply the mod N by bullet reduction
(ST34-2).

【0088】(ST35) ループが終了したら、その
ときの(C,C,…,C2k+1)を出力する。
(ST35) When the loop is completed, (C 1 , C 2 , ..., C 2k + 1 ) at that time is output.

【0089】但し、べき乗剰余算で第2の実施例で説明
したバレット・リダクションを用いると、バレット・リ
ダクションの最後のステップST26で一旦基数表現に
戻して大小比較を行い、剰余を決定するため、剰余演算
系での並列計算による処理速度向上の長所を生かしきれ
ていない。
However, when the bullet reduction explained in the second embodiment is used in the modular exponentiation, the remainder is determined by returning to the radix representation once in the last step ST26 of the bullet reduction and comparing the magnitudes. The advantage of improving the processing speed by parallel calculation in the remainder arithmetic system has not been fully utilized.

【0090】そのため、第2の実施形態で説明した剰余
演算系でのバレット・リダクションアルゴリズムのST
25で終了するようにする。この場合、出力zがNより
大きい可能性があるので、バレット・リダクションアル
ゴリズムを次のように行うことにする。
Therefore, the ST of the bullet reduction algorithm in the remainder operation system described in the second embodiment is
Try to finish at 25. In this case, the output z may be larger than N, so the bullet reduction algorithm is performed as follows.

【0091】すなわち、{b,b,…,b,b
k+1,…,b2k,b2k+1}を剰余演算系の基底とする。
法Nは、b…bk-1<N、9N<b…b
を満たす整数とする。
That is, {b 1 , b 2 , ..., B k , b
Let k + 1 , ..., b 2k , b 2k + 1 } be the basis of the remainder operation system.
Law N is, b 1 b 2 ... b k -1 <N, 9N <b 1 b 2 ... b k
Be an integer that satisfies.

【0092】このとき、入力xが0<x<9N<b
…b2kを満たせば、下のアルゴリズムで出力される
zは、z=x mod N、0≦z<3Nを満たす。
At this time, the input x is 0 <x <9N 2 <b 1
If b 2 ... B 2k is satisfied, z output by the algorithm below satisfies z = x mod N, 0 ≦ z <3N.

【0093】事前計算:μ= Quot(b…b2k
N) (ST21) q← Quot(x/b…bk-1) (ST22) q←q・μ (ST23) q← Quot(q/bk+1…b2k) (ST24) r← q・N (ST25) z ← x−r このアルゴリズムにより、剰余乗算z=xy mod N
を剰余演算系の乗算とバレット・リダクションを組合せ
て実行すると、x<3N,y<3Nであればxy<9N
であるのでz<3Nという出力が得られる。ここで、
入力と出力の範囲が同じであるので、べき乗剰余算にお
いて繰り返し剰余乗算を行うことができる。
Pre-calculation: μ = Quot (b 1 b 2 ... b 2k /
N) (ST21) q 1 ← Quot (x / b 1 b 2 ... b k-1 ) (ST22) q 2 ← q 1 · μ (ST23) q 3 ← Quot (q 2 / b k b k + 1 ... b 2k ) (ST24) r 2 ← q 3 · N (ST25) z ← x−r 2 By this algorithm, remainder multiplication z = xy mod N
Is executed by combining the multiplication of the remainder arithmetic system and the bullet reduction, if x <3N and y <3N, xy <9N
Since it is 2 , an output of z <3N is obtained. here,
Since the input and output ranges are the same, it is possible to repeatedly perform modular exponentiation in the modular exponentiation.

【0094】また、べき乗剰余算アルゴリズムのステッ
プST35で最終的なCを出力するとき、最後のバレッ
ト・リダクションではC<3Nにしかサイズが抑えられ
ていないので、基数表現に変換して必要な回数だけNを
減じることにより、C<Nなる出力を得ることができ
る。
Also, when the final C is output in step ST35 of the modular exponentiation algorithm, the size is suppressed to C <3N in the last bullet reduction, so the number of times required by converting to the radix representation is required. By subtracting N by, the output C <N can be obtained.

【0095】上述したように本実施形態によれば、ST
30〜ST35に示すように、バレット・リダクション
を利用したべき乗剰余算を、剰余演算系で並列処理する
ことができ、基数表現で行う場合よりも処理の高速化が
期待できる。
As described above, according to this embodiment, ST
As shown in 30 to ST35, the modular exponentiation using the bullet reduction can be processed in parallel in the residue arithmetic system, and the processing speed can be expected to be higher than that in the case of using the radix representation.

【0096】また、基数表現で行っていたバレット・リ
ダクションを、剰余演算系で並列計算することによる効
果は、次のように見積られる。
Further, the effect of parallel calculation of the bullet reduction performed in the radix representation in the remainder arithmetic system is estimated as follows.

【0097】まず、剰余乗算1回あたりの演算量を考え
る。最初の乗算で、1回の並列乗算が必要である。その
後のバレット・リダクションにより剰余を求める。
First, let us consider the amount of calculation per modular multiplication. The first multiplication requires one parallel multiplication. The remainder is calculated by the subsequent bullet reduction.

【0098】(ST21) 商を求めるのに、並列乗算
がk−1回、並列加算がk−1回必要である。また、基
底拡張に並列乗算がk+2回、並列加算が2(k+1)
回必要である。
(ST21) To obtain the quotient, k−1 parallel multiplications and k−1 parallel additions are required. In addition, the base extension is k + 2 times in parallel multiplication and 2 (k + 1) in parallel addition.
Need to be repeated.

【0099】(ST22) 並列乗算が1回必要であ
る。
(ST22) One parallel multiplication is required.

【0100】(ST23) 商を求めるのに、並列乗算
がk+1回、並列加算がk+1回必要であり、さらに基
底拡張に並列乗算がk回、並列加算が2(k−1)回必
要である。
(ST23) In order to obtain the quotient, k + 1 parallel multiplications and k + 1 parallel additions are required, and further base multiplication requires k parallel multiplications and 2 (k-1) parallel additions. .

【0101】(ST24) 並列乗算が1回必要であ
る。
(ST24) One parallel multiplication is required.

【0102】(ST25) 並列加算が1回必要であ
る。
(ST25) One parallel addition is required.

【0103】以上をまとめると、剰余乗算1回あたり、
並列乗算が4k+4回、並列加算が6k+1回必要であ
る。
Summarizing the above, per modular multiplication,
4k + 4 parallel multiplications and 6k + 1 parallel additions are required.

【0104】ここで、Nのビット数を、現在のRSA暗
号で用いられている1,024とし、剰余演算系の基底要素
の大きさを32ビットとする。このとき、k=33と取
れば1,024ビットの数が表現でき、また表現するための
最小のkであることが分かる。この値を上の式に代入す
ると、1回の剰余乗算あたり、並列乗算が137回、並
列加算が199回必要であることが分かる。
Here, the number of bits of N is 1,024 used in the current RSA encryption, and the size of the base element of the remainder operation system is 32 bits. At this time, if k = 33 is taken, it can be seen that a 1,024-bit number can be expressed, and that it is the minimum k for expressing. By substituting this value into the above equation, it can be seen that 137 parallel multiplications and 199 parallel additions are required per modular multiplication.

【0105】一般に乗算は、オペランドのビット長の2
乗に比例する時間がかかるので、32ビットの乗算は1,
024ビットの乗算の1/32=1/1,024の時間で処理
できる。そのため、1,024ビットの乗算に比べて剰余演
算系でのバレット・リダクションを用いた剰余乗算は約
137/1,024=0.13の時間で処理できる。
In general, multiplication is 2 bits of the operand bit length.
Since it takes time proportional to the power, 32-bit multiplication is 1,
It can be processed in 1/32 2 = 1 / 1,024 of multiplication of 024 bits. Therefore, the remainder multiplication using the bullet reduction in the remainder arithmetic system can be processed in about 137 / 1,024 = 0.13 as compared with the 1,024-bit multiplication.

【0106】ここで、加算は、乗算に比べて処理量が少
ないので無視した。また、この比較には1,024ビットで
の剰余算の時間は含まれていないので、ここで見積もっ
た0.13よりさらに小さな割合の時間で処理できるこ
とが期待できる。
Here, addition is ignored because it requires a smaller amount of processing than multiplication. In addition, since this comparison does not include the time of the remainder calculation with 1,024 bits, it can be expected that the processing can be performed in a smaller proportion of time than 0.13 estimated here.

【0107】なお、上記各実施形態に記載した手法は、
コンピュータに実行させることのできるプログラムとし
て、磁気ディスク(フロッピー(登録商標)ディスク、
ハードディスクなど)、光ディスク(CD−ROM、D
VDなど)、光磁気ディスク(MO)、半導体メモリな
どの記憶媒体に格納して頒布することもできる。
The method described in each of the above embodiments is
As a program that can be executed by a computer, a magnetic disk (floppy (registered trademark) disk,
Hard disk, etc., Optical disk (CD-ROM, D
It can be stored in a storage medium such as a VD), a magneto-optical disk (MO), a semiconductor memory or the like and distributed.

【0108】また、この記憶媒体としては、プログラム
を記憶でき、かつコンピュータが読み取り可能な記憶媒
体であれば、その記憶形式は何れの形態であっても良
い。
The storage medium may have any storage format as long as it can store the program and can be read by a computer.

【0109】また、記憶媒体からコンピュータにインス
トールされたプログラムの指示に基づきコンピュータ上
で稼働しているOS(オペレーティングシステム)や、
データベース管理ソフト、ネットワークソフト等のMW
(ミドルウェア)等が本実施形態を実現するための各処
理の一部を実行しても良い。
Also, an OS (operating system) running on the computer based on the instructions of the program installed in the computer from the storage medium,
MW such as database management software and network software
(Middleware) or the like may execute a part of each processing for realizing the present embodiment.

【0110】さらに、本発明における記憶媒体は、コン
ピュータと独立した媒体に限らず、LANやインターネ
ット等により伝送されたプログラムをダウンロードして
記憶または一時記憶した記憶媒体も含まれる。
Further, the storage medium in the present invention is not limited to a medium independent of a computer, but includes a storage medium in which a program transmitted via a LAN or the Internet is downloaded and stored or temporarily stored.

【0111】また、記憶媒体は1つに限らず、複数の媒
体から本実施形態における処理が実行される場合も本発
明における記憶媒体に含まれ、媒体構成は何れの構成で
あっても良い。
Further, the number of storage media is not limited to one, and the case in which the processing in this embodiment is executed from a plurality of media is also included in the storage media of the present invention, and the medium configuration may be any configuration.

【0112】尚、本発明におけるコンピュータは、記憶
媒体に記憶されたプログラムに基づき、本実施形態にお
ける各処理を実行するものであって、パソコン等の1つ
からなる装置、複数の装置がネットワーク接続されたシ
ステム等の何れの構成であっても良い。
The computer according to the present invention executes each processing in the present embodiment based on the program stored in the storage medium, and one device such as a personal computer or a plurality of devices are connected to the network. It may have any configuration such as an established system.

【0113】また、本発明におけるコンピュータとは、
パソコンに限らず、情報処理機器に含まれる演算処理装
置、マイコン等も含み、プログラムによって本発明の機
能を実現することが可能な機器、装置を総称している。
The computer in the present invention means
Not only a personal computer but also an arithmetic processing unit, a microcomputer, and the like included in an information processing device, which collectively refer to a device and a device that can realize the functions of the present invention by a program.

【0114】なお、本願発明は、上記各実施形態に限定
されるものでなく、実施段階ではその要旨を逸脱しない
範囲で種々に変形することが可能である。また、各実施
形態は可能な限り適宜組み合わせて実施してもよく、そ
の場合、組み合わされた効果が得られる。さらに、上記
各実施形態には種々の段階の発明が含まれており、開示
される複数の構成用件における適宜な組み合わせにより
種々の発明が抽出され得る。例えば実施形態に示される
全構成要件から幾つかの構成要件が省略されることで発
明が抽出された場合には、その抽出された発明を実施す
る場合には省略部分が周知慣用技術で適宜補われるもの
である。
The invention of the present application is not limited to the above-described embodiments, but can be variously modified at the stage of implementation without departing from the spirit of the invention. In addition, the respective embodiments may be implemented by being combined appropriately as far as possible, in which case the combined effects can be obtained. Further, the above-described embodiments include inventions at various stages, and various inventions can be extracted by appropriately combining a plurality of disclosed constituent requirements. For example, when the invention is extracted by omitting some of the constituent elements shown in the embodiment, when omitting the extracted invention, the omitted portions are appropriately supplemented by well-known and common techniques. It is something that will be done.

【0115】その他、本発明はその要旨を逸脱しない範
囲で種々変形して実施できる。
Besides, the present invention can be variously modified and implemented without departing from the gist thereof.

【0116】[0116]

【発明の効果】以上説明したように本発明によれば、剰
余演算系の基底の幾つかの要素の積が除算対象の場合
に、剰余演算系で除算を効率的に実行できる。
As described above, according to the present invention, when the product of some elements of the base of the remainder operation system is the object of division, the remainder operation system can efficiently perform the division.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の第1の実施形態に係る剰余演算装置の
主要部分の構成を示す模式図。
FIG. 1 is a schematic diagram showing a configuration of a main part of a remainder calculation device according to a first embodiment of the present invention.

【図2】同実施形態における動作を説明するための模式
図。
FIG. 2 is a schematic diagram for explaining an operation in the same embodiment.

【図3】同実施形態における動作の具体例を説明するた
めの模式図。
FIG. 3 is a schematic diagram for explaining a specific example of the operation in the same embodiment.

【図4】本発明の第2の実施形態に係る剰余演算装置の
主要部分の構成を示す模式図。
FIG. 4 is a schematic diagram showing a configuration of a main part of a remainder calculation device according to a second embodiment of the present invention.

【図5】同実施形態における基底拡張の適用を示す模式
図。
FIG. 5 is a schematic diagram showing application of base extension in the same embodiment.

【図6】同実施形態における基底拡張の適用を示す模式
図。
FIG. 6 is a schematic diagram showing application of base extension in the same embodiment.

【図7】本発明の第3の実施形態に係る剰余演算装置の
動作を説明するためのフローチャート。
FIG. 7 is a flowchart for explaining the operation of the remainder calculation device according to the third embodiment of the present invention.

【符号の説明】[Explanation of symbols]

10,10’…剰余演算装置 20〜20…演算ユニット 21〜21…ROM 22〜22…RAM 23〜23,23’〜23’…積和回路 30,30’…制御装置10, 10 '... Remainder arithmetic unit 20 1 to 20 n ... Arithmetic unit 21 1 to 21 n ... ROM 22 1 to 22 n ... RAM 23 1 to 23 n , 23 1 ' to 23 n '... Sum-of-products circuit 30, 30 '…Control device

Claims (16)

【特許請求の範囲】[Claims] 【請求項1】 剰余演算系の基底を{a,a,…,
}(nは整数)とし且つA=a…aとした
際に、{a,a,…,a}から任意に1つの基底
要素a(1≦i≦n)を選択し、このaの選択情報
及びA未満の正の整数xが入力されたとき、前記xをa
で除した商zを出力可能な、剰余演算機能を有する複
数の演算ユニットを備えた剰余演算装置において、 前記選択情報に基づいて、前記xの剰余演算系表現の各
値x,…,xから前記基底要素aに対応する値x
を減じるように、前記各演算ユニットを制御する減算
制御手段と、 前記減算制御手段により得られた各値(x−x),
…,(x−x)(但し、(x−x)を除く)に
対し、前記基底要素aの乗法逆元a -1を乗じるよう
に、前記各演算ユニットを制御する乗算制御手段と、 前記乗算制御手段により得られた乗算結果を商zとして
出力する出力手段と、 を備えたことを特徴とする剰余演算装置。
1. The basis of the remainder arithmetic system is {a 1 , a 2 , ...,
a n} when (n is an integer) as a and A = a 1 a 2 ... a n and, {a 1, a 2, ..., 1 single base element a i (1 ≦ i ≦ arbitrarily from a n} n) is selected, and when the selection information of a i and a positive integer x less than A are input, the x is a
In a residue arithmetic device having a plurality of arithmetic units having a residue arithmetic function capable of outputting a quotient z divided by i , based on the selection information, each value x 1 , ..., Of the residue arithmetic system expression of x, a value x corresponding to the base element a i from x n
subtraction control means for controlling each arithmetic unit so as to reduce i, and each value (x 1 −x i ) obtained by the subtraction control means,
, (X n −x i ) (excluding (x i −x i )) is multiplied by the multiplicative inverse element a i −1 of the base element a i , and each arithmetic unit is controlled. A modular multiplication device comprising: a multiplication control means; and an output means for outputting the multiplication result obtained by the multiplication control means as a quotient z.
【請求項2】 剰余演算系の基底を{a,a,…,
}(nは整数)とし且つA=a…aとした
際に、{a,a,…,a}から任意にk個(2≦
k≦n)の基底要素a,a,…を選択し、これらの
基底要素a,a,…の選択情報及びA未満の正の整
数xが入力されたとき、前記xをa・a・…で除し
た商zを出力可能な、剰余演算機能を有する複数の演算
ユニットを備えた剰余演算装置において、 前記選択された基底要素a,a,…のうち、いずれ
か1個の基底要素aを再選択する再選択手段と、 前記再選択手段により再選択された基底要素aに対応
する値xを、前記xの剰余演算系表現の各値x
…,xから減じるように、前記各演算ユニットを制御
する減算制御手段と、 前記減算制御手段により得られた各値(x−x),
…,(x−x)(但し、(x−x)を除く)に
対し、前記再選択された基底要素aの乗法逆元a -1
を乗じるように、前記各演算ユニットを制御する乗算制
御手段と、 前記選択された基底要素a,a,…の全てが前記再
選択手段、前記減算制御手段及び前記乗算制御手段によ
り順次処理されたとき、最後に再選択された基底要素に
関して前記乗算制御手段の制御により得られた乗算結果
を商zとして出力する出力手段と、 を備えたことを特徴とする剰余演算装置。
2. The basis of the remainder arithmetic system is {a 1 , a 2 , ...,
a n} when (n is an integer) as a and A = a 1 a 2 ... a n and, {a 1, a 2, ..., k pieces (2 ≦ arbitrarily from a n}
k ≦ n) basis elements a i , a j , ... Are selected, and when the selection information of these basis elements a i , a j ,. In a remainder arithmetic device having a plurality of arithmetic units having a remainder arithmetic function capable of outputting a quotient z divided by i · a j ···, any one of the selected base elements a i , a j ,. Reselecting means for reselecting one or more basis elements a h , and a value x h corresponding to the basis element a h reselected by the reselecting means for each value x 1 of the remainder arithmetic system expression of x. ,
..., subtraction control means for controlling each arithmetic unit so as to be subtracted from xn , and each value (x 1 −x i ) obtained by the subtraction control means,
, (X n −x i ) (excluding (x h −x h )), the multiplicative inverse element a h −1 of the reselected basis element a h.
Multiplication control means for controlling each arithmetic unit, and all of the selected base elements a i , a j , ... Are sequentially processed by the reselection means, the subtraction control means, and the multiplication control means. And a means for outputting the multiplication result obtained by the control of the multiplication control means with respect to the last reselected basis element as a quotient z.
【請求項3】 請求項1又は請求項2に記載の剰余演算
装置において、 前記基底は、2のべき又は2のべきに近接する値を用い
ることを特徴とする剰余演算装置。
3. The residue computing device according to claim 1, wherein the base uses a value of 2 or a value close to the power of 2.
【請求項4】 請求項1乃至請求項3のいずれか1項に
記載の剰余演算装置において、 前記商を、基底拡張によりn個の基底で表現するための
基底拡張手段を備えたことを特徴とする剰余演算装置。
4. The residue arithmetic device according to claim 1, further comprising a base extension unit for expressing the quotient with n bases by base extension. Remainder calculation device.
【請求項5】 請求項1乃至請求項4のいずれか1項に
記載の剰余演算装置において、 正の整数N及びx<Nを満たす整数xを入力としたと
き、x mod Nを出力するバレット・リダクションを
行うように、前記各演算ユニットを制御するバレット・
リダクション制御手段を備えたことを特徴とする剰余演
算装置。
5. The modulo arithmetic device according to claim 1, wherein when a positive integer N and an integer x satisfying x <N 2 are input, x mod N is output. A bullet that controls each of the arithmetic units to perform bullet reduction.
A residue calculation device comprising reduction control means.
【請求項6】 請求項1乃至請求項4のいずれか1項に
記載の剰余演算装置において、 正の整数N及びx<9Nを満たす整数xを入力とした
とき、x mod N、x mod N+N、またはx m
od N+2Nを出力するバレット・リダクションを行
うように、前記各演算ユニットを制御するバレット・リ
ダクション制御手段を備えたことを特徴とする剰余演算
装置。
6. The modulo arithmetic apparatus according to claim 1, wherein when positive integer N and integer x satisfying x <9N 2 are input, x mod N, x mod. N + N, or x m
A remainder arithmetic device comprising bullet reduction control means for controlling each arithmetic unit so as to perform a bullet reduction that outputs od N + 2N.
【請求項7】 請求項6に記載の剰余演算装置におい
て、 前記バレット・リダクション制御手段は、前記バレット
・リダクションのアルゴリズムが含まれる剰余乗算を行
うときに前記減算制御手段及び前記乗算制御手段を用い
て前記各演算ユニットを制御することを特徴とする剰余
演算装置。
7. The modulo arithmetic apparatus according to claim 6, wherein the bullet reduction control means uses the subtraction control means and the multiplication control means when performing modulo multiplication including the bullet reduction algorithm. The remainder computing device is characterized by controlling each of the computing units.
【請求項8】 請求項6に記載の剰余演算装置におい
て、 前記バレット・リダクション制御手段は、前記バレット
・リダクションのアルゴリズムが含まれる,べき乗剰余
算を行うときに前記減算制御手段及び前記乗算制御手段
を用いて前記各演算ユニットを制御することを特徴とす
る剰余演算装置。
8. The remainder arithmetic device according to claim 6, wherein the bullet reduction control means includes the bullet reduction algorithm, and the subtraction control means and the multiplication control means when performing modular exponentiation. A modular arithmetic unit characterized by controlling each said arithmetic unit using.
【請求項9】 剰余演算系の基底を{a,a,…,
}(nは整数)とし且つA=a…aとした
際に、{a,a,…,a}から任意に1つの基底
要素a(1≦i≦n)を選択し、このaの選択情報
及びA未満の正の整数xが入力されたとき、前記xをa
で除した商zを出力可能な、剰余演算機能を有する複
数の演算ユニットを用いる剰余演算方法において、 前記選択情報に基づいて、前記xの剰余演算系表現の各
値x,…,xから前記基底要素aに対応する値x
を減じるように、前記各演算ユニットを制御する減算
制御工程と、 前記減算制御工程により得られた各値(x−x),
…,(x−x)(但し、(x−x)を除く)に
対し、前記基底要素aの乗法逆元a -1を乗じるよう
に、前記各演算ユニットを制御する乗算制御工程と、 前記乗算制御工程により得られた乗算結果を商zとして
出力する出力工程と、を含んでいることを特徴とする剰
余演算方法。
9. The basis of the remainder operation system is {a 1 , a 2 , ...,
a n} when (n is an integer) as a and A = a 1 a 2 ... a n and, {a 1, a 2, ..., 1 single base element a i (1 ≦ i ≦ arbitrarily from a n} n) is selected, and when the selection information of a i and a positive integer x less than A are input, the x is a
In a residue calculation method using a plurality of calculation units having a residue calculation function capable of outputting a quotient z divided by i , each value x 1 , ..., X of the residue calculation system expression of x is based on the selection information. a value x corresponding to the base element a i from n
a subtraction control step of controlling each arithmetic unit so as to reduce i , each value (x 1 −x i ), obtained by the subtraction control step,
, (X n −x i ) (excluding (x i −x i )) is multiplied by the multiplicative inverse element a i −1 of the base element a i , and each arithmetic unit is controlled. A remainder calculation method comprising: a multiplication control step; and an output step of outputting the multiplication result obtained by the multiplication control step as a quotient z.
【請求項10】 剰余演算系の基底を{a,a
…,a}(nは整数)とし且つA=a…a
した際に、{a,a,…,a}から任意にk個
(2≦k≦n)の基底要素a,a,…を選択し、こ
れらの基底要素a ,a,…の選択情報及びA未満の
正の整数xが入力されたとき、前記xをa ・a・…
で除した商zを出力可能な、剰余演算機能を有する複数
の演算ユニットを用いる剰余演算方法において、 前記選択された基底要素a,a,…のうち、いずれ
か1個の基底要素aを再選択する再選択工程と、 前記再選択工程により再選択された基底要素aに対応
する値xを、前記xの剰余演算系表現の各値x
…,xから減じるように、前記各演算ユニットを制御
する減算制御工程と、 前記減算制御工程により得られた各値(x−x),
…,(x−x)(但し、(x−x)を除く)に
対し、前記再選択された基底要素aの乗法逆元a -1
を乗じるように、前記各演算ユニットを制御する乗算制
御工程と、 前記選択された基底要素a,a,…の全てが前記再
選択工程、前記減算制御工程及び前記乗算制御工程によ
り順次処理されたとき、最後に再選択された基底要素に
関して前記乗算制御工程の制御により得られた乗算結果
を商zとして出力する出力工程と、 を含んでいることを特徴とする剰余演算方法。
10. A base of a remainder arithmetic system is {a1, ATwo
…, An} (N is an integer) and A = a1aTwo... anWhen
When doing, {a1, ATwo, ..., an} Arbitrarily k
(2 ≦ k ≦ n) basis element ai, Aj,… Is selected,
Their base element a i, Aj, ... selection information and less than A
When a positive integer x is input, the x is a i・ Aj・ ・ ・ ・
Plural with remainder calculation function that can output the quotient z divided by
In the remainder calculation method using the calculation unit of The selected base element ai, Aj,, of which
Or one base element ahA reselection step of reselecting The base element a reselected by the reselection stephCorresponding to
Value xhIs the value x of the remainder arithmetic expression of x1
…, XnControl each arithmetic unit to reduce
A subtraction control step to Each value (x1-Xi),
…, (Xn-Xi) (However, (xh-Xh) Except)
On the other hand, the reselected base element ahMultiplicative inverse element ah -1
Multiplying control that controls each of the arithmetic units so that
Your process, The selected base element ai, Aj,… All of the above
The selection step, the subtraction control step, and the multiplication control step
The last reselected base element when processed sequentially
Regarding the multiplication result obtained by the control of the multiplication control step
An output step for outputting as a quotient z, A remainder calculation method comprising:
【請求項11】 請求項9又は請求項10に記載の剰余
演算方法において、 前記基底は、2のべき又は2のべきに近接する値を用い
ることを特徴とする剰余演算方法。
11. The remainder calculation method according to claim 9 or 10, wherein the base is a power of 2 or a value close to a power of 2.
【請求項12】 請求項9乃至請求項11のいずれか1
項に記載の剰余演算方法において、 前記商を、基底拡張によりn個の基底で表現するための
基底拡張工程を含んでいることを特徴とする剰余演算方
法。
12. The method according to any one of claims 9 to 11.
The remainder calculation method according to the paragraph (4), including a base extension step for expressing the quotient with n bases by base extension.
【請求項13】 請求項9乃至請求項12のいずれか1
項に記載の剰余演算方法において、 正の整数N及びx<Nを満たす整数xを入力としたと
き、x mod Nを出力するバレット・リダクションを
行うように、前記各演算ユニットを制御するバレット・
リダクション制御工程を含んでいることを特徴とする剰
余演算方法。
13. The method according to any one of claims 9 to 12.
In the remainder arithmetic method described in the paragraph, when a positive integer N and an integer x that satisfies x <N 2 are input, a bullet for controlling each arithmetic unit to perform a bullet reduction that outputs x mod N.・
A residue calculation method comprising a reduction control step.
【請求項14】 請求項9乃至請求項12のいずれか1
項に記載の剰余演算方法において、 正の整数N及びx<9Nを満たす整数xを入力とした
とき、x mod N、x mod N+N、またはx m
od N+2Nを出力するバレット・リダクションを行
うように、前記各演算ユニットを制御するバレット・リ
ダクション制御工程を含んでいることを特徴とする剰余
演算方法。
14. The method according to any one of claims 9 to 12.
In the remainder calculation method described in the paragraph, when a positive integer N and an integer x satisfying x <9N 2 are input, x mod N, x mod N + N, or x m
A remainder arithmetic method comprising: a bullet reduction control step of controlling each arithmetic unit so as to perform a bullet reduction that outputs od N + 2N.
【請求項15】 請求項14に記載の剰余演算方法にお
いて、 前記バレット・リダクション制御工程は、前記バレット
・リダクションのアルゴリズムが含まれる剰余乗算を行
うときに前記減算制御工程及び前記乗算制御工程を用い
て前記各演算ユニットを制御することを特徴とする剰余
演算方法。
15. The remainder calculation method according to claim 14, wherein the bullet reduction control step uses the subtraction control step and the multiplication control step when performing remainder multiplication including the bullet reduction algorithm. And controlling each of the arithmetic units.
【請求項16】 請求項14に記載の剰余演算方法にお
いて、 前記バレット・リダクション制御工程は、前記バレット
・リダクションのアルゴリズムが含まれる,べき乗剰余
算を行うときに前記減算制御工程及び前記乗算制御工程
を用いて前記各演算ユニットを制御することを特徴とす
る剰余演算方法。
16. The remainder calculation method according to claim 14, wherein the bullet reduction control step includes the bullet reduction algorithm, and the subtraction control step and the multiplication control step are performed when performing modular exponentiation. Controlling each of the arithmetic units by using
JP2002017285A 2002-01-25 2002-01-25 Remainder calculation apparatus and method Expired - Fee Related JP4080754B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002017285A JP4080754B2 (en) 2002-01-25 2002-01-25 Remainder calculation apparatus and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002017285A JP4080754B2 (en) 2002-01-25 2002-01-25 Remainder calculation apparatus and method

Publications (2)

Publication Number Publication Date
JP2003216032A true JP2003216032A (en) 2003-07-30
JP4080754B2 JP4080754B2 (en) 2008-04-23

Family

ID=27653032

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002017285A Expired - Fee Related JP4080754B2 (en) 2002-01-25 2002-01-25 Remainder calculation apparatus and method

Country Status (1)

Country Link
JP (1) JP4080754B2 (en)

Also Published As

Publication number Publication date
JP4080754B2 (en) 2008-04-23

Similar Documents

Publication Publication Date Title
US7904498B2 (en) Modular multiplication processing apparatus
TW550498B (en) Method and apparatus for modular multiplying and calculating unit for modular multiplying
CN115344237B (en) Data processing method combining Karatsuba and Montgomery modular multiplication
JP2005250481A (en) Extended montgomery modular multiplier supporting multiple precision
Patronik et al. Design of Reverse Converters for General RNS Moduli Sets $\{2^{k}, 2^{n}-1, 2^{n}+ 1, 2^{n+ 1}-1\} $ and $\{2^{k}, 2^{n}-1, 2^{n}+ 1, 2^{n-1}-1\} $($ n $ even)
US5261001A (en) Microcircuit for the implementation of RSA algorithm and ordinary and modular arithmetic, in particular exponentiation, with large operands
KR100591761B1 (en) Montgomery Modular Multiplication Method Using Montgomery Modular Multiplier and Carry Store Addition
Kaihara et al. Bipartite modular multiplication method
KR100744216B1 (en) Device and method for calculating a multiplication involving a shifting of the multiplicand
US8417760B2 (en) Device and method for calculating a multiplication addition operation and for calculating a result of a modular multiplication
Großschädl A bit-serial unified multiplier architecture for finite fields GF (p) and GF (2 m)
JP3532860B2 (en) Arithmetic device, method, and program using remainder representation
Patronik et al. Design of Reverse Converters for the New RNS Moduli Set $\{2^{n}+ 1, 2^{n}-1, 2^{n}, 2^{n-1}+ 1\} $($ n $ odd)
Erle et al. Decimal floating-point multiplication
JP2004519017A (en) Method and apparatus for multiplying coefficients
US8364740B2 (en) Device and method for calculating a result of a modular multiplication with a calculating unit smaller than the operands
US6662201B1 (en) Modular arithmetic apparatus and method having high-speed base conversion function
Feng et al. A high performance FPGA implementation of 256-bit elliptic curve cryptography processor over GF (p)
JP3660075B2 (en) Dividing device
US20020161810A1 (en) Method and apparatus for multiplication and/or modular reduction processing
JP2003216032A (en) Device and method for operating residue
JP4202701B2 (en) Polynomial residue arithmetic unit, method and program
KR20040045152A (en) Apparatus for modular multiplication
Wu et al. Improved RNS Montgomery modular multiplication with residue recovery
Prema et al. Enhanced high speed modular multiplier using Karatsuba algorithm

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050114

A131 Notification of reasons for refusal

Effective date: 20071218

Free format text: JAPANESE INTERMEDIATE CODE: A131

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20071228

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20080205

A61 First payment of annual fees (during grant procedure)

Effective date: 20080207

Free format text: JAPANESE INTERMEDIATE CODE: A61

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110215

Year of fee payment: 3

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110215

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees