JP3332270B2 - Exponentiation unit - Google Patents

Exponentiation unit

Info

Publication number
JP3332270B2
JP3332270B2 JP19349693A JP19349693A JP3332270B2 JP 3332270 B2 JP3332270 B2 JP 3332270B2 JP 19349693 A JP19349693 A JP 19349693A JP 19349693 A JP19349693 A JP 19349693A JP 3332270 B2 JP3332270 B2 JP 3332270B2
Authority
JP
Japan
Prior art keywords
integer
storage means
result
data
exponentiation
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 - Fee Related
Application number
JP19349693A
Other languages
Japanese (ja)
Other versions
JPH0749769A (en
Inventor
光 森田
正幸 阿部
英一郎 藤崎
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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone 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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP19349693A priority Critical patent/JP3332270B2/en
Publication of JPH0749769A publication Critical patent/JPH0749769A/en
Application granted granted Critical
Publication of JP3332270B2 publication Critical patent/JP3332270B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明は、0≦A≦N−1なる関
係がある複数ビットで表現される整数AとN、ならびに
複数ビットで表現される整数Bにおける、AB modN
なるべき乗剰余演算を実行するとき有用な、べき乗演算
装置に関する。さらに、本発明は、複数ビットで表現さ
れる0以外の実数Aと整数Bにより、AB なるべき乗演
算を実行するとき有用な、べき乗演算装置に関する。
The present invention relates, in 0 ≦ A ≦ N-1 becomes relation integers A and N represented by a plurality of bits and the integer B represented by a plurality of bits,, A B modN
The present invention relates to an exponentiation device useful when performing a modular exponentiation operation. Further, the present invention relates to a power operation device useful when performing a power operation of A B by a real number A other than 0 and an integer B represented by a plurality of bits.

【0002】[0002]

【従来の技術】AB またはAB modNなどのべき乗演
算は、基本的には乗算(積X×Yを求める)または剰余
乗算(積X×YmodNを求める)を繰り返して実行さ
れ、べきの指数部Bの桁数が大きくなると、単純な乗算
または剰余乗算の繰り返し回数の増大が高速化を妨げる
要因となる。 (従来法1)〔参考資料;森田:「暗号技術と高速算
法」,情報処理,Vol.34,No.3,pp.34
1,平成5年3月」 そこで、整数Bをbi からなるビットに分解し、AB
odNのべき乗剰余演算を高速化する手法が提案され
た。手順は、図4に示す様に、bi に対応させて、X×
XmodN,X×AmodNを組み合わせ、剰余乗算の
実行回数をBの桁数程度に削減する。図5に示す様に、
装置上では、整数A,B,Nのデータが入力され、それ
ぞれの記憶手段AR,BR,NRに蓄積する。前記整数
AまたはXから選択し整数Yを出力する選択手段SEL
と、演算途中結果の整数Xを蓄積する記憶手段XRと、
これらの記憶手段XR,NRと選択手段SELの各々の
出力から剰余乗算手段SMがX×YmodNを実行し、
得られた出力で記憶手段XRのデータを更新する。選択
手段SELをはじめ各部を制御する制御手段CNTは、
記憶手段BRに蓄積されるbi の値に従い、図4におけ
るX×XmodNまたはX×AmodNなどの実行の順
序を制御する。
The exponentiation of 2. Description of the Related Art] A B or A B modN, runs essentially multiplies (determining the product X × Y) or (obtaining the product X × YmodN) modular multiplication repeatedly and should exponent As the number of digits of the part B increases, the increase in the number of times of simple multiplication or remainder multiplication becomes a factor that hinders speeding up. (Conventional method 1) [Reference material; Morita: "Cryptographic Technology and High-Speed Algorithm", Information Processing, Vol. 34, no. 3, pp. 34
1, March 1993] Then, the integer B is decomposed into bits consisting of b i and A B m
A method has been proposed for speeding up the modular exponentiation of oddN. Procedure, as shown in FIG. 4, corresponding to b i, X ×
By combining XmodN and X × AmodN, the number of executions of the remainder multiplication is reduced to about the number of B digits. As shown in FIG.
On the apparatus, data of integers A, B, and N are input and stored in respective storage means AR, BR, and NR. Selection means SEL for selecting an integer A or X and outputting an integer Y
Storage means XR for accumulating an integer X resulting from the operation,
The remainder multiplication means SM executes X × YmodN from the outputs of these storage means XR and NR and the selection means SEL,
The data in the storage means XR is updated with the obtained output. The control unit CNT that controls each unit including the selection unit SEL includes:
As the value of b i stored in the storage unit BR, controls the order of execution, such as X × XmodN or X × AmodN in FIG.

【0003】RSA(Rivest−Shamir−A
dleman)などの暗号分野で用いられるべき乗剰余
演算AB modNは、0≦A,B≦N−1の関係があ
り、Nは512ビット程度が採用されることが多い。こ
の様な場合、Bも512ビットとするとX×XmodN
なる剰余乗算が511回、X×AmodNなる剰余乗算
に最大511回、平均255回が必要となる。従って、
剰余乗算が最大1022回、平均766回必要になる。
一般には、指数部Bのビット数をmとするとき、最大2
(m−1)回の剰余乗算、平均3(m−1)/2回の剰
余乗算が必要となる。
[0003] RSA (Rivest-Shamir-A)
The modular exponentiation operation A B modN used in the cryptographic field such as dleman) has a relationship of 0 ≦ A, B ≦ N−1, and N is often about 512 bits. In such a case, if B is also 512 bits, X × XmodN
The remainder multiplication 511 times, and the remainder multiplication X × AmodN requires a maximum of 511 times and an average of 255 times. Therefore,
It requires a maximum of 1022 modular multiplications and an average of 766.
Generally, when the number of bits of the exponent part B is m, a maximum of 2
(M-1) remainder multiplications and an average of 3 (m-1) / 2 remainder multiplications are required.

【0004】以上、べき乗剰余演算AB modNを対象
に説明したが、Bのビット数mと剰余乗算回数との関係
は、べき乗演算AB における、Bのビット数mと乗算回
数との関係にも同様のことが成り立つ。但し、べき乗演
算AB は、法N内に途中結果が収まるべき乗剰余演算A
B modNと異なり、途中結果の桁数が増大するので、
仮数部と指数部を分ける近似的な表現が取られることが
多い。 (従来法2)〔参考資料;Brickell,E.
F.:“A Fast Modular Multip
lication Algorithm withAp
plication to Two Key Cryp
tography,Advances in Cryp
tology−CRYPTO′82,pp.51−6
0,Plenum(1983)〕 剰余乗算の回数を少しでも減らそうとして開発されたの
が従来法2である。手順を図6に示す。そこで、Bをb
i からなるビット列対応に分解し、そのビットで1が立
つ回数が半分を越えるとき、剰余逆元A-1modNを求
め、繰り返しの演算では、半分より少ない筈のbi =0
がある時とほぼ同じ回数だけ、XとA-1modNとの剰
余乗算を実行する。逆に、そのビットで1が立つ回数が
半分以下のときは従来法1と同じ処理を行う。
Although the above description has been made with respect to the modular exponentiation operation A B modN, the relationship between the number of bits m of B and the number of modular multiplications is related to the relationship between the number of bits m of B and the number of multiplications in the exponentiation operation A B. The same holds true. However, the exponentiation operation A B is a modular exponentiation operation A in which the intermediate result must fit within the modulus N.
Unlike B modN, the number of digits in the intermediate result increases,
An approximate expression that separates the mantissa and the exponent is often used. (Conventional method 2) [Reference material; Brickell, E .;
F. : "A Fast Modular Multip
ligation Algorithm with Ap
application to Two Key Crypto
toggle, Advances in Cryp
policy-CRYPTO'82, pp. 51-6
0, Plenum (1983)] Conventional method 2 was developed to reduce the number of times of remainder multiplication as much as possible. The procedure is shown in FIG. So, let B be b
When the number of occurrences of 1 at that bit exceeds half, the remainder inverse A -1 mod N is obtained. In the repetitive operation, b i = 0, which should be less than half, is obtained.
The remainder multiplication of X and A -1 mod N is performed almost as many times as there are times. Conversely, if the number of times 1 is set at that bit is less than half, the same processing as the conventional method 1 is performed.

【0005】図7に示す装置上で図6の処理を実行する
場合、整数A,B,Nが記憶手段A(AI)R,BR,
NRに入力され、制御手段CNTにBの“1”の値を持
つビット数の大小を判定させ、“1”が多い場合、Xの
記憶手段XRに整数Aを設定したあと、装置外から剰余
逆元A-1modN=AIを記憶手段A(AI)Rに読み
込み、図4と同様の手順で実行する。装置に剰余逆元手
段がある場合、内部的に記憶手段A(AI)Rのデータ
をAからAI=A-1modNに書き換える。
When the processing shown in FIG. 6 is executed on the apparatus shown in FIG. 7, integers A, B, and N are stored in storage means A (AI) R, BR,
NR, the control means CNT determines the size of the number of bits having the value of "1" of B. If the number of "1" s is large, the integer A is set in the storage means XR of X, and the remainder is set from outside the apparatus. The inverse element A -1 modN = AI is read into the storage means A (AI) R, and executed in the same procedure as in FIG. If the device has a remainder inverse unit, the data of the storage unit A (AI) R is internally rewritten from A to AI = A -1 modN.

【0006】Bが512ビットとすると、X×Xmod
Nなる剰余乗算が511回、X×AmodNなる剰余乗
算に最大255回が必要となる。従って、剰余乗算が最
大766回が必要になる。一般には、指数部Bのビット
数をmとするとき、最大3(m−1)/2回の剰余乗算
が必要となる。同様に、べき乗演算AB を求める際、仮
数部と指数部を分ける近似的な表現が必要であるが、上
記剰余逆元A-1modNを1/Aに置き換えることで、
同様の乗算回数の削減が可能である。
If B is 512 bits, X × Xmod
N modulo multiplications require 511 times and X × AmodN modulo multiplications require a maximum of 255 times. Therefore, a maximum of 766 remainder multiplications are required. In general, when the number of bits of the exponent part B is m, a maximum of 3 (m-1) / 2 remainder multiplications is required. Similarly, when calculating the exponentiation operation A B , an approximate expression for separating the mantissa part and the exponent part is necessary. By replacing the remainder inverse element A −1 modN with 1 / A,
A similar reduction in the number of multiplications is possible.

【0007】以上の様に、従来法では、べき乗剰余にお
ける剰余乗算の回数、べき乗における乗算の回数を削減
するため、指数部をビット単位に行う手法、逆元(剰余
逆元または逆数)を利用する手法が利用されて来た。
As described above, in the conventional method, in order to reduce the number of times of modular multiplication in the power-residue and the number of times of multiplication in the exponentiation, a method of performing an exponent part in units of bits and an inverse element (residual inverse element or inverse number) are used. Techniques have been used.

【0008】[0008]

【発明が解決しようとする課題】従来法2は最大の乗算
回数を削減する効果が有った。しかし、最大の乗算回数
は、Bにおけるmビットが(コインなげで表または裏を
出すベルヌーイ試行と同様に)0又は1にランダムに分
布している場合、1の生起確率は2項分布に従っている
から、X×AmodNなる剰余乗算の所要回数は最大m
であっても、平均はm/2近傍にある。この為、従来法
2は従来法1に比べ改良の効果が少なく、逆に逆元を演
算するのに要する時間が付加されるので有効ではなかっ
た。
The conventional method 2 has the effect of reducing the maximum number of multiplications. However, the maximum number of multiplications is that if m bits in B are randomly distributed 0 or 1 (similar to a Bernoulli trial that flips front or back with no coins), the occurrence probability of 1 follows a binomial distribution. From the above, the required number of remainder multiplications of X × AmodN is at most m
, The average is near m / 2. For this reason, the conventional method 2 is less effective than the conventional method 1 in that the time required for calculating the inverse is added.

【0009】本発明の目的は、べき乗剰余演算AB mo
dNにおいて、剰余逆元A-1modNにより、剰余乗算
の最大回数ばかりでなく、平均回数も削減を図り、高速
なべき乗演算装置を提供することにある。また、同様
に、べき乗演算AB においては、逆数1/Aにより、乗
算の最大回数ばかりでなく、平均回数も削減を図り、高
速なべき乗演算装置を提供することにある。
An object of the present invention is to provide a modular exponentiation operation A B mo
An object of the present invention is to provide a high-speed exponentiation device that reduces not only the maximum number of modular multiplications but also the average number of modular multiplications by using a modular inverse A −1 modN in dN. Similarly, in the exponentiation operation A B , not only the maximum number of multiplications but also the average number is reduced by the reciprocal 1 / A to provide a high-speed exponentiation device.

【0010】[0010]

【課題を解決するための手段】上記目的を達成するため
に、本発明は、べき乗剰余AB modNまたはべき乗演
算AB において、数Aに対する逆元であるA-1modN
または1/Aを利用するとともに、指数部Bを基数4、
つまりバイナリ−コード2ビット分の符号付冗長表現に
コード変換する機構により、乗算に要する平均回数を削
減できるべき乗演算装置を提供する。
To achieve the above object of the Invention The present invention provides a modular exponentiation A B modN or exponentiation A B, A -1 modN is inverse to the number A
Or use 1 / A and add exponent B to base 4,
That is, a power operation device capable of reducing the average number of times required for multiplication by a mechanism for converting a code into a binary redundant 2-bit signed representation is provided.

【0011】[0011]

【作用】べき乗剰余演算AB modNまたはべき乗演算
B において、指数部Bがm個の0または1からなるビ
ット列(bm-1 ,bm-2 ,bm-3 ,…b1 ,b0 )で表
現されているとする。この時、降順にビット列を、0,
1、または−1の何れかからなるb′i に関するビット
列(b′m ,…b′i ,…b′1 ,b′0 )に変換する
(方法は請求項および,説明は後述する)。
[Action] In the modular exponentiation A B modN or exponentiation A B, the bit string exponent B consists of m 0 or 1 (b m-1, b m-2, b m-3, ... b 1, b 0 ). At this time, the bit string is set to 0,
1 or consisting of any of -1 b 'bit string related to i (b' m, ... b 'i, ... b' 1, b '0) to convert (method according to claim 1 and 3, description will be described later ).

【0012】こうすることにより、b′2j+1とb′2j
ら成る2桁を単位に考えると、Bに関して非0の値が、
従来は最大2回平均1回であったものが、最大1回平均
3/4回となる。この結果、図4の従来法1では、bi
=1でX×AmodNを実行させたのに対し、本変換後
では、b′i =1のときX×AmodN、b′1 =−1
のときX×A-1modNを実行することにより、Bに関
して非0の値の減少が、全体の乗算回数の減少として反
映できる。なお、ここで使われるA-1modNは初期状
態において求め、記憶手段に蓄積する。
By doing so, considering the two digits consisting of b ′ 2j + 1 and b ′ 2j as a unit, a non-zero value for B is
In the past, the average was once at a maximum of two times, but the average is one-third of the maximum at one time. As a result, in the conventional method 1 of FIG. 4, b i
= 1, whereas X × AmodN is executed when b ′ i = 1 after this conversion, X × AmodN, b ′ 1 = −1
By executing X × A −1 modN at the time of, the decrease in the value of non-zero with respect to B can be reflected as the decrease in the total number of multiplications. Note that A -1 modN used here is obtained in the initial state and is stored in the storage means.

【0013】[0013]

【実施例】図2に、本発明のべき乗演算装置の動作フロ
ーチャートを示す(請求項5に対応)。べき乗剰余演算
B modNにおいて、予め、整数Aの剰余逆元A-1
odNを求め、その値を整数AIと置く。変数Xは1に
初期化し、変数iはBのビット数mに初期化し(ステッ
プS1 )、以下の演算をm+1回繰り返す。
FIG. 2 is a flowchart showing the operation of the exponentiation device according to the present invention (corresponding to claim 5). In the modular exponentiation operation A B modN, the modular inverse A −1 m of the integer A is determined in advance.
Find o dN and place that value as the integer AI. The variable X is initialized to 1, the variable i is initialized to the bit number m of B (step S 1 ), and the following operation is repeated m + 1 times.

【0014】ステップS2 でi≧0のとき、XをX×X
modNで更新し(ステップS3 )、ステップS4
b′i の1,0,−1を判定し、bi ′=1の時、Xを
X×AmodNで更新し(ステップS5 )、bi ′=−
1の時、XをX×AImodNで更新する(ステップS
6 )。なお、X=1の時は自乗してもX×XmodN=
1なので、これを検出することにより剰余乗算を不要に
できる。以下の議論では、この様な初期の剰余乗算はそ
の回数に含めない。
If i ≧ 0 in step S 2 , X is X × X
updated at modN (Step S 3), b in step S 4 '1, 0 of the i, determines -1, b i' when = 1, and updates the X in X × AmodN (Step S 5), b i ′ = −
At the time of 1, X is updated by X × AImodN (step S
6 ). In addition, when X = 1, even if it is squared, X × XmodN =
Since it is 1, by detecting this, remainder multiplication can be made unnecessary. In the following discussion, such an initial remainder multiplication will not be included in the number.

【0015】以上のべき乗剰余演算AB modNの処理
において、AI=A-1modNをAI=1/Aに、X×
AmodNをX×Aに、X×AImodNをX×AIに
置き換えることよりべき乗演算AB が実行できる(請求
)。しかし、Aは0以外の実数とされる。m個の0
または1からなるビット列(bm-1 ,bm-2 ,bm-3
…b1 ,b0)で表現されている指数部Bを、以下の様
に、0、1、または−1からなるビット列(b′m
b′m-1 ,b′m-2 ,…b′1 ,b′0 )を生成し、非
0のビットの生起確率を削減する。j(jは0または正
の整数で、mが偶数ならj≦m/2、mが奇数からj≦
(m−1)/2)に関して、降順にビット列を以下の様
に変換する(請求項)。
In the above processing of the modular exponentiation operation A B modN, AI = A −1 mod N is set to AI = 1 / A, and X ×
The AmodN to X × A, the X × AImodN can perform exponentiation A B than to replace the X × AI (claim 3). However, A is a real number other than 0. m zeros
Or a bit string consisting of 1 (b m−1 , b m−2 , b m−3 ,
.. B 1 , b 0 ) is converted into a bit string (b ′ m ,
b ′ m−1 , b ′ m−2 ,... b ′ 1 , b ′ 0 ) to reduce the probability of occurrence of non-zero bits. j (j is 0 or a positive integer; if m is an even number, j ≦ m / 2;
Regarding (m-1) / 2), the bit string is converted as follows in the descending order (claim 1 ).

【数3】 しかし、必ずしも上記のテーブルを参照しなくても、
b′i を必要の都度、 b′2j+1←(−1) b2j+1 {(1−b2j+1)b2j2j-1+b2j+1(1−b2j) (1−b2j-1)}, b′2j←(−1)b2j+1 {(1−b2j)b2j-1+b2j(1−b2j-1)} の様に関数に基づき変換して使用することも可能である
(請求項)。
(Equation 3) However, without necessarily referencing the table above,
Each time b ′ i is required, b ′ 2j + 1 ← (−1) b2j + 1 {(1-b 2j + 1 ) b 2j b 2j-1 + b 2j + 1 (1-b 2j ) (1-b 2j-1 )}, b ' 2j ← (-1) b2j + 1 {(1-b 2j ) b 2j-1 + b 2j (1-b 2j-1 )} It is also possible (claim 5 ).

【0016】図1に、本発明のべき乗演算装置の実施例
を示す。整数A,AI,B,Nは装置外部より得られる
とし、各々対応する記憶手段AR,AIR,BR,NR
に蓄積される。演算途中結果の整数Xを記憶する記憶手
段XR及びX,AI,A,のいずれかを選択する選択手
段SEL及び剰余乗算手段SM等が設けられる(請求項
1)。
FIG. 1 shows an embodiment of a power operation device according to the present invention. The integers A, AI, B, and N are assumed to be obtained from outside the apparatus, and the corresponding storage means AR, AIR, BR, NR
Is accumulated in There are provided storage means XR for storing the integer X resulting from the operation and a selection means SEL for selecting any of X, AI, A, and a remainder multiplication means SM (claim 1).

【0017】なお、コード変換手段CCは、必要に応じ
てb′i を生成し出力する。制御手段CNTはb′i
値により、選択手段SELの出力を切り替えることによ
り、X×YmodNを実行する剰余乗算手段SMにX×
XmodN,X×AmodN,またはX×AImodN
の処理を実行させる。なお、繰り返し演算に先立ち予め
全てのb′i を生成し、それでBを更新することも可能
である。
[0017] Incidentally, the code conversion unit CC generates and outputs a b 'i if necessary. The control unit CNT switches the output of the selection unit SEL according to the value of b ′ i , so that the remainder multiplication unit SM executing X × YmodN performs X ×
XmodN, X × AmodN, or X × AImodN
Is executed. Note that it is also possible to generate all b ′ i in advance of the repetitive operation and update B with that.

【0018】図3に、本発明のべき乗演算装置の第2の
実施例を示す。整数A,B,Nは装置外部より得られる
とし、各々対応する記憶手段AR,BR,NRに蓄積さ
れる。また、繰り返し演算に先立ち、A-1modNが剰
余逆元手段SIにより生成され、整数AIとして記憶手
段AIRに蓄積される。その他は図1と同様である(請
求項2)。
FIG. 3 shows a second embodiment of the exponentiation arithmetic unit according to the present invention. It is assumed that the integers A, B, and N are obtained from outside the apparatus, and are stored in the corresponding storage means AR, BR, and NR, respectively. Prior to the repetitive operation, A -1 modN is generated by the remainder inverse means SI and stored in the storage means AIR as an integer AI. Others are the same as FIG. 1 (claim 2).

【0019】以上の説明では、X×YmodNを実行す
る剰余乗算手段SMおよびA-1modNを実行する剰余
逆元手段SIを備えることによりAB modNなるべき
乗演算を実行する場合を示したが、X×YmodNを実
行する剰余乗算手段SMをX×Yを実行する乗算手段
に、A-1modNを実行する剰余逆元手段SIを1/A
を実行する除算手段に置き換え、Aを0以外の実数とす
ることによりAB なるべき乗演算を実行することが可能
となる。なお、1/Aを実行する除算手段がべき乗演算
装置外部に存する場合と(請求項3)、内蔵する場合が
ある(請求項4)。
In the above description, a case has been described in which a power modulo operation of A B mod N is executed by providing the remainder multiplication means SM for executing X × Y mod N and the remainder inverse means SI for executing A -1 mod N. The remainder multiplication means SM executing X × Y mod N is replaced by the multiplication means executing X × Y, and the remainder inverse means SI executing A -1 mod N is replaced by 1 / A
, And by setting A to be a real number other than 0, it is possible to execute a power exponentiation of A B. The dividing means for performing 1 / A may be provided outside the exponentiation device (claim 3) or may be provided internally (claim 4).

【0020】[0020]

【発明の効果】以上の説明から明らかに、本発明によれ
ば以下の様な効果が得られる。 (1)剰余乗算回数の比較に於て、 最大 平均 従来法1 2(m−1) 3(m−1)/2 従来法2 3(m−1)/2 3(m−1)/2以下の近傍 本発明 3(m−1)/2 11(m−1)/8 であるから、平均的に約(m−1)/8回剰余乗算回数
を削減できる。従って、約8%の処理速度改善効果があ
る。 (2)指数部Bを基数4符号付コードへ変換するには、
隣接3ビットを参照することで、テーブルまたは関数を
用いて容易に実行できる。このため、従来法2に利用さ
れる装置とほぼ同じ構成のまま、僅かな処理を付け加え
ることで高速化を達成できる。
As apparent from the above description, the following effects can be obtained according to the present invention. (1) In the comparison of the number of remainder multiplications, the maximum average Conventional method 12 (m-1) 3 (m-1) / 2 Conventional method 23 (m-1) / 2 3 (m-1) / 2 The following neighborhood: The present invention is 3 (m-1) / 2 11 (m-1) / 8, so that the number of times of modular multiplication by about (m-1) / 8 can be reduced on average. Therefore, there is an effect of improving the processing speed by about 8%. (2) To convert the exponent part B into a radix-4 signed code,
By referring to the adjacent three bits, it can be easily executed using a table or a function. For this reason, high speed can be achieved by adding a small amount of processing while keeping the same configuration as the apparatus used in the conventional method 2.

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

【図1】請求項1の発明の実施例を示すブロック図。FIG. 1 is a block diagram showing an embodiment of the present invention.

【図2】図1及び図3の動作フローチャート。FIG. 2 is an operation flowchart of FIGS. 1 and 3;

【図3】請求項2の発明の実施例を示すブロック図。FIG. 3 is a block diagram showing an embodiment of the invention of claim 2;

【図4】従来の第1のべき乗演算装置の動作フローチャ
ート。
FIG. 4 is an operation flowchart of a conventional first exponentiation operation device.

【図5】図4の従来の第1のべき乗演算装置のブロック
図。
FIG. 5 is a block diagram of the first conventional power operation device of FIG. 4;

【図6】従来の第2のべき乗演算装置の動作フローチャ
ート。
FIG. 6 is an operation flowchart of a second conventional power operation device.

【図7】図6の従来の第2のべき乗演算装置のブロック
図。
FIG. 7 is a block diagram of the second conventional power operation device of FIG. 6;

フロントページの続き (56)参考文献 特開 平2−141790(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 7/52 G06F 7/552 G09C 1/00 620 (56) References JP-A-2-141790 (JP, A) (58) Fields investigated (Int. Cl. 7 , DB name) G06F 7/52 G06F 7/552 G09C 1/00 620

Claims (5)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 0≦A≦N−1なる関係がある複数ビッ
トで表現される整数AとN、ならびに複数ビットで表現
される整数Bで、AB mod Nなるべき乗剰余演算を実行
するべき乗演算装置において、 前記整数A,B,Nを表現する複数ビットの入力データ
をそれぞれ記憶する記憶手段AR,BR,NRと、 演算途中結果の整数Xを記憶する記憶手段XRと、 前記整数Aの剰余逆元(整数)AI=A-1modNを記
憶する記憶手段AIRと、 前記記憶手段AR,XR,AIRから入力される前記整
数A,X,AIから一つの整数Yを選択する選択手段
と、 前記記憶手段XR,NRから得られる整数X,N,なら
びに前記選択手段が出力する整数Yを入力し、X×Ym
odNなる剰余乗算を行い、その出力を前記記憶手段X
Rに入力して、そのデータを更新させる剰余乗算手段
と、前記各手段を制御する制御手段と、 各ビットb′ i が0,1、または−1で表されるビット
列(b′ m ,…b′ i ,…b′ 1 ,b′ 0 )で前記整数
Bを表現するとき、前記制御手段は、最初に前記整数X
及びビット番号iをX=1,i=mに初期化させ、 次に、前記制御手段は、前記選択手段を制御して前記Y
として前記Xを選択させ、その結果、前記剰余乗算手段
はX×XmodNなる演算を実行し、その出力で前記記
憶手段XRのデータを更新し、 次に、前記制御手段は、b′ i =1の時、前記選択手段
を制御して前記Yとして前記整数Aを選択させ、その結
果、前記剰余乗算手段はX×AmodNなる演算を実行
し、その出力で前記記憶手段XRのデータを更新し、 前記制御手段は、前記b′ i =−1の時、前記選択手段
を制御して、前記Yとして前記AIを選択させ、その結
果、前記剰余乗算手段はX×AImodNなる演算を実
行し、その出力で前記記憶手段XRのデータを更新し、 次に、前記制御手段は、前記iをi−1で更新して同様
の演算処理を繰返させ、i<0ならば演算処理を終了さ
せ、その時の前記記憶手段XRのデータを前記 B mo
dNなるべき乗剰余演算結果として出力させ、 (b m-1 ,…b 1 ,b 0 )なるm個の0または1からな
るビット列で整数Bが表現されている時、前記の隣接す
るビット列(b 2j+1 ,b 2j ,b 2j-1 )(jは0または正
の整数で、mが偶数ならj≦m/2,mが奇数ならj≦
(m−1)/2)から次の表に示す変換テーブルに従
い、0,1、または−1からなるビット列(b′ 2j+1
b′ 2j )を大きいiから降順に生成するコード変換手段
を具備することを特徴とする、 べき乗演算装置。 【数1】
1. An exponentiation for executing a modular exponentiation operation to be A B mod N with integers A and N represented by a plurality of bits and a relationship represented by a plurality of bits, where 0 ≦ A ≦ N−1. In the arithmetic unit, storage means AR, BR, and NR for respectively storing a plurality of bits of input data representing the integers A, B, and N; storage means XR for storing an integer X of an intermediate calculation result; A storage means AIR for storing the remainder inverse (integer) AI = A -1 modN; a selection means for selecting one integer Y from the integers A, X, AI input from the storage means AR, XR, AIR; The integers X and N obtained from the storage means XR and NR and the integer Y output from the selection means are input, and X × Ym
mod N, and outputs the result to the storage means X
Enter the R, and modular multiplication means for updating the data, and control means for controlling said each means, bits each bit b 'i is represented by 0, 1, or -1,
In the sequence (b ′ m ,... B ′ i ,... B ′ 1 , b ′ 0 ), the integer
When expressing B, the control means first sets the integer X
And the bit number i is initialized to X = 1, i = m, and the control means controls the selection means to control the Y
As a result, and as a result, the remainder multiplying means
Performs an operation of X × XmodN, and outputs
The data in the storage means XR is updated, and then, when b ′ i = 1, the selection means
To select the integer A as the Y,
As a result, the remainder multiplying means executes an operation of X × AmodN
Then, the control means updates the data in the storage means XR with the output, and when the b ' i = -1, the selection means
To allow the AI to be selected as the Y,
As a result, the remainder multiplying means executes an operation of X × AImodN.
And updates the data in the storage means XR with the output, and then the control means updates i to i-1
Is repeated, and if i <0, the operation is terminated.
And the data in the storage means XR at that time is stored in the A B mo
dN is output as the result of the modular exponentiation operation, and is composed of m 0s or 1s (b m−1 ,... b 1 , b 0 ).
When the integer B is represented by a bit sequence,
(B 2j + 1 , b 2j , b 2j-1 ) (j is 0 or positive
If m is an even number, j ≦ m / 2, if m is an odd number, j ≦
(M-1) / 2) according to the conversion table shown in the following table.
, A bit string consisting of 0, 1, or -1 (b ′ 2j + 1 ,
code conversion means for generating b ′ 2j ) in descending order from i
A power arithmetic device, comprising: (Equation 1)
【請求項2】 請求項1記載のべき乗演算装置におい
て、前記記憶手段AR,NRから前記整数AとNを入力
して、A-1modNなる剰余逆元を求める剰余逆元手段
を具備し、その出力を前記整数AIとし、これを前記記
憶手段AIRに記憶することを特徴とする。
2. The exponentiation arithmetic unit according to claim 1, further comprising: a remainder inverse unit for inputting the integers A and N from the storage units AR and NR to calculate a remainder inverse of A −1 mod N; The output is the integer AI, and this is stored in the storage means AIR.
【請求項3】 複数ビットで表現される0以外の実数A
と整数Bで、AB なるべき乗演算を実行するべき乗演算
装置において、 前記数A,Bを表現する複数ビットの入力データをそれ
ぞれ記憶する記憶手段AR,BRと、 演算途中結果の数Xを記憶する記憶手段XRと、 前記実数Aの逆数AI=1/Aを記憶する記憶手段AI
Rと、 前記記憶手段AR,XR,AIRから入力される前記数
A,X,AIから一つの数Yを選択する選択手段と、 前記記憶手段XRから得られる数Xならびに前記選択手
段が出力する数Yを入力し、X×Yなる積を求め、その
積を前記記憶手段XRに入力して、そのデータを更新さ
せる乗算手段と、前記各手段を制御する制御手段と、 各ビットb′ i が0,1かまたは−1で表されるビット
列(b′ m ,…b′ i ,…b′ 1 ,b′ 0 )で前記整数
Bを表現するとき、前記制御手段は、最初に前記数X及
びビット番号iをX=1,i=mに初期化させ、 次に、前記制御手段は、前記選択手段を制御して前記Y
として前記Xを選択させ、その結果、前記乗算手段はX
×Xなる演算を実行し、その出力で前記記憶手段XRの
データを更新し、 次に、前記制御手段は、前記b′ i =1の時、前記選択
手段を制御して前記Yとして前記数Aを選択させ、その
結果、前記乗算手段はX×Aなる演算を実行し、その出
力で前記記憶手段XRのデータを更新し、 前記制御手段は、前記b′ i =−1の時、前記選択手段
を制御して、前記Yとして前記AIを選択させ、その結
果、前記乗算手段はX×AIなる演算を実行し、その出
力で前記記憶手段XRのデータを更新し、 次に、前記制御手段は、前記iをi−1で更新して同様
の演算処理を繰返させ、i<0ならば演算処理を終了さ
せ、その時の前記記憶手段XRのデータを前記A B なる
べき乗演算結果として出力させ、 (b m-1 ,…b 1 ,b 0 )なるm個の0または1からな
るビット列で整数Bが表現されている時、前記の隣接す
るビット列(b 2j+1 ,b 2j ,b 2j-1 )(jは0または正
の整数で、mが偶数ならj≦m/2,mが奇数ならj≦
(m−1)/2)から次の表に示す変換テーブルに従
い、0,1、または−1からなるビット列 (b′ 2j+1
b′ 2j )を大きいiから降順に生成するコード変換手段
を具備することを特徴とする、 べき乗演算装置。 【数2】
3. A real number A other than 0 represented by a plurality of bits
A power operation device for performing a power operation of A B with an integer B, storing means AR and BR for storing a plurality of bits of input data representing the numbers A and B, and storing the number X of the intermediate result of the operation. Storage means XR for storing the inverse number AI = 1 / A of the real number A
R, selecting means for selecting one number Y from the numbers A, X, AI inputted from the storing means AR, XR, AIR, number X obtained from the storing means XR, and output by the selecting means A number Y is input, a product of X × Y is obtained, the product is input to the storage means XR, a multiplication means for updating the data, a control means for controlling the respective means, and a bit b ′ i Is a bit represented by 0, 1 or -1
In the sequence (b ′ m ,... B ′ i ,... B ′ 1 , b ′ 0 ), the integer
When expressing B, the control means first sets the number X and
And the bit number i is initialized to X = 1, i = m, and the control means controls the selection means to control the Y
As a result, the multiplying means determines that X
× X operation is performed, and the output thereof is stored in the storage unit XR.
The control means updates the data when b ′ i = 1.
Controlling the means to select the number A as the Y;
As a result, the multiplying means executes an operation of X × A, and outputs
The control means updates the data in the storage means XR by force, and when the b ' i = -1, the selection means
To allow the AI to be selected as the Y,
As a result, the multiplying means executes an operation of X × AI and outputs the result.
The data in the storage means XR is updated by force, and then the control means updates the i with i-1 and
Is repeated, and if i <0, the operation is terminated.
Was made the A B data of said storage means XR at that time
It is output as the result of exponentiation, and is composed of m 0s or 1s of (b m−1 ,... B 1 , b 0 ).
When the integer B is represented by a bit sequence,
(B 2j + 1 , b 2j , b 2j-1 ) (j is 0 or positive
If m is an even number, j ≦ m / 2, if m is an odd number, j ≦
(M-1) / 2) according to the conversion table shown in the following table.
, A bit string consisting of 0, 1, or -1 (b ′ 2j + 1 ,
code conversion means for generating b ′ 2j ) in descending order from i
A power arithmetic device, comprising: (Equation 2)
【請求項4】 請求項3記載のべき乗演算装置におい
て、前記記憶手段ARから前記数Aを入力して、その逆
数1/Aを求める除算手段を具備し、その出力を前記数
AIとし、これを前記記憶手段AIRに記憶することを
特徴とする。
4. The exponentiation device according to claim 3, further comprising: division means for inputting the number A from the storage means AR and calculating a reciprocal 1 / A thereof, and outputting the number AI. Is stored in the storage means AIR.
【請求項5】 請求項または記載のべき乗演算装置
において、(bm-1,…b1 ,b0 )なるm個の0また
は1からなるビット列で整数Bが表現されている時、前
記の隣接するビット列(b2j+1,b2j,b2j-1)(jは
0または正の整数で、mが偶数ならj≦m/2,mが奇
数ならj≦(m−1)/2)から、 b′2j+1=(−1) b2j+1 {(1−b2j+1)b2j2j-1+b2j+1(1−b2j) (1−b2j-1)}, b′2j=(−1)b2j+1 {(1−b2j)b2j-1+b2j(1−b2j-1)} の変換を、前記b′i を使用する時点で、その都度行う
コード変換手段が設けられていることを特徴とする。
5. The exponentiation device according to claim 1 or 3, wherein, when it is expressed integer B in (b m-1, ... b 1, b 0) made of m bit train consisting of 0 or 1, The adjacent bit string (b 2j + 1 , b 2j , b 2j-1 ) (j is 0 or a positive integer, j ≦ m / 2 if m is an even number, and j ≦ (m−1) if m is an odd number. / 2), b ′ 2j + 1 = (− 1) b2j + 1 {(1-b 2j + 1 ) b 2j b 2j-1 + b 2j + 1 (1-b 2j ) (1-b 2j-1) ), B ' 2j = (-1) b2j + 1 {(1-b 2j ) b 2j-1 + b 2j (1-b 2j-1 )} at the time of using b' i , It is characterized in that code conversion means for performing each time is provided.
JP19349693A 1993-08-04 1993-08-04 Exponentiation unit Expired - Fee Related JP3332270B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP19349693A JP3332270B2 (en) 1993-08-04 1993-08-04 Exponentiation unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP19349693A JP3332270B2 (en) 1993-08-04 1993-08-04 Exponentiation unit

Publications (2)

Publication Number Publication Date
JPH0749769A JPH0749769A (en) 1995-02-21
JP3332270B2 true JP3332270B2 (en) 2002-10-07

Family

ID=16309016

Family Applications (1)

Application Number Title Priority Date Filing Date
JP19349693A Expired - Fee Related JP3332270B2 (en) 1993-08-04 1993-08-04 Exponentiation unit

Country Status (1)

Country Link
JP (1) JP3332270B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6567832B1 (en) 1999-03-15 2003-05-20 Matsushita Electric Industrial Co., Ltd. Device, method, and storage medium for exponentiation and elliptic curve exponentiation
JP2009008993A (en) * 2007-06-29 2009-01-15 Nec Electronics Corp Power remainder computing unit and its control method

Also Published As

Publication number Publication date
JPH0749769A (en) 1995-02-21

Similar Documents

Publication Publication Date Title
US6920473B2 (en) Method and apparatus for modular multiplying and calculating unit for modular multiplying
JP3784156B2 (en) Modular multiplication method
EP0917047B1 (en) Apparatus for modular inversion for information security
US7831650B2 (en) Method for modular multiplication
KR100591761B1 (en) Montgomery Modular Multiplication Method Using Montgomery Modular Multiplier and Carry Store Addition
JP2004326112A (en) Multiple modulus selector, accumulator, montgomery multiplier, method of generating multiple modulus, method of producing partial product, accumulating method, method of performing montgomery multiplication, modulus selector, and booth recorder
JP3532860B2 (en) Arithmetic device, method, and program using remainder representation
US6430588B1 (en) Apparatus and method for elliptic-curve multiplication and recording medium having recorded thereon a program for implementing the method
WO2007080652A1 (en) Montgomery’s algorithm multiplication remainder calculator
US7412474B2 (en) Montgomery modular multiplier using a compressor and multiplication method
US6763366B2 (en) Method for calculating arithmetic inverse over finite fields for use in cryptography
JP2000010479A (en) Montgomery reduction apparatus and recording medium
US20040167955A1 (en) Arithmetic device for multiple precision arithmetic for montgomery multiplication residue arithmetic
JP3332270B2 (en) Exponentiation unit
JPH09204296A (en) Power residue operation method and unit
JP3660075B2 (en) Dividing device
JP3434220B2 (en) Inverse element computing device and its program recording medium
Arazi et al. On calculating multiplicative inverses modulo $2^{m} $
KR100257123B1 (en) High-speed exponentiation method using a modified montgomery modular multiplication
JP3136709B2 (en) Exponentiation unit
JP3626315B2 (en) Remainder calculation apparatus, information processing apparatus, and remainder calculation method
JP3210420B2 (en) Multiplication circuit over integers
JP4643951B2 (en) CONVERTING DEVICE AND CONVERTING METHOD FOR CONVERTING RESIDUAL CONVERSION NUMBER TO BINARY NUMBER
JP2004102071A (en) Polynomial remainder system arithmetic device, method, and program
JP2777265B2 (en) High radix square root arithmetic unit

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees