JP2558687B2 - Modular multiplication - Google Patents

Modular multiplication

Info

Publication number
JP2558687B2
JP2558687B2 JP62090264A JP9026487A JP2558687B2 JP 2558687 B2 JP2558687 B2 JP 2558687B2 JP 62090264 A JP62090264 A JP 62090264A JP 9026487 A JP9026487 A JP 9026487A JP 2558687 B2 JP2558687 B2 JP 2558687B2
Authority
JP
Japan
Prior art keywords
register
output
value
accumulation
left shifter
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
JP62090264A
Other languages
Japanese (ja)
Other versions
JPS63255737A (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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP62090264A priority Critical patent/JP2558687B2/en
Publication of JPS63255737A publication Critical patent/JPS63255737A/en
Application granted granted Critical
Publication of JP2558687B2 publication Critical patent/JP2558687B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)
  • Error Detection And Correction (AREA)

Description

【発明の詳細な説明】 産業上の利用分野 本発明は、暗号理論や符号理論の演算に用いられる剰
余乗算を実行する剰余乗算装置に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a modular multiplication apparatus that executes modular multiplication used in cryptographic theory and code theory calculations.

従来の技術 暗号理論や符号理論における演算では剰余系の演算が
しばしば用いられる。例えば公開鍵暗号として知られて
いるRSA暗号においてはべき乗剰余演算が用いられ、べ
き乗剰余演算では剰余乗算が基本となっている。ここで
剰余乗算は、語長の大きな3つの正の整数a,bおよびn
に対して、積a・bを整数nで割った剰余を求めること
である。
2. Description of the Related Art A residue system operation is often used in operations in cryptography and code theory. For example, in RSA cryptography known as public key cryptography, a modular exponentiation operation is used, and the modular exponentiation operation is basically modular multiplication. Here, the modular multiplication is performed by using three positive integers a, b and n having a large word length.
Is obtained by dividing the product a · b by an integer n.

従来の剰余乗算アルゴリズムおよび剰余乗算装置は、
例えば、G.オートン、L.E.ピパード、S.E.タバラス、ア
ファースト アンシクロナスRSAエンクリプション
チップ(G.Orton,L.E.Peppard and S.E.Tavares,“A Fa
st Asynchronous RSA Encription Chip)、アイイーイ
ーカスタム インテグレーテッド サーキット コンフ
ェランス、ロチェスタ,N.Y(,IEEE Custom Integrated
Circuits Conference、Rochester,N.Y)MAY12−15,1986
に示されている。
The conventional modular multiplication algorithm and modular multiplication device are
For example, G. Orton, LE Pippard, SE Tavaras, Afast Ancyclonas RSA encryption
Chip (G.Orton, LEPeppard and SETavares, “A Fa
st Asynchronous RSA Encription Chip), IEE Custom Integrated Circuit Conference, Rochester, NY (, IEEE Custom Integrated
Circuits Conference, Rochester, NY) MAY12-15, 1986
Is shown in.

今、整数a,b,nをそれぞれ512ビットで表わされる正の
整数とし、整数nは 2511≦n≦2512 (1) に正規化されており、整数aは予め 0<a<n (2) とされているものとする。また整数aを整数nで割った
剰余を“a mod n"で表わすものとする。また整数bは、
kビットの2進数で書き表わした時 とする(k=512)。なお本明細書において“桁”は2
進数の桁を意味する。
Now, let the integers a, b, and n be positive integers represented by 512 bits respectively, and the integer n is normalized to 2 511 ≤ n ≤ 2 512 (1), and the integer a is preliminarily 0 <a <n ( 2). The remainder obtained by dividing the integer a by the integer n is represented by "a mod n". The integer b is
When written in k-bit binary number (K = 512). In this specification, "digit" is 2
It means the digit of a decimal number.

以下に図面を参照してこの第1の従来の剰余乗算装置
を説明する。第3図はこの第1の従来の剰余乗算装置を
示すブロック図である。第3図において、1は被乗数a
もしくは演算の途中結果を格納する512ビットのレジス
タ、2はレジスタ1の内容を1ビット左シフトする左シ
フタ、3は法とする整数nを格納する512ビットのレジ
スタ、4は整数2nを格納する513ビットのレジスタ、5
は左シフタ2の出力からレジスタ3の内容である整数n
を減算する減算器、6は減算器5の出力の正負に基づき
その値が正または0の場合は減算器5の出力を選択し、
負の場合は左シフタ2の出力を選択してレジスタ1に出
力するマルチプレクサ、7は左シフタ2の出力からレジ
スタ4の内容である整数2nを減算する減算器、8は被乗
数aもしくは減算器7の出力を格納する514ビットのレ
ジスタ、9は513ビットの累算レジスタ、10は累算レジ
スタ9の値の正負に基づきその値が正または0の場合は
レジスタ8の出力を選択し、負の場合はレジスタ1の出
力を選択して出力するマルチプレクサ、11は乗数bを格
納する右1ビットシフトレジスタ、12は累算レジスタ9
の値に対してシフトレジスタ11のLSBが1のときにマル
チプレクサ10の出力を加算し、もしくは所定の演算終了
時累算レジスタ9の値が負の場合にレジスタ3の値nを
加算して累算レジスタ9に出力する加減算器である。
The first conventional modular multiplication device will be described below with reference to the drawings. FIG. 3 is a block diagram showing the first conventional modular multiplication device. In FIG. 3, 1 is the multiplicand a
Alternatively, a 512-bit register for storing the intermediate result of the operation, 2 is a left shifter for shifting the contents of register 1 to the left by 1 bit, 3 is a 512-bit register for storing an integer n that is a modulus, and 4 is an integer 2n. 513-bit register, 5
Is the integer n which is the content of the register 3 from the output of the left shifter 2.
A subtractor for subtracting 6 from the output of the subtractor 5 based on whether the output of the subtractor 5 is positive or negative, and selects the output of the subtractor 5;
If negative, a multiplexer that selects the output of the left shifter 2 and outputs it to the register 1, 7 is a subtractor that subtracts the integer 2n that is the contents of the register 4 from the output of the left shifter 2, and 8 is the multiplicand a or the subtractor 7 Is a 514-bit register that stores the output of the register, 9 is a 513-bit accumulation register, and 10 is based on whether the value of the accumulation register 9 is positive or negative. In this case, a multiplexer that selects and outputs the output of register 1, 11 is a right 1-bit shift register that stores a multiplier b, and 12 is an accumulation register 9
When the LSB of the shift register 11 is 1, the output of the multiplexer 10 is added, or when the value of the accumulation register 9 at the end of a predetermined calculation is negative, the value n of the register 3 is added to accumulate. It is an adder / subtractor that outputs to the arithmetic register 9.

なお以降、レジスタ1に格納された値をPa、レジスタ
8に格納された値をNa、累算レジスタ9に格納された値
をsと表わすものとする。
Hereinafter, the value stored in the register 1 will be represented by Pa, the value stored in the register 8 will be represented by Na, and the value stored in the accumulation register 9 will be represented by s.

この第1の従来例のアルゴリズムをまずC言語風に記
述すると次のようになる。
The algorithm of the first conventional example is first described in the C language style as follows.

Pa=Na=a; s=0; for(i=0;i<512;i++) { if(s>=0) s=s+bi*Na; else s=s+bi*Pa; Na=2Pa−2n; if(2Pa>=n) Pa=2Pa−n; else Pa=2Pa; } while(s<0) s=s+n; 以上のように構成され、上記アルゴリズムを実行する
従来の剰余乗算装置において以下にその動作について説
明する。
Pa = Na = a; s = 0; for (i = 0; i <512; i ++) {if (s> = 0) s = s + b i * Na; else s = s + b i * Pa; N a = 2P a −2n; if (2Pa> = n) Pa = 2Pa−n; else Pa = 2Pa;} while (s <0) s = s + n; In the conventional remainder multiplication device configured as described above and executing the above algorithm. The operation will be described below.

(i) まず被乗数aをレジスタ1とレジスタ8に格納
し、乗数bをシフトレジスタ11に格納し、法となる整数
nをレジスタ3に格納し、整数2nをレジスタ4に格納す
る。また累算レジスタ9を0にリセットする。ここで、
Pa=a、Na=a、s=0である。
(I) First, the multiplicand a is stored in the registers 1 and 8, the multiplier b is stored in the shift register 11, the modulo integer n is stored in the register 3, and the integer 2n is stored in the register 4. Also, the accumulation register 9 is reset to 0. here,
Pa = a, Na = a, s = 0.

(ii) 左シフタ2においてはレジスタ1の内容Paを1
ビット左にシフトし2Paを得る((i)の直後では2
a)。減算器5においては左シフタ2の出力2Paからレジ
スタ3の値nを減算する。マルチプレクサ6は減算器5
の出力“2Pa−n"が正または0の場合は減算器5の出力
“2Pa−n"を選択し負の場合は左シフタ2の出力2Paを選
択してレジスタ1に出力する。(1),(2)式の条件
より上記の処理は Pa=2Pa mod n (3) 0≦Pa<n (4) である。なお、(3)式においてmod nはその式をnの
剰余体上で計算することを意味する。以降も同じ表現を
用いる。
(Ii) In the left shifter 2, set the content Pa of register 1 to 1
Shift left a bit to get 2Pa (2 immediately after (i)
a). The subtracter 5 subtracts the value n of the register 3 from the output 2Pa of the left shifter 2. The multiplexer 6 is the subtractor 5
When the output "2Pa-n" is positive or 0, the output "2Pa-n" of the subtractor 5 is selected, and when it is negative, the output 2Pa of the left shifter 2 is selected and output to the register 1. From the conditions of the expressions (1) and (2), the above processing is Pa = 2Pa mod n (3) 0 ≦ Pa <n (4). Note that mod n in the equation (3) means that the equation is calculated on the remainder field of n. The same expression will be used thereafter.

(iii) (ii)と同時に、減算器7においては左シフ
タ2の出力2Pa((i)の直後では2a)からレジスタ4
の値2nを減算しその出力“2Pa−2n"をレジスタ8に出力
する。上記の処理は Na=2Pa−2n (5) とかける。ここで(2)式または(4)式の条件より 0<2a<2n (6) 0≦2Pa<2n (7) であるから、 −2n≦Na<0 (8) である。従ってNaは法をnとする剰余系の中で(3)式
で計算されたPaと同値な負の値である。
(Iii) At the same time as (ii), in the subtractor 7, the output 2Pa of the left shifter 2 (2a immediately after (i)) to the register 4
2n is subtracted and the output "2Pa-2n" is output to the register 8. The above processing is applied with Na = 2Pa-2n (5). Since 0 <2a <2n (6) 0 ≦ 2Pa <2n (7) according to the condition of the expression (2) or (4), −2n ≦ Na <0 (8). Therefore, Na is a negative value that is the same as Pa calculated by the equation (3) in the remainder system where the modulus is n.

(iv) (ii),(iii)と同時にマルチプレクサ10に
おいては累算レジスタ9の符号ビットが0のときにはレ
ジスタ8の値Na(<0)を選択し、累算レジスタ9の符
号ビットが1のときにはレジスタ1の値Pa(≧0)を選
択して加減算器12に出力する。((i)の直後では累算
レジスタ9の符号ビットが0であるからレジスタ8を選
択してその値である被乗数aを出力する。)加減算器12
においては、もしシフトレジスタ11のLSBが1であった
場合、累算レジスタ9にこのマルチプレクサ10の出力を
加算し、もしシフトレジスタ11のLSBが0であった場
合、累算レジスタ9の値を更新しない。即ち、累算レジ
スタ9は、その値sが正または0のときNa(−2n≦Na<
0)を加算し、負のときPa(0≦Pa<n)を加算する。
従って累算レジスタ9の値sは −2n≦s<n (9) となる。その後シフトレジスタ11を1ビット右にシフト
させる。
(Iv) Simultaneously with (ii) and (iii), in the multiplexer 10, when the sign bit of the accumulation register 9 is 0, the value Na (<0) of the register 8 is selected, and the sign bit of the accumulation register 9 is 1 Sometimes, the value Pa (≧ 0) of the register 1 is selected and output to the adder / subtractor 12. (Immediately after (i), since the sign bit of the accumulation register 9 is 0, the register 8 is selected and its value, the multiplicand a, is output.) Adder / subtractor 12
In, if the LSB of the shift register 11 is 1, the output of the multiplexer 10 is added to the accumulation register 9, and if the LSB of the shift register 11 is 0, the value of the accumulation register 9 is changed. Do not update. That is, when the value s is positive or 0, the accumulation register 9 has Na (−2n ≦ Na <
0) is added, and when negative, Pa (0 ≦ Pa <n) is added.
Therefore, the value s of the accumulation register 9 is −2n ≦ s <n (9). After that, the shift register 11 is shifted right by 1 bit.

以上の(ii),(iii),(iv)の処理は同期して同
時に実行され、これらの処理はループとして合計512回
繰り返される。
The above processes (ii), (iii), and (iv) are simultaneously executed in synchronization, and these processes are repeated a total of 512 times as a loop.

以上の処理を合計512回実行終了すると、sはa×b m
od nと法nの剰余系の数として同値な値であって式
(9)を満たす値となっている。従ってこの時点でもし
累算レジスタ9の値sが負ならば、多くとも2回だけ整
数nを加算することによりa×b mod nが得られる。こ
の加算を行なうには加減算器12を用いて累算レジスタ9
の値にレジスタ3の値nを加算する。このようにして本
従来例において剰余乗算a×b mod nが実行され結果は
累算レジスタ9に格納される。
When the above processing is completed 512 times in total, s is a × bm
The number of cosets of od n and the modulus n is the same value and satisfies the expression (9). Therefore, if the value s of the accumulation register 9 is negative at this point in time, a × b mod n is obtained by adding the integer n only at most twice. To perform this addition, adder / subtractor 12 is used
The value n of the register 3 is added to the value of. In this way, the remainder multiplication a × b mod n is executed in this conventional example, and the result is stored in the accumulation register 9.

従って、本従来例において減算器5および7、加減算
器12の演算時間をいずれもδとすると、a×b mod nの
演算を実行するためには、最大約 (512+2)δ の時間が必要である。
Therefore, in this conventional example, if the computation times of the subtracters 5 and 7 and the adder / subtractor 12 are all δ, a maximum time of (512 + 2) δ is required to execute the computation of a × b mod n. is there.

しかしながら、このような剰余乗算を繰り返してべき
乗剰余演算を行ないRSA暗号処理に用いると考えたとき
この処理時間は十分ではない。実際、512ビット幅の加
算器を4ビット毎の桁上げ先見回路を用いて構成したと
きδはおよそ100nsである。べき数が512ビットのべき乗
剰余演算には最大1024回の剰余乗算が必要である。この
ことよりRSA暗号化の処理速度は約10kbpsであり、この
ままでは要求されるさらに高速の処理速度に対応できな
い。
However, this processing time is not sufficient when it is considered that the modular exponentiation is performed by repeating such modular multiplication and used for the RSA cryptographic processing. In fact, when the 512-bit wide adder is constructed by using the carry look-ahead circuit for every 4 bits, δ is about 100 ns. A power-residue operation with a power of 512 bits requires a maximum of 1024 modular multiplications. As a result, the processing speed of RSA encryption is about 10 kbps, and as it is, it cannot support the required higher processing speed.

そこで同出願人は、2次のBoothのアルゴリズムを用
いて乗数bを2ビットずつ処理し、上記第1の従来例に
比べて2倍の処理速度を持つ剰余乗算装置を提案してい
る。
Therefore, the applicant proposes a remainder multiplication device which processes the multiplier b by 2 bits by using the quadratic Booth algorithm and has a processing speed twice as high as that of the first conventional example.

以下に、このような特長を持つ同出願人提案による従
来の剰余乗算装置を、第2の従来例として図面を用いて
説明する。
A conventional modular multiplication device proposed by the same applicant having such a feature will be described below as a second conventional example with reference to the drawings.

第4図は同出願人提案による従来の剰余乗算装置のブ
ロック図である。第4図において、101は被乗数aもし
くは演算の途中結果を格納する513ビットのレジスタ、1
02はレジスタ1の内容を4倍、即ち2ビット左シフトす
る左シフタ、103は左シフタ2の出力の515ビットのうち
の上位4ビットをt3,t2,t1,t0としたときに t=t3・2514+t2・2513+t1・2512+t0・2511 (10) をnで割った商をqとすると、商qと法nの積q・nを
格納し上記4ビットをアドレスとして積q・nを出力す
る8ワードのメモリ、104は左シフタ102の出力からメモ
リ103の出力q・nを減算する減算器、105は法とする整
数nを格納する512ビットのレジスタ、106は整数8nを格
納する515ビットのレジスタ、107は左シフタ102の出力
からレジスタ106の内容8nを減算する減算器、108は減算
器107の出力を格納する516ビットのレジスタ、109は初
期状態において乗数bを格納する右2ビットシフトレジ
スタ、110はシフトレジスタ109の下位2ビットとそのLS
Bより1ビット下位で前回のシフトでシフトアウトされ
た最上位ビットのあわせて3ビットを用いて制御線c0,c
1,c2を生成するBoothのエンコーダ(第5図参照)、111
はEORゲート、112はEORゲート111の出力が0のときには
レジスタ108の出力を選択しEORゲート111の出力が1の
ときにはレジスタ101の出力を選択して出力するマルチ
プレクサ、113は制御線c0が1のときにマルチプレクサ1
12の出力値を1ビット左にシフトする左シフタ、114は5
17ビットの累算レジスタ、115は累算レジスタ114の値に
対して制御線c2が1でかつ制御線c1が0のときに左シフ
タ113の出力を加算し、制御線c2が1でかつ制御線c1が
1のときに左シフタ113の出力を減算し、制御線c2が0
のときは累算レジスタ114の値を更新せず、もしくは所
定の演算終了時累算レジスタ114の正負に応じてレジス
タ105の値nを加算もしくは減算して累算レジスタ114に
出力する加減算器である。また、EORゲート111は累算レ
ジスタ14の符号ビットおよびBoothエンコーダ110の制御
線出力c1を入力としている。
FIG. 4 is a block diagram of a conventional modular multiplication device proposed by the same applicant. In FIG. 4, 101 is a 513-bit register for storing the multiplicand a or the intermediate result of the operation, 1
02 is the left shifter that shifts the contents of register 1 by 4 times, that is, 2 bits to the left, 103 is the upper 4 bits of the 515 bits of the output of the left shifter 2, when t 3 , t 2 , t 1 , t 0 Let t = t 3 · 2 514 + t 2 · 2 513 + t 1 · 2 512 + t 0 · 2 511 (10) divided by n to be q, and store the product q · n of the quotient q and the modulus n. An 8-word memory that outputs the product q · n using the above 4 bits as an address, 104 is a subtracter that subtracts the output q · n of the memory 103 from the output of the left shifter 102, and 105 is a modulo integer n 512 Bit register, 106 is a 515 bit register that stores an integer 8n, 107 is a subtractor that subtracts the content 8n of the register 106 from the output of the left shifter 102, 108 is a 516 bit register that stores the output of the subtractor 107, 109 is a right 2-bit shift register that stores the multiplier b in the initial state, 110 is the lower 2 bits of the shift register 109 and its LS
Control lines c0 and c using 1 bit lower than B and 3 bits in total including the most significant bit shifted out by the previous shift
Booth encoder that generates 1, c2 (see Figure 5), 111
Is an EOR gate, 112 is a multiplexer which selects the output of the register 108 when the output of the EOR gate 111 is 0, and selects the output of the register 101 when the output of the EOR gate 111 is 1, and 113 is the control line c0 which is 1 When mux 1
Left shifter that shifts the output value of 12 to the left by 1 bit, 114 is 5
A 17-bit accumulation register, 115 adds the output of the left shifter 113 to the value of the accumulation register 114 when the control line c2 is 1 and the control line c1 is 0, and the control line c2 is 1 and the control is performed. When the line c1 is 1, the output of the left shifter 113 is subtracted, and the control line c2 is 0.
In the case of, the value of the accumulation register 114 is not updated, or the value n of the register 105 is added or subtracted according to the positive / negative of the accumulation register 114 at the end of a predetermined calculation, and the addition / subtractor outputs the value to the accumulation register 114. is there. Further, the EOR gate 111 receives the sign bit of the accumulation register 14 and the control line output c1 of the Booth encoder 110 as inputs.

2次のBoothのエンコーダを用いた乗算方法について
例えば“田中、「LSI化が進む並列演算方式による乗算
器の回路方式を見る」、日経エレクトロニクス、1978、
5、29、pp76〜90"に示されている。これを剰余乗算に
適用すると次の方法によってa×b mod nを求めるもの
である。
For the multiplication method using the secondary Booth encoder, see, for example, “Tanaka,“ Looking at the circuit system of a multiplier by a parallel operation method that is becoming more LSI-compatible ””, Nikkei Electronics, 1978,
5, 29, pp 76-90 ". When this is applied to modular multiplication, a * b mod n is obtained by the following method.

ここで b-1=0 (13) F2(bi)=b2i-1+b2i−2b2i+1 (14) とおいた。 Here, b -1 = 0 (13) F 2 (b i ) = b 2i-1 + b 2i −2b 2i + 1 (14).

このような2次のBoothの方式におけるエンコーダ110
の、各b2i-1、b2i、b2i+1に対するF2(bi)の値、制御
線出力c0,c1,c2の真理値表および加減算器114の動作図
を第5図に示す。第5図からわかるように、制御線c0は
F2(bi)の絶対値が2であることを、制御線c1はF
2(bi)の値が負であることを、制御線c2はF2(bi)の
絶対値が0でないことを論理1によって示している。
The encoder 110 in such a secondary Booth system
FIG. 5 shows the value of F 2 (b i ) for each b 2i-1 , b 2i , b 2i + 1 , the truth table of the control line outputs c0, c1, c2 and the operation diagram of the adder / subtractor 114. . As can be seen from FIG. 5, the control line c0 is
The control line c1 indicates that the absolute value of F 2 (b i ) is 2.
A logic 1 indicates that the value of 2 (b i ) is negative and that the control line c2 indicates that the absolute value of F 2 (b i ) is not zero.

また、以降、レジスタ101に格納された値をPa、レジ
スタ108に格納された値をNa、累算レジスタ114に格納さ
れた値をsと表わすものとする。
Further, hereinafter, the value stored in the register 101 is represented by Pa, the value stored in the register 108 is represented by Na, and the value stored in the accumulation register 114 is represented by s.

この第2の従来例のアルゴリズムをまずC言語風に記
述すると次のようになる。
The algorithm of the second conventional example is first described in the C language style as follows.

s=0; Pa=Na=a; for(i=0;i<=512;i++2) { if((bi-1+bi−2bi+1)==0)s=s; else if((sign(s)^sign(bi-1+bi−2bi+1))==1) s=s+(bi-1+bi−2bi+1)*Pa; else s=s+(bi-1+bi−2bi+1)*Na; Na=4*Pa−q*n; Pa=4*Pa−q*n; } while(s<0) s=s+n; while(s>=n)s=s−n; ここでb512=b513=0であり、記号^はビットごとの
排他的論理和演算を示す。この結果 s=a×b mod n となる。
s = 0; Pa = Na = a; for (i = 0; i <= 512; i ++ 2) {if ((b i-1 + b i −2 b i + 1 ) == 0) s = s; else if ( (Sign (s) ^ sign (b i-1 + b i −2 b i + 1 )) == 1) s = s + (b i−1 + b i −2 b i + 1 ) * Pa; else s = s + (b i-1 + b i −2b i + 1 ) * Na; N a = 4 * P a −q * n; P a = 4 * P a −q * n;} while (s <0) s = s + n; while (S> = n) s = s−n; where b 512 = b 513 = 0, and the symbol ^ indicates a bitwise exclusive OR operation. As a result, s = a × b mod n.

以上のように構成され、上記アルゴリズムを実現した
本第2の従来例の剰余乗算装置について以下その動作を
説明する。
The operation of the second conventional modular multiplication device having the above-described configuration and implementing the above algorithm will be described below.

(i) まず被乗数aをレジスタ101とレジスタ108に格
納し、乗数bをシフトレジスタ109に格納し、法となる
整数nをレジスタ105に格納し、整数8nをレジスタ106に
格納する。また累算レジスタ114を0にリセットする。
ここで、Pa=a、Na=a、s=0である。
(I) First, the multiplicand a is stored in the registers 101 and 108, the multiplier b is stored in the shift register 109, the modulo integer n is stored in the register 105, and the integer 8n is stored in the register 106. Also, the accumulation register 114 is reset to 0.
Here, Pa = a, Na = a, and s = 0.

(ii) 左シフタ102においてはレジスタ102の内容Paを
2ビット左にシフトし4Pa((i)の直後では4a)を得
る。左シフタ102の出力515ビットのうちの上位4ビット
をアドレスとしてメモリ103をアクセスし、メモリ103は
(10)式の値tをnで割った商qと法nとの積q・nを
出力する。減算器104においては左シフタ102の出力4Pa
からメモリ3の出力q・nを減算しその結果“4Pa−q
・n"をレジスタ101に出力する。(i)の直後ではこの
値は“4a−q・n"である。
(Ii) In the left shifter 102, the content Pa of the register 102 is shifted to the left by 2 bits to obtain 4Pa (4a immediately after (i)). The memory 103 is accessed by using the upper 4 bits of the output 515 bits of the left shifter 102 as an address, and the memory 103 outputs the product q · n of the quotient q obtained by dividing the value t of the equation (10) by n and the modulus n. To do. In the subtractor 104, the output of the left shifter 102 is 4Pa
The output q · n of memory 3 is subtracted from the result, and the result is “4Pa-q
-N "is output to the register 101. Immediately after (i), this value is" 4a-qn ".

ここで、左シフタ102の出力の下位511ビットをasとお
き、(10)式のtをnで割った剰余をrとおくと、 as<n (15) r<n (16) であり、 4Pa=t+as (17) t=q・n+r (18) (17),(18)式より 4Pa=q・n+r+as ∴4Pa−q・n=r+as (19) (15),(16)式によりレジスタ101に格納され更新
された値Paは Pa=4Pa−q・n=r+as<2n (20) この結果は4Paをnで割った剰余系の数であって513ビ
ットで表わされる数となる。
Here, if the lower 511 bits of the output of the left shifter 102 are set as a s , and the remainder obtained by dividing t in equation (10) by n is set as r, then a s <n (15) r <n (16) There, 4Pa = t + a s ( 17) t = q · n + r (18) (17), (18) from equation 4Pa = q · n + r + a s ∴4Pa-q · n = r + a s (19) (15), (16 ) value Pa which is stored in the register 101 updated by formula is represented by a and 513-bit number of the coset Pa = 4Pa-q · n = r + a s <2n (20) the results obtained by dividing the 4Pa with n Becomes a number.

従ってここにおける処理は(20)式を求めてレジスタ
101に格納することであり、この値PaはもとのPaの値を
4倍した数の法をnとする剰余系の数であって 0≦Pa<2n (21) なる数である。
Therefore, the processing here is performed by registering the equation (20).
This is stored in 101, and this value Pa is the number of the remainder system with n being the modulus of the number obtained by multiplying the original value of Pa by 4 and is 0 ≦ Pa <2n (21).

(iii) (ii)と同時に、減算器107においては左シフ
タ102の出力4Pa((i)の直後では4a)からレジスタ10
6の値8nを減算しその出力“4Pa−8n"をレジスタ108に出
力する。この処理は Na=4Pa−8n (22) とかける。ここで(21)式の条件より 0≦4Pa<8n (23) であるから −8n≦Na<0 (24) である。従ってNaは法をnとする剰余系の中で(20)式
で計算されたPaと同値な負の値である。
(Iii) At the same time as (ii), in the subtractor 107, from the output 4Pa of the left shifter 102 (4a immediately after (i)) to the register 10
The value 8n of 6 is subtracted and the output "4Pa-8n" is output to the register 108. This processing is applied with Na = 4Pa-8n (22). Here, since 0 ≦ 4Pa <8n (23) from the condition of the expression (21), −8n ≦ Na <0 (24). Therefore, Na is a negative value that is equivalent to Pa calculated by Eq. (20) in the remainder system modulo n.

(iv) マルチプレクサ112においてはEORゲート111の
出力が0(即ち累算レジスタ114の値sが正でかつF2(b
i)が正のときもしくはsが負でかつF2(bi)が負であ
る)のときレジスタ108の値Na<0を選択し、EORゲート
111の出力が1(即ち累算レジスタ114の値sが正でかつ
F2(bi)が負のときもしくはsが負でかつF2(bi)が正
である)のときにはレジスタ101の値Paを選択して左シ
フタ113に出力する。左シフタ113においては制御線c0が
1のとき即ちF2(bi)の絶対値が2のときマルチプレク
サ112の出力を2倍して加減算器115に与え、制御線c0が
0のときはマルチプレクサ112の出力を1倍して加減算
器115に与える。加減算器115においては、もし制御線c2
が1で制御線c1が0であった場合即ちF2(bi)が0でな
い正の値のとき累算レジスタ114に左シフタ113の出力を
加算し、制御線c2が1で制御線c1が1であった場合即ち
F2(bi)が0でない負の値のとき累算レジスタ114から
左シフタ113の出力を減算して更新し、制御線c2が0で
あった場合、累算レジスタ114の値を更新しない。これ
によりsが正のとき(0を含む)には負の値が加えら
れ、負のときは正の値が加えられる。従って累算レジス
タ114の値sは(21),(24)式により −16n≦s<4n (25) となる。その後シフトレジスタ109を2ビット右にシフ
トさせる。
(Iv) In the multiplexer 112, the output of the EOR gate 111 is 0 (that is, the value s of the accumulation register 114 is positive and F 2 (b
i ) is positive, or s is negative and F 2 (b i ) is negative), the value Na <0 in register 108 is selected and the EOR gate is selected.
The output of 111 is 1 (that is, the value s of the accumulation register 114 is positive and
When F 2 (b i ) is negative or when s is negative and F 2 (b i ) is positive), the value Pa of the register 101 is selected and output to the left shifter 113. In the left shifter 113, when the control line c0 is 1, that is, when the absolute value of F 2 (b i ) is 2, the output of the multiplexer 112 is doubled and given to the adder / subtractor 115, and when the control line c0 is 0, the multiplexer The output of 112 is multiplied by 1 and given to the adder / subtractor 115. In the adder / subtractor 115, if the control line c2
Is 1 and the control line c1 is 0, that is, when F 2 (b i ) is a positive value other than 0, the output of the left shifter 113 is added to the accumulation register 114, and the control line c2 is 1 and the control line c1 Is 1
When F 2 (b i ) is a non-zero negative value, the output of the left shifter 113 is subtracted from the accumulation register 114 and updated, and when the control line c2 is 0, the value of the accumulation register 114 is not updated. . As a result, a negative value is added when s is positive (including 0), and a positive value is added when s is negative. Therefore, the value s of the accumulation register 114 is −16n ≦ s <4n (25) according to the equations (21) and (24). After that, the shift register 109 is shifted right by 2 bits.

以上の(ii),(iii),(iv)の処理は同期して同
時に実行され、これらの処理はループとして合計257回
繰り返される。
The above processes (ii), (iii), and (iv) are synchronously and simultaneously executed, and these processes are repeated 257 times in total as a loop.

以上の処理(ループ)を合計257回実行終了すると、
sはa×b mod nと法nの剰余系の数として同値な値で
あって(25)式を満たす値となっている。従ってこの時
点でも、もし累算レジスタ114の値sが負ならば、多く
とも16回だけ整数nを加算することによりa×b mod n
が得られ、もし累算レジスタ114の値sがn以上の値で
あれば、多くとも3回だけ整数nを減算することにより
a×b MOD nが得られる。この補正処理は加減算器115を
用いて累算レジスタ114の値にレジスタ105の値nを加算
もしくは減算することによって行なう。
When the above processing (loop) is executed 257 times in total,
s is a value that is the same as the number of remainder systems of a × b mod n and modulus n, and is a value that satisfies equation (25). Therefore, even at this point, if the value s of the accumulation register 114 is negative, a × b mod n is added by adding the integer n at most 16 times.
If the value s of the accumulation register 114 is greater than or equal to n, a × b MOD n can be obtained by subtracting the integer n only at most three times. This correction processing is performed by using the adder / subtractor 115 to add or subtract the value n of the register 105 to the value of the accumulation register 114.

このようにして本第2の従来例において剰余乗算a×
b mod nが実行され、結果は累算レジスタ114に格納され
る。
Thus, in the second conventional example, the modular multiplication a ×
b mod n is executed and the result is stored in the accumulation register 114.

従って、本第2の従来例において減算器104および10
7、加減算器115の演算速度をいずれもδとすると、a×
b mod nの演算を行なうためには、最大約 (257+16)δ の時間が必要であり上記第1の従来例の約2倍の速度が
実現できる。
Therefore, in the second conventional example, the subtractors 104 and 10
7. If the calculation speed of the adder / subtractor 115 is δ, then a ×
In order to calculate b mod n, a maximum time of (257 + 16) δ is required, and a speed approximately twice that of the first conventional example can be realized.

発明が解決しようとする問題点 このような従来の剰余乗算を繰り返してべき乗剰余演
算を行なったときのRSA暗号化の処理速度は約20kbpsで
あり、第1の従来例に比べ2倍の速度となるが、それで
もこのままでは要求されるさらに高速の処理速度に対応
することができない。処理速度を上げようとして、上記
第2の従来例で示した剰余乗算装置に対してさらに高次
の、例えば4次のBoothのアルゴリズムを用いるように
すると、第4図におけるレジスタ101に対応する値Paは
上記第2の従来例と同様に(21)式を満たすが、左シフ
タ102を4ビットシフタ(16倍数器)とすると、レジス
タ108の値に対応する値としてPaと法nの剰余数で同値
な負の値を得るためにはレジスタ106には32nを格納しな
ければならず、従って第4図におけるマルチプレクサ11
2の出力に対応する値は−32n以上2n未満の数となる。さ
らにマルチプレクサ112の出力値を1倍から2倍する1
ビット左シフタ113の代わりに、その対応する値を1倍
から8倍する乗算器を置く必要があり、このため累算レ
ジスタ114の値sは −256n≦s<16n (26) となる。従ってループ回数は129回と第2の実施例の257
回の半分になるが、sの値を0≦s<nとするために最
大256回の補正が必要となり、また上記したように左シ
フタ113の位置に乗算器が挿入されるために1回のルー
プにかかる時間は“乗算器の乗算時間+δ”となる。従
ってこのようにしてもa×b mod nの演算には、最大約 (129+256)×(乗算器の乗算時間+δ) の時間が必要であり、上記第2の従来例の処理速度より
高速にすることができないという問題点を有していた。
Problems to be Solved by the Invention The processing speed of the RSA encryption when performing the modular exponentiation operation by repeating such conventional modular multiplication is about 20 kbps, which is twice as fast as that of the first conventional example. However, even so, it is not possible to cope with the higher processing speed required. In order to increase the processing speed, if a higher-order, for example, fourth-order Booth algorithm is used for the remainder multiplication device shown in the second conventional example, the value corresponding to the register 101 in FIG. Although Pa satisfies Expression (21) as in the case of the second conventional example, if the left shifter 102 is a 4-bit shifter (16-multiplier), the value corresponding to the value of the register 108 is the remainder of Pa and the modulus n. 32n must be stored in the register 106 in order to obtain the same negative value, so that the multiplexer 11 in FIG.
The value corresponding to the output of 2 is a number greater than or equal to −32n and less than 2n. Further, the output value of the multiplexer 112 is multiplied by 1 to 1
Instead of the bit left shifter 113, it is necessary to place a multiplier that multiplies its corresponding value by a factor of 1 to 8, so that the value s of the accumulation register 114 is -256n≤s <16n (26). Therefore, the number of loops is 129, which is 257 in the second embodiment.
Although it is half the number of times, it needs to be corrected up to 256 times to set the value of s to 0 ≦ s <n, and once because the multiplier is inserted at the position of the left shifter 113 as described above. The time required for the loop is "multiplication time of multiplier + δ". Therefore, even in this case, the calculation of a × b mod n requires a maximum time of (129 + 256) × (multiplication time of the multiplier + δ), which is faster than the processing speed of the second conventional example. It had a problem that it could not.

本発明はかかる点に鑑み、高次のBoothのアルゴリズ
ムを用いて乗数bを2ビットより多いkビットずつ処理
してループ回数を減じ、かつ1回のループ内での処理時
間を1段の加算器の加算時間δとすることにより処理速
度の速い剰余乗算装置を提供することを目的とする。
In view of such a point, the present invention processes the multiplier b by k bits larger than 2 bits by using the higher-order Booth algorithm to reduce the number of loops, and adds one processing time in one loop. It is an object of the present invention to provide a modular multiplication device having a high processing speed by setting the addition time δ of the multiplier.

問題点を解決するための手段 本発明は、第1のレジスタと、第1のレジスタの値を
2のk乗倍(k<2)するkビット左シフタと、左シフ
タの出力のうち整数nの桁数以上の桁が持つ値を整数n
で割った商をqとしたとき左シフタの出力のうち整数n
の桁数以上の桁のビットパターンをアドレスとして積q
×nと積(q+2)×nを同時に出力する記憶部と、左
シフタの出力から記憶部の第1の出力q×nを減算し第
1のレジスタに出力する第1の減算器と、左シフタの出
力から記憶部の第2の出力(q+2)×nを減算する第
2の減算器と、第2の減算器の出力を格納する第2のレ
ジスタと、第1の累算レジスタと、第2の累算レジスタ
と、シフトレジスタと、シフトレジスタの値からk次の
Boothのアルゴリズムを用いて第1の倍数情報と第2の
倍数情報を生成するエンコーダ部と、第1の累算レジス
タの出力を一方の入力としかつ第1の累算レジスタの符
号と第1の倍数情報に基づいて第1のレジスタもしくは
第2のレジスタの何れかを選択して他方の入力としその
演算結果を第1の累算レジスタに出力する第1の演算部
と、第2の累算レジスタの出力を一方の入力としかつ第
2の累算レジスタの符号と第2の倍数情報に基づいて第
1のレジスタもしくは第2のレジスタの何れかを選択し
て他方の入力としその演算結果を第2の累算レジスタに
出力する第2の演算部を備えた剰余乗算装置である。
Means for Solving the Problems According to the present invention, a first register, a k-bit left shifter for multiplying the value of the first register by the power of 2 (k <2), and an integer n of the outputs of the left shifter. The integer n is the value that has more digits than
An integer n of the output of the left shifter, where q is the quotient divided by
Product q with the bit pattern of more digits than
A storage unit that simultaneously outputs xn and a product (q + 2) × n; a first subtractor that subtracts the first output q × n of the storage unit from the output of the left shifter and outputs the result to a first register; A second subtractor for subtracting the second output (q + 2) × n of the storage unit from the output of the shifter, a second register for storing the output of the second subtractor, and a first accumulation register, The second accumulation register, the shift register, and the kth order from the value of the shift register
An encoder unit for generating first multiplex information and second multiplex information using Booth's algorithm, the output of the first accumulation register as one input, and the sign of the first accumulation register and the first accumulation register. A first arithmetic unit for selecting either the first register or the second register based on the multiple information and inputting the other input to the first accumulation register; and a second accumulation unit The output of the register is used as one input, and either the first register or the second register is selected based on the sign of the second accumulation register and the second multiple information, and the other input is used as the operation result. It is a modular multiplication device provided with a second arithmetic unit for outputting to a second accumulation register.

作用 初期時には整数aを第1及び第2のレジスタに、整数
bをシフトレジスタに格納し、記憶部は左シフタの出力
のうち整数nの桁数以上の桁が持つ値を整数nで割った
商をqとしたとき左シフタの出力のうち整数nの桁数以
上の桁のビットパターンをアドレスとして積q×nと積
(q+2)×nを同時に出力するものとしておく。左シ
フタは第1のレジスタの値を2のk乗倍(k>2)す
る。第1の減算器は左シフタの出力から記憶部の第1の
出力q×2を減算し第1のレジスタに出力する。第2の
減算器は同時に、左シフタの出力から記憶部の第2の出
力(q+2)×nを減算して第2のレジスタに出力す
る。同時にエンコーダ部は、シフトレジスタの値からk
次のBoothのアルゴリズムを用いて第1の倍数情報と第
2の倍数情報を生成しておき、第1の演算部は第1の累
算レジスタの出力に対して第1の累算レジスタの符号と
第1の倍数情報に基づいて第1のレジスタもしくは第2
のレジスタの何れかの値を用い第1の累算レジスタの絶
対値が大きくならないように制御して第1の累算レジス
タに出力する。また同時に第2の演算部は第2の累算レ
ジスタの出力に対して第2の累算レジスタの符号と第2
の倍数情報に基づいて第1のレジスタもしくは第2のレ
ジスタの何れかの値を用い累算レジスタの絶対値が大き
くならないよう制御して第2の累算レジスタに出力す
る。このように第1,第2の減算器と第1,第2の演算部が
完全に同期して同時に動作しこの処理が(bの桁数/k+
1)回繰り返される。しかも第1のレジスタの値の範囲
と第2のレジスタの値の範囲が同一(2nの範囲)で従来
に比べて小さいのでその後の補正回数が少なくなる。
At the initial stage of operation, the integer a is stored in the first and second registers and the integer b is stored in the shift register, and the storage unit divides the value of the digit of the integer n of the output of the left shifter by the integer n. It is assumed that when the quotient is q, the product q × n and the product (q + 2) × n are simultaneously output using the bit pattern of the digits of the integer n or more of the outputs of the left shifter as an address. The left shifter multiplies the value in the first register by 2 to the power of k (k> 2). The first subtractor subtracts the first output q × 2 of the storage unit from the output of the left shifter and outputs the result to the first register. At the same time, the second subtractor subtracts the second output (q + 2) × n of the storage unit from the output of the left shifter and outputs the result to the second register. At the same time, the encoder unit calculates k from the value in the shift register.
The first Booth's algorithm is used to generate the first multiple information and the second multiple information, and the first arithmetic unit outputs the code of the first accumulation register to the output of the first accumulation register. And the first register or the second register based on the first multiple information.
The value of any one of the registers is controlled so that the absolute value of the first accumulation register does not increase, and the value is output to the first accumulation register. At the same time, the second arithmetic unit outputs the second accumulation register sign and the second accumulation register to the output of the second accumulation register.
The value of either the first register or the second register is used to control the absolute value of the accumulating register so as not to increase based on the multiple information, and the result is output to the second accumulating register. In this way, the first and second subtractors and the first and second arithmetic units operate in synchronization at the same time, and this processing is performed by (the number of digits of b / k +
1) Repeated once. Moreover, since the value range of the first register and the value range of the second register are the same (range of 2n) and smaller than the conventional one, the number of corrections thereafter becomes small.

実施例 第1図は本発明の実施例における剰余乗算装置のブロ
ック図を示すものである。第1図において、201は被乗
数aもしくは演算の途中結果を格納する513ビットのレ
ジスタ、202はレジスタ1の内容を16倍、即ち4ビット
左シフトする左シフタ、203は左シフタ2の出力の517ビ
ットのうちの上位6ビットをt5,t4,t3,t2,t1,t0とした
ときに t=t5・2516+t4・2515+t3・2514+t2・2513 +t1・2512+t0・2511 (27) をnで割った商をqとすると、商q(q<32)と法nの
積q・nを格納し上記6ビットをアドレスとして積q・
nと積(q+2)・nを同時に出力する2ポート構造の
34ワードのメモリ、204は左シフタ202の出力からメモリ
203の出力q・nを減算する減算器、205は法とする整数
nを格納する512ビットのレジスタ、207は左シフタ202
の出力からメモリ203の出力(q+2)・nを減算する
減算器、208は減算器207の出力を格納する514ビットの
レジスタ、209は初期状態において乗数bを格納する右
4ビットシフトレジスタ、210はシフトレジスタ209の下
位4ビットとそのLSBより1ビット下位で前回のシフト
でシフトアウトされた最上位ビットのあわせて5ビット
を用いて制御線c0,c1,c2,c3,c4,c5を生成するBoothのエ
ンコーダ(第2図参照)、211、212はEORゲート、213は
EORゲート211の出力が0のときにはレジスタ208の出力
を選択しEORゲート211の出力が1のときにはレジスタ20
1の出力を選択して出力するマルチプレクサ、214はEOR
ゲート212の出力が0のときにはレジスタ208の出力を選
択しEORゲート212の出力が1のときにはレジスタ201の
出力を選択して出力するマルチプレクサ、215は2ビッ
ト左シフタ、216は3ビット左シフタ、217は1ビット左
シフタ、218は制御線c0が0のときに左シフタ215の出力
を選択し1のときに左シフタ216の出力を選択して出力
するマルチプレクサ、219は制御線c3が0のときにマル
チプレクサ214の出力を選択し1のときに左シフタ217の
出力を選択して出力するマルチプレクサ、220は517ビッ
トの累算レジスタ、221は515ビットの累算レジスタ、22
2は累算レジスタ220の値に対して制御線c2が1でかつ制
御線c1が0のときにマルチプレクサ218の出力を加算
し、制御線c2が1でかつ制御線c1が1のときにマルチプ
レクサ218の出力を減算し、制御線c2が0のときは累算
レジスタ220の値を更新せず、もしくは所定の演算終了
時累算レジスタ220の正負に応じてレジスタ205の値nま
たは累算レジスタ221の値を加算もしくは減算して累算
レジスタ220に出力する加減算器、223は、累算レジスタ
221の値に対して制御線c5が0のときは値を更新せず、
制御線c5が1でかつ制御線c4が0のときにマルチプレク
サ219の出力を加算し、制御線c5が1でかつ制御線c4が
1のときにマルチプレクサ219の出力を減算する加減算
器である。また、EORゲート211は累算レジスタ220の符
号ビットおよび制御線c1を入力とし、EORゲート212は累
算レジスタ221の符号ビットおよび制御線c4を入力とし
ている。
Embodiment FIG. 1 is a block diagram of a modular multiplication device according to an embodiment of the present invention. In FIG. 1, 201 is a 513-bit register that stores the multiplicand a or the intermediate result of the operation, 202 is a left shifter that shifts the contents of register 1 16 times, that is, 4 bits to the left, and 203 is the output of the left shifter 2, 517. When the upper 6 bits of the bits are t 5 , t 4 , t 3 , t 2 , t 1 , t 0 , t = t 5・ 2 516 + t 4・ 2 515 + t 3・ 2 514 + t 2・ 2 513 + t 1 · 2 512 + t 0 · 2 511 (27) is divided by n, and the quotient is q. The product q · n of the quotient q (q <32) and the modulus n is stored and the above 6 bits are used as the address. q
n and product (q + 2) · n are simultaneously output in a 2-port structure
34 word memory, 204 memory from output of left shifter 202
A subtracter that subtracts the output q · n of 203, 205 is a 512-bit register that stores a modulo integer n, and 207 is a left shifter 202.
, A subtracter for subtracting the output (q + 2) · n of the memory 203 from the output of 208, 208 is a 514-bit register for storing the output of the subtractor 207, 209 is a right 4-bit shift register for storing the multiplier b in the initial state, 210 Generates the control lines c0, c1, c2, c3, c4, c5 using the lower 5 bits of the shift register 209 and 1 bit lower than the LSB and the most significant bit shifted out by the previous shift. Booth encoder (see Fig. 2), 211 and 212 are EOR gates, 213 is
When the output of the EOR gate 211 is 0, the output of the register 208 is selected, and when the output of the EOR gate 211 is 1, the register 20 is selected.
Multiplexer that selects and outputs 1 output, 214 is EOR
A multiplexer that selects the output of the register 208 when the output of the gate 212 is 0 and selects and outputs the output of the register 201 when the output of the EOR gate 212 is 1, 215 is a 2-bit left shifter, 216 is a 3-bit left shifter, 217 is a 1-bit left shifter, 218 is a multiplexer that selects the output of the left shifter 215 when the control line c0 is 0, and selects and outputs the output of the left shifter 216 when the control line c0 is 1, and 219 is the control line c3 whose 0 is When the output of the multiplexer 214 is selected and the output of the left shifter 217 is selected and output when it is 1, 220 is a 517-bit accumulation register, 221 is a 515-bit accumulation register, 22
2 is a multiplexer when the control line c2 is 1 and the control line c1 is 0 and the output of the multiplexer 218 is added to the value of the accumulation register 220, and when the control line c2 is 1 and the control line c1 is 1. The output of 218 is subtracted, the value of the accumulation register 220 is not updated when the control line c2 is 0, or the value n of the register 205 or the accumulation register is determined according to the sign of the accumulation register 220 at the end of a predetermined operation. An adder / subtractor that adds or subtracts the value of 221 and outputs it to the accumulation register 220, 223 is an accumulation register
When the control line c5 is 0 for the value of 221, the value is not updated,
The adder / subtractor adds the output of the multiplexer 219 when the control line c5 is 1 and the control line c4 is 0, and subtracts the output of the multiplexer 219 when the control line c5 is 1 and the control line c4 is 1. Further, the EOR gate 211 receives the sign bit of the accumulation register 220 and the control line c1, and the EOR gate 212 receives the sign bit of the accumulation register 221 and the control line c4.

以降、レジスタ201に格納された値をPa、レジスタ208
に格納された値をNa、累算レジスタ220に格納された値
をSL、累算レジスタ220に格納された値をSR表わすもの
とする。
After that, the value stored in the register 201 is Pa, the register 208
Let Na be the value stored in, the value stored in accumulation register 220 be SL, and the value stored in accumulation register 220 be SR.

4次のBoothのエンコーダを用いた剰余乗算方法は次
の方法によってa×b mod nを求めるものである。
The remainder multiplication method using a fourth-order Booth encoder is to obtain a × b mod n by the following method.

ここで b-1=0 (30) F4(bi)=(b4i-1+b4i+2b4i+1+4b4i+2−8b4i+3
(31) とおいた。
Where b -1 = 0 (30) F 4 (b i ) = (b 4i-1 + b 4i + 2b 4i + 1 + 4b 4i + 2 −8b 4i + 3 )
(31)

このような4次のBoothの方式における各B4i-1,b4i,b
4i+1,b4i+2,b4i+3に対するF4(bi)の値、F4(bi)の値
の分解方法およびエンコーダ210の制御線出力c0,c1,c2,
c3,c4,c5の真理値表を第2図に示す。第2図に示したよ
うに乗数F4(bi)の値をFL(bi)とFR(bi)の二つの値
に分解し、それぞれ独立に累算を行なう。即ち、(29)
式を として計算を行ない、(32)式の第1項は累算レジスタ
220で累算を行なうと同時に第2項は累算レジスタ221で
累算を行なう。しかも本発明はそれぞれの累算レジスタ
に対して独立に、その値が正の場合は負の部分積を加算
し、その値が正の場合は負の部分積を加算して、各々の
累算値が所定の範囲を越えないように制御するものであ
る。
B 4i−1 , b 4i , b in such a fourth-order Booth system
4i + 1, b 4i + 2 , b 4i + value of 3 F 4 for (b i), F 4 control lines of the decomposition process and the encoder 210 of the value of (b i) output c0, c1, c2,
The truth table of c3, c4, c5 is shown in FIG. As shown in FIG. 2, the value of the multiplier F 4 (b i ) is decomposed into two values of FL (b i ) and FR (b i ) and the accumulation is performed independently. That is, (29)
Expression , And the first term of equation (32) is the accumulation register
At 220, the second term is simultaneously accumulated by the accumulation register 221. Moreover, the present invention independently adds to each accumulation register, a negative partial product when the value is positive, and adds a negative partial product when the value is positive to obtain each accumulation register. The value is controlled so as not to exceed a predetermined range.

第2図からわかるように、制御線c0はFL(bi)の絶対
値が8であることを、制御線c1はFL(bi)が負であるこ
とを、制御線c2はFL(bi)の絶対値が0でないことを論
理1によって示している。また、制御線c3はFR(bi)の
絶対値が2であることを、制御線c4はFR(bi)が負であ
ることを、制御線c5はFR(bi)の絶対値が0でないこと
を論理1によって示している。
As can be seen from FIG. 2, the control line c0 has an absolute value of FL (b i ) of 8, the control line c1 has a negative FL (b i ), and the control line c2 has a value of FL (b i ). A logical 1 indicates that the absolute value of i ) is not 0. Further, the control line c3 is an absolute value of 2 for FR (b i), the control line c4 is FR (b i) is negative, the absolute value of the control line c5 is FR (b i) is Not 0 is indicated by logic 1.

本実施例のアルゴリズムをまずC言語風に記述すると
次のようになる。
The algorithm of this embodiment is first described in C language style as follows.

Pa=Na=a; SL=SR=0; for(i=0;i<=512;i++4) { if((FL(bi)==0)SL=SL; else if((sign(SL)^sign(FL(bi))==1) SL=SL+(FL(bi))*Pa; else SL=SL+(FL(bi))*Na; if((FR(bi)==0)SR=SR; else if((sign(SR)^sign(FR(bi))==1) SR=SR+(FR(bi))*Pa; else SR=SR+(FR(bi))*Na; Na=16*Pa−(q+2)*n; Pa=16*Pa−q*n; } SL=SL+SR; while(SL<0) SL=SL+n; while(SL>=n) SL=SL−n; この結果SL=a×b mod nとなる。ここで、b512=b
513=b514=0であり、記号^はビットごとの排他的論
理和演算を示す。
Pa = Na = a; SL = SR = 0; for (i = 0; i <= 512; i ++ 4) {if ((FL (b i ) == 0) SL = SL; else if ((sign (SL) ^ sign (FL (b i )) == 1) SL = SL + (FL (b i )) * Pa; else SL = SL + (FL (b i )) * Na; if ((FR (b i ) == 0) SR = SR; else if ((sign (SR) ^ sign (FR (b i )) == 1) SR = SR + (FR (b i )) * Pa; else SR = SR + (FR (b i ) ) * Na; Na = 16 * P a - (q + 2) * n; P a = 16 * P a -q * n;} SL = SL + SR; while (SL <0) SL = SL + n; while (SL> = n As a result, SL = a × b mod n, where b 512 = b
513 = b 514 = 0, and the symbol ^ indicates a bitwise exclusive OR operation.

以上のように構成され、上記アルゴリズムを実現した
本実施例の剰余乗算装置について以下その動作を説明す
る。
The operation of the modular multiplication device of this embodiment configured as above and realizing the above algorithm will be described below.

(i) まず被乗数aをレジスタ201とレジスタ208に格
納し、乗数bをシフトレジスタ209に格納し、法となる
整数nをレジスタ205に格納する。また累算レジスタ22
0、221を0にリセットする。ここで、Pa=Na=a、SL=
SR=0である。
(I) First, the multiplicand a is stored in the registers 201 and 208, the multiplier b is stored in the shift register 209, and the modulo integer n is stored in the register 205. Also the accumulation register 22
0 and 221 are reset to 0. Here, Pa = Na = a, SL =
SR = 0.

(ii) 左シフタ202においてはレジスタ202の内容Paを
4ビット左にシフトし16Pa((i)の直後では16a)を
得る。左シフタ202の出力517ビットのうちの上位6ビッ
トをアドレスとしてメモリ203をアクセスする。メモリ2
03は(27)式の値tをnで割った商qと法nとの積q・
nを減算器204に出力し、積(q+2)・nを減算器207
に出力する。減算器204においては左シフタ202の出力16
Paからメモリ3の出力q・nを減算しその結果“16Pa−
q・n"をレジスタ201に出力する。(i)の直後ではこ
の値は“16a−q・n"である。
(Ii) In the left shifter 202, the content Pa of the register 202 is shifted to the left by 4 bits to obtain 16Pa (16a immediately after (i)). The memory 203 is accessed using the upper 6 bits of the output 517 bits of the left shifter 202 as an address. Memory 2
03 is the product of the quotient q obtained by dividing the value t in equation (27) by n and the modulus n.
n is output to the subtractor 204, and the product (q + 2) · n is subtracted by the subtractor 207.
Output to. In the subtractor 204, the output 16 of the left shifter 202
The output q · n of the memory 3 is subtracted from Pa and the result is “16Pa−
q.n "is output to the register 201. Immediately after (i), this value is" 16a-q.n ".

ここで、左シフタ202の出力の下位511ビットをasとお
き、(27)式のtをnで割った剰余をrとおくと、 as<n (28) r<n (29) であり、 16Pa=t+as (30) t=q・n+r (31) (30),(31)式より 16Pa=q・n+r+as ∴16Pa−q・n=r+as (32) (28),(29)式によりレジスタ201に格納され更新
された値Paは Pa=16Pa−q・n=r+as<2n (33) この結果は16Paをnで割った剰余系の数であって513
ビットで表わされる数となる。従ってここにおける処理
は(33)式を求めてレジスタ201に格納することであ
り、この値PaはもとのPaの値を16倍した数の法をnとす
る剰余系の数であって 0≦Pa<2n (34) なる数である。
Here, if the lower 511 bits of the output of the left shifter 202 are set as a s , and the remainder obtained by dividing t in Expression (27) by n is set as r, then a s <n (28) r <n (29) There, 16Pa = t + a s ( 30) t = q · n + r (31) (30), (31) from equation 16Pa = q · n + r + a s ∴16Pa-q · n = r + a s (32) (28), (29 ) stored updated value Pa in the register 201 Pa = 16Pa-q · n = r + a s <2n (33) by equation results is the number of coset obtained by dividing 16 Pa at n 513
It is a number expressed in bits. Therefore, the processing here is to obtain the equation (33) and store it in the register 201, and this value Pa is the number of cosets with n being the modulus of the original value of Pa multiplied by 16 ≦ Pa <2n (34).

(iii) (ii)と同時に、減算器207においては左シフ
タ202の出力16Paからメモリ3の出力(q+2)・nを
減算しその結果“16Pa−(q+2)・n"をレジスタ208
に出力しNaとする。即ち Na=16Pa−(q+2)・n =16Pa−q・n−2n (33)式を用いると −2n≦Na<0 (35) 従ってNaは法をnとする剰余系の中で(33)式で計算
されたPaと同値な負の値である。
(Iii) At the same time as (ii), the subtractor 207 subtracts the output (q + 2) · n of the memory 3 from the output 16Pa of the left shifter 202, and as a result, “16Pa− (q + 2) · n” is stored in the register 208.
And output it as Na. That is, Na = 16Pa- (q + 2) .n = 16Pa-q.n-2n (33) is used, -2n≤Na <0 (35) Therefore, Na is (33) in the remainder system modulo n. It is a negative value that is equivalent to Pa calculated by the formula.

(iv) マルチプレクサ213においてはEORゲート211の
出力が0(即ち累算レジスタ220の値SLが正でかつFL(b
i)が正のときもしくはSLが負でかつFL(bi)が負であ
る)のときレジスタ208の値Na<0を選択し、EORゲート
211の出力が1(即ち累算レジスタ220の値SLが正でかつ
FL(bi)が負のときもしくはSLが負でかつFL(bi)が正
である)のときにはレジスタ201の値Paを選択する。左
シフタ215および左シフタ216はマルチプレクサ218の出
力をそれぞれ4倍、8倍にする。マルチプレクサ218に
おいては制御線c0が1のとき即ちFL(bi)の絶対値が8
のとき左シフタ216の出力を選択し、制御線c0が0のと
き即ちFL(bi)の絶対値が4または0のとき左シフタ21
5の出力を選択して加減算器222に与える。加減算器222
においては、もし制御線c2が1で制御線c1が0であった
場合即ちFL(bi)が0でない正の値のとき累算レジスタ
220にマルチプレクサ218の出力を加算し、制御線c2が1
で制御線c1が1であった場合即ちFL(bi)が0でない負
の値のとき累算レジスタ220からマルチプレクサ218の出
力を減算して更新し、制御線c2が0であった場合、累算
レジスタ220の値を更新しない。このようにしてSLが正
(0を含む)のときには負の値が加えられ、負のときは
正の値が加えられる。従って累算レジスタ220の値SLは
(34),(35)式により −16n≦s<16n (36) となる。
(Iv) In the multiplexer 213, the output of the EOR gate 211 is 0 (that is, the value SL of the accumulation register 220 is positive and FL (b
When i ) is positive or SL is negative and FL (b i ) is negative), the value Na <0 in register 208 is selected and the EOR gate is selected.
The output of 211 is 1 (that is, the value SL of the accumulation register 220 is positive and
When FL (b i ) is negative, or SL is negative and FL (b i ) is positive), the value Pa of the register 201 is selected. The left shifter 215 and the left shifter 216 multiply the output of the multiplexer 218 by 4 times and 8 times, respectively. In the multiplexer 218, when the control line c0 is 1, that is, the absolute value of FL (b i ) is 8
When the control line c0 is 0, that is, when the absolute value of FL (b i ) is 4 or 0, the left shifter 21 is selected.
The output of 5 is selected and given to the adder / subtractor 222. Adder / subtractor 222
In, if the control line c2 is 1 and the control line c1 is 0, that is, if FL (b i ) is a non-zero positive value, the accumulation register
The output of the multiplexer 218 is added to 220, and the control line c2 becomes 1
When the control line c1 is 1, that is, when FL (b i ) is a non-zero negative value, the output of the multiplexer 218 is subtracted from the accumulation register 220 and updated, and when the control line c2 is 0, Do not update the value in accumulation register 220. In this way, a negative value is added when SL is positive (including 0), and a positive value is added when SL is negative. Therefore, the value SL of the accumulation register 220 is −16n ≦ s <16n (36) according to the equations (34) and (35).

(v) マルチプレクサ214においてはEORゲート212の
出力が0(即ち累算レジスタ221の値SRが正でかつFR(b
i)が正のときもしくはSRが負でかつFR(bi)が負であ
る)のときレジスタ208の値Na<0を選択し、EORゲート
212の出力が1(即ち累算レジスタ221の値SRが正でかつ
FR(bi)が負のときもしくはSRが負でかつFR(bi)が正
である)のときにはレジスタ201の値Paを選択する。左
シフタ217はマルチプレクサ217の出力を2倍する。マル
チプレクサ219においては制御線c3が1のとき即ちFR(b
i)の絶対値が2のとき左シフタ217の出力を選択し、制
御線c3が0のとき即ちFR(bi)の絶対値が1または0の
ときマルチプレクサ214の出力を選択して加減算器223に
与える。加減算器223においては、もし制御線c5が1で
制御線c4が0であった場合即ちFR(bi)が0でない正の
値のとき累算レジスタ221にマルチプレクサ219の出力を
加算し、制御線c5が1で制御線c4が1であった場合即ち
FR(bi)が0でない負の値のとき累算レジスタ221から
マルチプレクサ219の出力を減算して更新し、制御線c5
が0であった場合、累算レジスタ221の値を更新しな
い。このようにしてSRが正(0を含む)のときには負の
値が加えられ、負のときは正の値が加えられる。従って
累算レジスタ221の値SRは(34),(35)式により −4n≦SR<4n (37) となる。その後シフトレジスタ209を4ビット右にシフ
トさせる。
(V) In the multiplexer 214, the output of the EOR gate 212 is 0 (that is, the value SR of the accumulation register 221 is positive and FR (b
When i ) is positive or SR is negative and FR (b i ) is negative), the value Na <0 in register 208 is selected and the EOR gate is selected.
The output of 212 is 1 (that is, the value SR of the accumulation register 221 is positive and
When FR (b i ) is negative, or SR is negative and FR (b i ) is positive), the value Pa of the register 201 is selected. The left shifter 217 doubles the output of the multiplexer 217. In the multiplexer 219, when the control line c3 is 1, that is, FR (b
When the absolute value of i ) is 2, the output of the left shifter 217 is selected, and when the control line c3 is 0, that is, when the absolute value of FR (b i ) is 1 or 0, the output of the multiplexer 214 is selected to add / subtract Give to 223. In the adder / subtractor 223, if the control line c5 is 1 and the control line c4 is 0, that is, if FR (b i ) is a positive value other than 0, the output of the multiplexer 219 is added to the accumulation register 221 to control If the line c5 is 1 and the control line c4 is 1,
When FR (b i ) is a non-zero negative value, the output of the multiplexer 219 is subtracted from the accumulation register 221 and updated, and the control line c5
Is 0, the value of the accumulation register 221 is not updated. Thus, a negative value is added when SR is positive (including 0), and a positive value is added when SR is negative. Therefore, the value SR of the accumulation register 221 is −4n ≦ SR <4n (37) according to the equations (34) and (35). After that, the shift register 209 is shifted to the right by 4 bits.

以上の(ii),(iii),(iv),(v)の処理は同
期して同時に実行され、これらの処理はループとして合
計129回繰り返される。
The above processes (ii), (iii), (iv), and (v) are synchronously and simultaneously executed, and these processes are repeated 129 times in total as a loop.

以上の処理(ループ)を合計129回実行終了した時点
でSRの値をSLに加え合わせこれを0以上n未満の数とし
て結果を得る。この補正を次の手順で行なう。即ち、加
減算器222を用いて累算レジスタ220に累算レジスタ221
の値を加算する。(36),(37)式により、 −20n≦SL<20n (38) ここでもしSLが負ならば多くとも20回だけ整数nを加
算し、負ならば多くとも19回だけ整数nを減算すること
により 0≦SL<n (39) とする。この補正処理は加減算器222を用いて累算レジ
スタ220値にレジスタ205の値nを加算もしくは減算する
ことによって行なう。
When the above processing (loop) is executed 129 times in total, the value of SR is added to SL and the result is obtained as a number of 0 or more and less than n. This correction is performed in the following procedure. That is, using the adder / subtractor 222, the accumulation register 220 is added to the accumulation register 221.
The value of is added. From equations (36) and (37), −20n ≦ SL <20n (38) If SL is negative, add integer n at most 20 times, and if negative, subtract integer n at most 19 times. By doing so, 0 ≦ SL <n (39). This correction processing is performed by using the adder / subtractor 222 to add or subtract the value n of the register 205 to the value of the accumulation register 220.

このようにして本実施例において剰余乗算a×b mod
nが実行され、結果は累算レジスタ220に格納される。
Thus, in this embodiment, the modular multiplication a × b mod
n is executed and the result is stored in the accumulation register 220.

従って、本実施例において減算器204および207、加減
算器222,223の演算速度をいずれもδとすると、a×b m
od nの演算を行なうためには、最大約 (129+20)δ の時間が必要なだけであり、上記第2の従来例に比べて
も約2倍の速度が実現できる。
Therefore, in the present embodiment, if the calculation speeds of the subtracters 204 and 207 and the adders / subtractors 222 and 223 are both δ, then a × bm
In order to calculate od n, only a maximum time of (129 + 20) δ is required, and a speed about twice that of the second conventional example can be realized.

以上のように、本実施例によれば24i・aの法をnと
する剰余と同値で所定の範囲にある正の値Paと負の値Na
を同一のメモリを用いて生成することができ、また4次
のboothのアルゴリズムを用いたときに発生する倍数F4
(bi)を2つの倍数FL(bi)とFR(bi)に分解し、部分
積FL(bi)24iの剰余数と部分積FR(bi)24iの剰余数の
それぞれに対して独立に累算を行ない、かつその累算時
にはそれぞれこれまでの累算結果が負のときには部分積
の正の剰余数を加算し、これまでの累算結果が正のとき
には部分積の同値な負の剰余数を加算することにより各
部分積を一定の範囲におさえ、また乗算器を用いること
なく1回のループにかかる演算速度を加算器1段の演算
速度とすることにより、従来より2倍の速度をもつ剰余
乗算装置を実現することができる。
As described above, according to the present embodiment, the positive value Pa and the negative value Na within the predetermined range are the same as the remainder with the modulus of 24 i · a being n.
Can be generated using the same memory, and is a multiple F 4 that occurs when the fourth-order booth algorithm is used.
(B i ) is decomposed into two multiples FL (b i ) and FR (b i ), and the partial product FL (b i ) 2 4i and the partial product FR (b i ) 2 4i When the cumulative result so far is negative, the positive remainder of the partial product is added, and when the cumulative result so far is positive, the partial product By keeping the partial products within a certain range by adding the same number of negative remainders, and by using the operation speed of one loop as the operation speed of one adder without using a multiplier, It is possible to realize a modular multiplication device having twice the speed.

なお、本実施例においては乗数bを1ループ当たり4
ビットずつ処理して、4次のBoothのアルゴリズムを用
いるとしたが、本発明では1ループ当たりの処理幅を任
意のビット幅で行ないさらに高次のBoothのアルゴリズ
ムを用いて部分積を求め、これを分割して同様の処理を
行なうようにしてもよい。
In this embodiment, the multiplier b is set to 4 per loop.
Although the fourth-order Booth algorithm is used by processing bit by bit, in the present invention, the processing width per loop is performed with an arbitrary bit width, and the partial product is obtained by using the higher-order Booth algorithm. May be divided and the same processing may be performed.

発明の効果 以上説明したように、本発明によれば高次のBoothの
アルゴリズムを用いて乗数を2ビットより多いビットず
つ処理してループ数を減じ、かつ1回のループ内での処
理時間を1段の加算時間とすることにより処理速度の速
い剰余乗算装置を得ることができ、その実用的効果はき
わめて大きいものである。
As described above, according to the present invention, the multiplier is processed bit by bit more than 2 bits by using the higher-order Booth algorithm to reduce the number of loops, and the processing time in one loop is reduced. By making the addition time of one stage, it is possible to obtain a modular multiplication device with a high processing speed, and its practical effect is extremely large.

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

第1図は本発明における実施例の剰余乗算装置のブロッ
ク図、第2図は本発明における実施例のBoothのエンコ
ーダ210の真理値表図、第3図は第1の従来例の剰余乗
算装置のブロック図、第4図は第2の従来例の剰余乗算
装置のブロック図、第5図は第2の従来例の剰余乗算装
置のBoothのエンコーダ110の真理値表図である。 201,208……レジスタ、202……左シフタ、203……メモ
リ、204,207……減算器、209……シフトレジスタ、210
……Boothエンコーダ、220,221……累算レジスタ、213,
214……マルチプレクサ、222,223……加減算器。
FIG. 1 is a block diagram of a modular multiplication device of an embodiment of the present invention, FIG. 2 is a truth table diagram of a Booth encoder 210 of an embodiment of the present invention, and FIG. 3 is a modular multiplication device of a first conventional example. FIG. 4, FIG. 4 is a block diagram of a remainder multiplication device of the second conventional example, and FIG. 5 is a truth table diagram of Booth encoder 110 of the remainder multiplication device of the second conventional example. 201,208 …… Register, 202 …… Left shifter, 203 …… Memory, 204,207 …… Subtractor, 209 …… Shift register, 210
...... Booth encoder, 220,221 …… Accumulation register, 213,
214 ... Multiplexer, 222, 223 ... Adder / subtractor.

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】a,b,mを正の整数とするとき、整数aと整
数bの積a×bを予め定められたmビットの正の整数n
で割った剰余を計算する剰余乗算装置であって、第1の
レジスタと、上記第1のレジスタの値を2のk乗倍(k
>2)するkビット左シフタと、上記左シフタの出力の
うち、mビットより上位のビットパターンをLとして、
t=L×2m-1を整数nで割った商をqとしたとき、上記
Lをアドレスとして積q×nと積(q+2)×nを同時
に出力する記憶部と、上記左シフタの出力から上記記憶
部の第1の出力q×nを減算し上記第1のレジスタに出
力する第1の減算器と、上記左シフタの出力から上記記
憶部の第2の出力(q+2)×nを減算する第2の減算
器と、上記第2の減算器の出力を格納する第2のレジス
タと、第1の累算レジスタと、第2の累算レジスタと、
シフトレジスタと、上記シフトレジスタの値からk次の
Boothのアルゴリズムを用いて第1の倍数情報と第2の
倍数情報を生成するエンコーダ部と、上記第1の累算レ
ジスタの出力を一方の入力としかつ上記の第1の累算レ
ジスタの符号と上記第1の倍数情報に基づいて上記第1
のレジスタもしくは上記第2のレジスタの何れかを選択
して他方の入力としその演算結果を上記第1の累算レジ
スタに出力する第1の演算部と、上記第2の累算レジス
タの出力を一方の入力としかつ上記第2の累算レジスタ
の符号と上記第2の倍数情報に基づいて上記第1のレジ
スタもしくは上記第2のレジスタの何れかを選択して他
方の入力としその演算結果を上記第2の累算レジスタに
出力する第2の演算部を備えたことを特徴とする剰余乗
算装置。
1. When a, b, m are positive integers, a product a × b of the integer a and the integer b is a predetermined m-bit positive integer n.
A modular multiplication device for calculating a remainder divided by, wherein the value of the first register and the value of the first register are multiplied by 2 to the power of k (k
> 2) k-bit left shifter and the output of the above left shifter, the bit pattern higher than m bits is L,
When q is a quotient obtained by dividing t = L × 2 m-1 by an integer n, a storage unit that simultaneously outputs the product q × n and the product (q + 2) × n with L as an address, and the output of the left shifter From the output of the left shifter to the first output q × n of the storage unit and output to the first register, and the second output (q + 2) × n of the storage unit from the output of the left shifter. A second subtractor for subtracting, a second register for storing the output of the second subtractor, a first accumulation register, a second accumulation register,
From the shift register and the value of the above shift register,
An encoder section for generating first multiplex information and second multiplex information using Booth's algorithm, an output of the first accumulation register as one input, and a code of the first accumulation register. The first based on the first multiple information
Or the second register and selects the other input as the other input to output the operation result to the first accumulation register and the output of the second accumulation register. One of the inputs is selected and either the first register or the second register is selected based on the sign of the second accumulation register and the second multiple information, and the other input is selected. A modular multiplication device comprising a second arithmetic unit for outputting to the second accumulation register.
JP62090264A 1987-04-13 1987-04-13 Modular multiplication Expired - Fee Related JP2558687B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP62090264A JP2558687B2 (en) 1987-04-13 1987-04-13 Modular multiplication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP62090264A JP2558687B2 (en) 1987-04-13 1987-04-13 Modular multiplication

Publications (2)

Publication Number Publication Date
JPS63255737A JPS63255737A (en) 1988-10-24
JP2558687B2 true JP2558687B2 (en) 1996-11-27

Family

ID=13993644

Family Applications (1)

Application Number Title Priority Date Filing Date
JP62090264A Expired - Fee Related JP2558687B2 (en) 1987-04-13 1987-04-13 Modular multiplication

Country Status (1)

Country Link
JP (1) JP2558687B2 (en)

Also Published As

Publication number Publication date
JPS63255737A (en) 1988-10-24

Similar Documents

Publication Publication Date Title
JP3784156B2 (en) Modular multiplication method
EP0566498B1 (en) Digital signature device and process
US8504602B2 (en) Modular multiplication processing apparatus
US7363335B2 (en) Modular arithmetic apparatus and method selecting a base in the residue number system
US4949293A (en) Method and apparatus for computing residue with respect to arbitrary modulus
US5261001A (en) Microcircuit for the implementation of RSA algorithm and ordinary and modular arithmetic, in particular exponentiation, with large operands
KR970007613A (en) SRT hardware and square root units that generate multiple share digits per clock cycle
JP2585649B2 (en) Division circuit
US7412474B2 (en) Montgomery modular multiplier using a compressor and multiplication method
JP3302043B2 (en) Encryption communication method and system
JP2004258141A (en) Arithmetic unit for multiple length arithmetic of montgomery multiplication residues
Tynymbayev et al. Devices for multiplying modulo numbers with analysis of the lower bits of the multiplier
JP2558687B2 (en) Modular multiplication
RU2348965C1 (en) Computing mechanism
KR100670780B1 (en) Apparatus for hybrid multiplier in GF2^m and Method for multiplying
JP3660075B2 (en) Dividing device
JP5225115B2 (en) NAF converter
KR100480997B1 (en) APPARATUS OF FIELD MULTIPLICATION OVER GF(p) AND GF(2^m)
JP2553548B2 (en) Multiplicative residue computing device
JPH0727326B2 (en) Modular multiplication
AU2021105371A4 (en) VLSI Architecture: Low-Cost High-Performance VLSI Design and Architecture for Montgomery Modular Large Digit Multiplication.
JP5606516B2 (en) NAF converter
Huai et al. Efficient architecture for long integer modular multiplication over Solinas prime
JPH03250314A (en) Arithmetic unit for multiplication remainder
US7471789B2 (en) Encryption circuit achieving higher operation speed

Legal Events

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