JP3555091B2 - Method and apparatus for modular exponentiation operation - Google Patents

Method and apparatus for modular exponentiation operation Download PDF

Info

Publication number
JP3555091B2
JP3555091B2 JP28685394A JP28685394A JP3555091B2 JP 3555091 B2 JP3555091 B2 JP 3555091B2 JP 28685394 A JP28685394 A JP 28685394A JP 28685394 A JP28685394 A JP 28685394A JP 3555091 B2 JP3555091 B2 JP 3555091B2
Authority
JP
Japan
Prior art keywords
data
storage means
bits
data storage
input
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP28685394A
Other languages
Japanese (ja)
Other versions
JPH08147266A (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.)
NTT Electronics Corp
Nippon Telegraph and Telephone Corp
Original Assignee
NTT Electronics Corp
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 NTT Electronics Corp, Nippon Telegraph and Telephone Corp filed Critical NTT Electronics Corp
Priority to JP28685394A priority Critical patent/JP3555091B2/en
Publication of JPH08147266A publication Critical patent/JPH08147266A/en
Application granted granted Critical
Publication of JP3555091B2 publication Critical patent/JP3555091B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Complex Calculations (AREA)

Description

【0001】
【産業上の利用分野】
本発明は、冗長2進演算方法を利用して桁数の多い羃乗剰余演算を高速に行う方法及びその装置に関するものである。
【0002】
【従来の技術】
羃乗剰余演算は乗算及び剰余算の繰返しにより実行できるが、桁数の多い乗算及び剰余算を高速に行おうとすると、桁上がり・桁借りのキャリーの伝搬遅延の問題が顕著になる。そこで、従来より、キャリーの伝搬を防ぐ工夫をなした演算方法が種々提案されているが、そのうちの一つに冗長2進演算方法がある(例えば、IEEE JOURNAL OF SOLID−STATE CIRCUITS, Vol.25, No.3, June, 1990, A.Vandemeulebroecke, E.Vanzieleghem, T.Denayer and P.G.A.Jespers“A New Carry−Free Division Algorithm and its Application to a Single−Chip 1024−b RSA Processor ”参照)。
【0003】
【発明が解決しようとする課題】
ところが、この冗長2進演算方法では、除算や剰余算を行う場合、法の最上位ビットが常に“1”でなければならないという制約があり、その結果、法のビット数が限定されてしまうという問題があった。
【0004】
本発明の目的は、法の最上位ビットが“1”でなくても冗長2進演算方法による羃乗剰余演算を可能とする方法及びその装置を提供することにある。
【0005】
【課題を解決するための手段】
本発明では、前記目的を達成するため、法Nと該法N以下の自然数からなる数A及び羃指数Bとを入力し、法Nがdビットに限定される冗長2進演算方法を利用して羃乗剰余演算R=Amod Nを行い、少なくとも演算結果の剰余Rを出力する羃乗剰余演算方法及び装置において、法Nのデータを上位からmビット毎に入力用前段データ記憶手段に取り込むとともに該法Nのデータが何mビット入力されたかをデータカウント手段で計測し、入力用前段データ記憶手段に最初に取り込まれたデータの先頭から何ビット目に最初に“1”が現れたかを検出し、該検出したビット数をビットシフト量として決定し、入力用前段データ記憶手段内のデータを入力用後段データ記憶手段に順次転送し、入力用前段データ記憶手段内のデータを下位mビットとし入力用後段データ記憶手段内のデータを上位mビットとして、その2mビットを前記ビットシフト量だけ上位にシフトし、該シフトした後の2mビットのデータの上位mビットをmビットシフトデータ記憶手段に格納し、法Nのデータ入力完了後、データカウント手段の値とmビットシフトデータ記憶手段の容量/mとの差分をシフト量としてシフト量記憶手段に記憶し、mビットシフトデータ記憶手段のデータをシフト量記憶手段の値だけ上位にmビット単位にシフトして法記憶手段に記憶し、数Aのデータを上位からmビット毎に入力用前段データ記憶手段に取り込むとともに該数Aのデータが何mビット入力されたかをデータカウント手段で計測し、入力用前段データ記憶手段内のデータを入力用後段データ記憶手段に順次転送し、入力用前段データ記憶手段内のデータを下位mビットとし入力用後段データ記憶手段内のデータを上位mビットとして、その2mビットを前記ビットシフト量だけ上位にシフトし、該シフトした後の2mビットのデータの上位mビットをmビットシフトデータ記憶手段に格納し、数Aのデータ入力完了後、mビットシフトデータ記憶手段のデータをシフト量記憶手段の値だけ上位にmビット単位にシフトして数記憶手段に記憶し、羃指数Bのデータを羃指数記憶手段に直接取り込んで記憶するとともに該羃指数Bのデータが何ビット入力されたかをデータカウント手段で計測して記憶し、記憶された法N、数A及び羃指数Bのデータを使用して冗長2進演算手段に羃乗剰余演算を行わせ、演算結果の剰余Rを剰余記憶手段に記憶し、剰余記憶手段より剰余Rのデータを上位からmビット毎に出力用前段データ記憶手段に取り込み、出力用前段データ記憶手段内のデータを出力用後段データ記憶手段に順次転送し、出力用前段データ記憶手段内のデータを下位mビットとし出力用後段データ記憶手段内のデータを上位mビットとして、その2mビットを前記ビットシフト量だけ下位にシフトして出力することを特徴とする。
【0006】
【作用】
従来の冗長2進演算方法を利用した演算器では法の最上位ビットを“1”に制限している。そのため、法のビット数も一意に限定されてしまう。一方、本発明の羃乗剰余演算方法及び装置によれば、法を任意にシフトして入力する手段を有し、これを利用することにより法を格納する時は最上位ビットが必ず“1”になるようにすることができる。従って、法レジスタのビット長以下であればいかなるビット長でも羃乗剰余演算を実行することが可能になり、冗長2進数を利用した羃乗剰余演算を法におけるビット長を限定することなく行うことができるようになる。
【0007】
【実施例】
従来から多数ビット長で高速処理が必要な四則演算に用いられてきた冗長2進演算器に、本発明のパラメタの入出力補正部を加えることにより、法レジスタ以下のビット長であれば、法のビット長に制限のない羃乗剰余演算を行うことができる。
【0008】
まず、乗算及び剰余算を組み合わせることにより、法を任意のビット長とした羃乗剰余演算が実行可能であることを示す。
【0009】
羃乗剰余演算R=Amod Nは、kビットの羃指数Bのデータが入力された時、k≧i≧1なるiを用いて、
B=b×2k−1 +bk−1 ×2k−2 +……+b×2i−1 +……+b×2+b×2
とし、

Figure 0003555091
で求めることができる。即ち、羃乗剰余演算は乗算及び剰余算の繰り返しにより求めることができる。
【0010】
この演算処理を冗長2進演算方法により実行するには、法Nのビット長が冗長2進演算器のビット長と等しくなければならないことは前述した通りであるが、法Nのビット長が冗長2進演算器のビット長より短い時、N・2が冗長2進演算器のビット長と等しくなるようにjを決定し、
Figure 0003555091
を実行すれば、目的のR=Amod Nの演算を実行することができる。
【0011】
羃乗剰余演算としてAmod Nの演算を行い、演算結果の剰余Rを出力する例について述べる。この例は以下のフェーズに分けることができる。
(1)演算に必要な3つのパラメタのパラメタレジスタへの入力
(2)冗長2進演算部へ各パラメタを入力するためのパラメタ変換
(3)冗長2進演算部での羃乗剰余演算
(4)演算結果の出力
以下、各フェーズ毎に説明する。
【0012】
図1は本発明の一実施例を示すもので、図中、1はパラメタ入出力補正部、2はパラメタレジスタ部、3はパラメタ変換部、4は改良型冗長2進演算部、5は状態遷移制御部である。
【0013】
図2はパラメタ入出力補正部1及びパラメタレジスタ部2の詳細を示すもので、ここではデータの入出力を8ビットのデータバスで行う例を示す。
【0014】
カウンタ部6は入力される8ビットのデータをカウントアップする。入力用前段バッファ部7は8ビットのデータを蓄積するレジスタである。第1オクテット先頭“1”検出部8は8ビットのデータの先頭から何ビット目に“1”があるかを検出する。ビットシフト量決定部9は第1オクテット先頭“1”検出部8の値からビットシフト量を決定する。入力用後段バッファ部10は8ビットのデータを蓄積するレジスタである。
【0015】
入力用ビットシフト部11は16ビット入力で上位8ビット出力のバレルレジスタであり、シフト量はビットシフト量決定部9で決まる。バイトシフト部12は8ビットデータを上位に1バイト単位で任意にシフトさせることができるレジスタである。バイトシフト量記憶部13は法N及び数A入力時のバイトシフト量を記憶しておく。
【0016】
出力用前段バッファ部14は8ビットのデータを蓄積するレジスタである。出力用後段バッファ部15は8ビットのデータを蓄積するレジスタである。出力用ビットシフト部16は16ビット入力で上位8ビット出力のバレルレジスタであり、シフト量はビットシフト量決定部9で決まる。
【0017】
法Nレジスタ21は法Nを格納しておくレジスタである。数Aレジスタ22は数Aを格納しておくレジスタである。羃指数Bレジスタ23は羃指数Bを格納しておくレジスタである。剰余Rレジスタ24は演算結果の剰余Rを格納しておくレジスタである。
【0018】
また、図3はパラメタ変換部3及び改良型冗長2進演算部4の詳細を示すものである。
【0019】
冗長2進表現の法Nレジスタ31は冗長2進表現の法Nを格納しておくレジスタである。冗長2進表現の数Aレジスタ32は冗長2進表現の数Aを格納しておくレジスタである。冗長2進表現の剰余Rレジスタ33は冗長2進表現の剰余Rを格納しておくレジスタである。初期化回路34は剰余Rレジスタ24を初期化する。レジスタ35は羃指数Bのビット長を格納する。レジスタ36は法Nのビット長(n)を格納する。
【0020】
改良型冗長2進演算部4は従来から用いられている冗長2進演算回路のパラメタ入力を改良したものである。冗長2進数乗算部41は冗長2進数による乗算を実行する。冗長2進数除算部42は冗長2進数による除算を実行する。冗長2進数乗算パラメタ入力部43は冗長2進表現の剰余Rもしくは数Aを乗数として冗長2進数乗算部41に入力する。被乗数レジスタ44は冗長2進表現の剰余Rを被乗数として冗長2進数乗算部41に入力する。被除数レジスタ45は冗長2進表現の法Nを被除数として冗長2進数除算部42に入力する。冗長2進数演算途中結果レジスタ46は冗長2進表現の演算途中結果を格納する。演算途中結果レジスタ47は通常の2進数による演算途中結果を格納する。
【0021】
図4は本実施例の全体的な動作フローチャートを、また、図5は羃乗剰余演算時の詳細な動作フローチャートを示すもので、以下、これらに従って動作を説明する。
【0022】
(1)演算に必要な3つのパラメタのパラメタレジスタへの入力
まず、演算の前にパラメタの入力を開始する(S1)。ここで、状態遷移制御部5は入力バイト数を数えるカウンタ部6の初期化を指示する。状態遷移制御部5は入力パラメタが法Nあるいは羃指数Bの入力か否か(S2)及び法Nか否か(S3)によって指示内容が異なるが、最初は法Nの入力を行うものと仮定する。また、以降、状態遷移制御部5はパラメタの入力が終了するまでカウンタ部6にカウントアップを指示する。
【0023】
状態遷移制御部5は法Nの入力であれば、ビットシフト量決定部9の初期化を指示する(S4)。なお、数Aあるいは羃指数Bの入力の場合はビットシフト量決定部9はそのままの状態を保つ。
【0024】
状態遷移制御部5は8ビットのデータバスを介して最初に入力用前段バッファ部7に入力された1バイトデータのみを第1オクテット先頭“1”検出部8に取り込むように指示し、第1オクテット先頭“1”検出部8は取り込んだ8ビットのデータの先頭から何ビット目に最初の“1”があるかを検出する。この際、検出された値(0〜7)はビットシフト量決定部9で用いられ、該ビットシフト量決定部9では第1オクテット先頭“1”検出部8からの値が「0」であればビットシフト量を「0」、「1」であればビットシフト量を「1」、……と決定する(S5)。
【0025】
入力用前段バッファ部7に格納された1バイトのデータは次の1バイトのデータが入力される前に入力用後段バッファ部10に転送される。状態遷移制御部5は転送が終了した後に2バイト目以降のデータの入力を指示する。次のデータがある場合は第2オクテットが入力用前段バッファ部7に入力される。
【0026】
入力用後段バッファ部10及び入力用前段バッファ部7の2バイトのデータが揃うと、入力用後段バッファ部10の8ビットを上位8ビット(第1オクテット)とし、入力用前段バッファ部7の8ビットを下位8ビット(第2オクテット)とした計16ビットのデータを入力用ビットシフト部11に転送する。入力用ビットシフト部11ではビットシフト量決定部9で決めたビットシフト量だけ上位にずらしたデータを出力する。
【0027】
前記出力はバイトシフト部12のLSB側から入力される。そして、入力用ビットシフト部11の出力の上位8ビットのみがバイトシフト部12に入力される。これにより、入力された第1オクテットが10進数で「1〜255」のどのような値であってもバイトシフト部12に入力される値は10進数で「128〜255」となり、先頭ビットは必ず“1”になる。
【0028】
第3オクテット目以降は、第2オクテットの後を追うように、カウンタ部6、入力用前段バッファ部7、入力用後段バッファ部10、入力用ビットシフト部11を経てバイトシフト部12に入力される。以降、全データが入力されるまでこの動作を続け、状態遷移制御部5が最後のデータの入力終了を検出する。
【0029】
法Nのデータ入力の場合、バイトシフト部12に入力された第1オクテットが最上位に移動するように1バイトづつシフトし、空いたところに“0”を補いながらパラメタの補正シフトが行われる(S8)。このようにして、パラメタ長が計測され(S6)、状態遷移制御部5からパラメタ長が格納される(S7)。このパラメタ長はバイトシフト量記憶部13に記憶される。
【0030】
法Nのデータ入力時には法Nレジスタ21へ、数Aのデータ入力時は数Aレジスタ22へパラメタの格納が行われる(S9)。法N入力時にはその後に数Aを入力することがあるので、さらに続けて数Aを入力する場合にはステップS2に戻り、そうでない場合は終了する(S10)。
【0031】
法Nのパラメタが入力された後に数Aのパラメタの入力が行われるが、その工程は法Nの場合とほぼ同じである。唯一、法Nの場合と異なる点は、入力用ビットシフト部11でのビットシフト量とバイトシフト部12でのバイトシフト量の決定方法であり、数Aの場合のビットシフト量は法Nの場合に決定した値をそのまま用いる。従って、第1オクテット先頭“1”検出部8は動作しない。数Aのデータは入力後、入力用ビットシフト部11でビットシフト量決定部9の値の分、ビットシフトされ(S11)、バイトシフト部12でバイトシフト量記憶部13の値の分、パラメタの補正シフトが行われる(S8)。
【0032】
羃指数Bの入力に関しては、法Nや数Aのようにシフトさせて入力する必要はないので、カウンタ部6の出力から直接、羃指数Bレジスタ23にパラメタ格納が行われる(S9)。
以上のようにして3つのパラメタの入力が完了する。
【0033】
(2)冗長2進演算部へパラメタを入力するためのパラメタ変換
冗長2進演算は、通常、使用する2進表現とは異なり、2ビットで通常の1ビット分のデータを示す。そこで、通常の2進表現を冗長2進表現に変換する必要がある。法Nレジスタ21及び数Aレジスタ22に格納されたパラメタは冗長2進表現に変換されて、冗長2進表現の法Nレジスタ31及び冗長2進表現の数Aレジスタ32に格納される。
【0034】
(3)冗長2進演算部での羃乗剰余演算
冗長2進乗算部41の被乗数レジスタ44には常に冗長2進表現の剰余Rレジスタ33のデータが入力される。冗長2進除算部42の被除数レジスタ45には常に冗長2進表現の法Nレジスタ31のデータが入力される。また、冗長2進除算部42の除数として、常に冗長2進乗算部41での乗算結果が入力される。
【0035】
演算が開始される(S121)と、まず、初期化回路34により剰余Rレジスタ24及び冗長2進表現の剰余Rレジスタ33が“1”に初期化される(R=1,i=k)(S122)。
【0036】
▲1▼冗長2進表現の剰余Rレジスタ33のデータを冗長2進乗算部41の冗長2進乗算数パラメタ入力部43に入力する。入力後、冗長2進乗算部41及び冗長2進除算部42において乗算及び除算が行われ(S123)、冗長2進演算途中結果レジスタ46に途中結果が出力される。
【0037】
この演算(Ri+1 ={R・(R・2)}mod (N・2):但し、j=バイトシフト量記憶部13の値+ビットシフト量決定部9の値)の結果が冗長2進数演算途中結果レジスタ46に出力され、通常の2進数表現に戻した結果が演算途中結果レジスタ47に出力される。この値が次の剰余Rレジスタ24のデータとなる。剰余Rレジスタ24のデータは再び冗長2進表現に変換され、冗長2進表現の剰余Rレジスタ33に格納される。
【0038】
▲2▼羃指数Bレジスタ23のデータの先頭ビットを見て“1”(b=1)でなければ(S124)、この作業は飛ばす。
【0039】
冗長2進数乗算パラメタ入力部43に冗長2進表現の数Aレジスタ32のデータを入力し、乗算・除算を行い(S125)、その演算(Ri+1 ={A・(R・2)}mod (N・2))の結果が冗長2進数演算途中結果レジスタ46に出力され、通常の2進数表現に戻した結果が演算途中結果レジスタ47に出力される。
【0040】
▲3▼羃指数Bレジスタ23のデータの先頭ビットの値を破棄し、次のビットを先頭ビットとする。同時に羃指数Bビット長レジスタ35の値が0(i=0)でなければ1減らし(i=i−1)、▲1▼に戻る。i=0になれば、このフェーズを終了する(S126,S127,S128)。
【0041】
(4)演算結果の出力
剰余Rレジスタ24の値が求める演算結果である。但し、この値は2j 倍されているので、パラメタ出力時に以下のようにして逆補正する。
【0042】
状態遷移制御部5の指示により、剰余Rレジスタ24内の演算結果の第1オクテットが出力用前段バッファ部14に取り込まれる。次に、出力用前段バッファ部14に取り込まれた第1オクテットが出力用後段バッファ部15に移され、第2オクテットが出力用前段バッファ部14に取り込まれる。
【0043】
出力用後段バッファ部15の8ビットを上位8ビット(第1オクテット)とし、出力用前段バッファ部14の8ビットを下位8ビット(第2オクテット)とした計16ビットのデータは、出力用ビットシフト部16にて、法Nの入力時に決定したビットシフト量決定部9からの値により下位にシフトする。そして、出力用ビットシフト部16の出力の上位8ビットのみが8ビットのデータとして出力される。出力すべきデータのオクテット数は、法Nの入力時のカウンタ部6の値を減少させて0になるまで出力する(S13〜S17)。
【0044】
なお、演算結果以外の法N、数Aのパラメタ出力は剰余Rレジスタ24からの出力の場合と全く同じである。また、羃指数Bの出力はビットシフトやバイトシフトは行われていないので、羃指数レジスタ23から直接出力する。
【0045】
【発明の効果】
以上説明したように本発明によれば、冗長2進演算方法の長所である多倍長の高速演算性を生かしつつ、短所である羃乗剰余演算の際の法の最上位ビットが“1”に限定される、即ちビット長が一定値に限定されるという制約を解決することができる。
【図面の簡単な説明】
【図1】本発明の一実施例を示す構成図
【図2】パラメタ入出力補正部及びパラメタレジスタ部の詳細を示す構成図
【図3】パラメタ変換部及び改良型冗長2進演算部の詳細を示す構成図
【図4】全体的な動作フローチャート
【図5】羃乗剰余演算時の詳細な動作フローチャート
【符号の説明】
1…パラメタ入出力補正部、2…パラメタレジスタ部、3…パラメタ変換部、4…改良型冗長2進演算部、5…状態遷移制御部。[0001]
[Industrial applications]
The present invention relates to a method and apparatus for performing a modular exponentiation operation with a large number of digits at high speed using a redundant binary operation method.
[0002]
[Prior art]
The modular exponentiation operation can be executed by repetition of multiplication and remainder calculation. However, when multiplication and remainder calculation with a large number of digits are performed at high speed, the problem of carry propagation delay of carry and borrow becomes significant. In view of this, conventionally, various arithmetic methods devised to prevent carry propagation have been proposed, and one of them is a redundant binary arithmetic method (for example, IEEE JOURNAL OF SOLID-STATE CIRCUITS, Vol. 25). , No. 3, June, 1990, A. Vandemeulebroecke, E. Vanzieleghem, T. Denayer and PGA Jespers, "A New Carry-Response Promotion Agreement Promotion Agreement. reference).
[0003]
[Problems to be solved by the invention]
However, in this redundant binary arithmetic method, when performing division or remainder arithmetic, there is a restriction that the most significant bit of the modulus must always be "1", and as a result, the number of bits of the modulus is limited. There was a problem.
[0004]
An object of the present invention is to provide a method and an apparatus for enabling a modular exponentiation operation by a redundant binary operation method even if the most significant bit of the modulus is not "1".
[0005]
[Means for Solving the Problems]
In the present invention, in order to achieve the above object, a modulus N, a number A consisting of a natural number equal to or less than the modulus N and a power exponent B are input, and a redundant binary operation method in which the modulus N is limited to d bits is used. Modular exponentiation operation R = A B mod N, and at least a remainder R of the operation result is output. The number of m bits of the data of the modulus N was input and measured by the data counting means, and the first bit in the data from the head of the data first taken into the input preceding-stage data storage means. Is detected, the detected number of bits is determined as a bit shift amount, the data in the input pre-stage data storage unit is sequentially transferred to the input post-stage data storage unit, and the data in the input pre-stage data storage unit is stored in the lower order. The data in the input post-stage data storage means is set as the upper m bits, and the 2m bits are shifted upward by the bit shift amount, and the upper m bits of the shifted 2m bits data are stored in the m bit shift data. After completion of the data input of the modulus N, the difference between the value of the data counting means and the capacity / m of the m-bit shift data storage means is stored in the shift amount storage means as the shift amount, and the m-bit shift data storage means is stored. Is shifted upward by the value of the shift amount storage means in units of m bits and stored in the modal storage means. The number of m bits of data input is measured by the data count means, and the data in the input preceding data storage means is sequentially transferred to the input subsequent data storage means. After transferring, the data in the input pre-stage data storage means is set to the lower m bits, the data in the input post-stage data storage means is set to the upper m bits, and the 2m bits are shifted upward by the bit shift amount. Is stored in the m-bit shift data storage means, and after completion of the data input of the number A, the data of the m-bit shift data storage means is shifted upward by the value of the shift amount storage means in units of m bits. The data is shifted and stored in the number storage means, the data of the exponent exponent B is directly taken and stored in the exponent exponent storage means, and how many bits of the data of the exponent exponent B are input is measured and stored by the data counting means. Using the stored data of the modulus N, the number A, and the exponent exponent B, the redundant binary arithmetic means performs a modular exponentiation operation, and stores the remainder R of the operation result in the residual storage means, The data of the remainder R is fetched from the remainder storage means into the output pre-stage data storage means for each m bits from the high order, and the data in the output pre-stage data storage means is sequentially transferred to the output post-stage data storage means, and the output pre-stage data storage is performed. The data in the means is the lower m bits and the data in the output post-data storage means is the upper m bits, and the 2m bits are shifted down by the bit shift amount and output.
[0006]
[Action]
In a conventional arithmetic unit using a redundant binary arithmetic method, the most significant bit of the modulus is limited to "1". Therefore, the number of modulo bits is also uniquely limited. On the other hand, according to the modular exponentiation operation method and apparatus of the present invention, there is provided a means for arbitrarily shifting and inputting the modulus, and by using this, when storing the modulus, the most significant bit is always "1". Can be Therefore, it is possible to execute a modular exponentiation operation with any bit length as long as it is equal to or less than the bit length of the modulus register, and to perform a modular exponentiation operation using a redundant binary number without limiting the bit length in the modulus. Will be able to
[0007]
【Example】
By adding an input / output correction unit of the parameter of the present invention to a redundant binary arithmetic unit conventionally used for arithmetic operations requiring high speed processing with a large number of bits, if the bit length is less than the modulus register, Can perform modular exponentiation with no restriction on the bit length of.
[0008]
First, it is shown that a modular exponentiation operation with a modulo arbitrary bit length can be executed by combining multiplication and remainder arithmetic.
[0009]
羃乗remainder operation R = A B mod N, when data of羃指number B of k bits is input, with k ≧ i ≧ 1 becomes i,
B = b k × 2 k−1 + b k−1 × 2 k−2 +... + B i × 2 i−1 +... + B 2 × 2 1 + b 1 × 2 0
age,
Figure 0003555091
Can be obtained by That is, the modular exponentiation operation can be obtained by repeating multiplication and remainder arithmetic.
[0010]
As described above, the bit length of the modulus N must be equal to the bit length of the redundant binary arithmetic unit in order to execute this arithmetic processing by the redundant binary calculation method. When shorter than the bit length of the binary operator, j is determined so that N · 2 j is equal to the bit length of the redundant binary operator;
Figure 0003555091
Is executed, the desired operation of R = A B mod N can be executed.
[0011]
Performs calculation of A B mod N as羃乗remainder operation, describes an example of outputting the remainder R of the calculation result. This example can be divided into the following phases:
(1) Inputting three parameters necessary for the operation to the parameter register (2) Parameter conversion for inputting each parameter to the redundant binary operation unit (3) Modulo exponentiation operation in the redundant binary operation unit (4 ) Output of calculation result The following describes each phase.
[0012]
FIG. 1 shows an embodiment of the present invention, in which 1 is a parameter input / output correction unit, 2 is a parameter register unit, 3 is a parameter conversion unit, 4 is an improved redundant binary operation unit, and 5 is a state. It is a transition control unit.
[0013]
FIG. 2 shows the details of the parameter input / output correction unit 1 and the parameter register unit 2. Here, an example in which data input / output is performed through an 8-bit data bus is shown.
[0014]
The counter unit 6 counts up input 8-bit data. The input pre-buffer unit 7 is a register for storing 8-bit data. The first octet head "1" detection unit 8 detects at what bit "1" from the head of the 8-bit data. The bit shift amount determiner 9 determines the bit shift amount from the value of the first octet head “1” detector 8. The input post-buffer unit 10 is a register for storing 8-bit data.
[0015]
The input bit shift unit 11 is a barrel register that outputs 16 bits and outputs the upper 8 bits, and the shift amount is determined by the bit shift amount determination unit 9. The byte shift unit 12 is a register that can arbitrarily shift 8-bit data to a higher order in byte units. The byte shift amount storage unit 13 stores the byte shift amount when the modulus N and the number A are input.
[0016]
The output pre-buffer unit 14 is a register for storing 8-bit data. The output post-buffer unit 15 is a register for storing 8-bit data. The output bit shift unit 16 is a barrel register that inputs 16 bits and outputs upper 8 bits, and the shift amount is determined by the bit shift amount determination unit 9.
[0017]
The modulus N register 21 is a register for storing the modulus N. The number A register 22 is a register for storing the number A. The exponent B register 23 is a register for storing the exponent B. The remainder R register 24 is a register for storing the remainder R of the operation result.
[0018]
FIG. 3 shows details of the parameter conversion unit 3 and the improved redundant binary operation unit 4.
[0019]
The redundant binary representation modulus N register 31 is a register for storing the redundant binary representation modulus N. The redundant binary expression number A register 32 is a register for storing the redundant binary expression number A. The remainder R register 33 of the redundant binary expression is a register for storing the remainder R of the redundant binary expression. The initialization circuit 34 initializes the remainder R register 24. The register 35 stores the bit length of the exponent B. The register 36 stores the bit length (n) of the modulus N.
[0020]
The improved redundant binary operation unit 4 is obtained by improving parameter input of a conventionally used redundant binary operation circuit. The redundant binary number multiplying unit 41 executes multiplication by a redundant binary number. The redundant binary number division unit 42 performs division by a redundant binary number. The redundant binary multiplication parameter input unit 43 inputs the remainder R or the number A of the redundant binary expression as a multiplier to the redundant binary multiplication unit 41. The multiplicand register 44 inputs the remainder R in the redundant binary representation to the redundant binary multiplier 41 as a multiplicand. The dividend register 45 inputs the modulus N of the redundant binary representation to the redundant binary division unit 42 as a dividend. The redundant binary number calculation middle result register 46 stores the calculation middle result of the redundant binary expression. The halfway calculation result register 47 stores the halfway calculation result by a normal binary number.
[0021]
FIG. 4 is an overall operation flowchart of the present embodiment, and FIG. 5 is a detailed operation flowchart at the time of the modular exponentiation operation.
[0022]
(1) Input of Three Parameters Required for Operation to Parameter Register First, input of parameters is started before the operation (S1). Here, the state transition control unit 5 instructs the initialization of the counter unit 6 that counts the number of input bytes. The state transition control unit 5 has different instructions depending on whether the input parameter is a modulus N or an exponent B (S2) and a modulus N (S3), but it is assumed that the modulus N is initially input. I do. Thereafter, the state transition control unit 5 instructs the counter unit 6 to count up until the input of the parameter is completed.
[0023]
If the input is modulus N, the state transition control unit 5 instructs the bit shift amount determination unit 9 to initialize (S4). When the number A or the exponent B is input, the bit shift amount determination unit 9 keeps the state.
[0024]
The state transition control unit 5 instructs the first octet head "1" detection unit 8 to take in only the 1-byte data initially input to the input pre-stage buffer unit 7 via the 8-bit data bus. The octet head "1" detection unit 8 detects at what bit from the head of the fetched 8-bit data the first "1" is. At this time, the detected values (0 to 7) are used by the bit shift amount determining unit 9, and the bit shift amount determining unit 9 determines that the value from the first octet head "1" detecting unit 8 is "0". For example, if the bit shift amount is “0”, and if it is “1”, the bit shift amount is determined to be “1”,... (S5).
[0025]
The one-byte data stored in the input first-stage buffer unit 7 is transferred to the input second-stage buffer unit 10 before the next one-byte data is input. After the completion of the transfer, the state transition control unit 5 instructs the input of the data after the second byte. If there is next data, the second octet is input to the input preceding buffer unit 7.
[0026]
When the 2-byte data of the input rear-stage buffer unit 10 and the input front-stage buffer unit 7 are completed, the 8 bits of the input rear-stage buffer unit 10 are set to the upper 8 bits (first octet) and the 8 bits of the input front-stage buffer unit 7 are set. The data of a total of 16 bits in which the bits are lower 8 bits (second octet) is transferred to the input bit shift unit 11. The input bit shift unit 11 outputs data shifted upward by the bit shift amount determined by the bit shift amount determination unit 9.
[0027]
The output is input from the LSB side of the byte shift unit 12. Then, only the upper 8 bits of the output of the input bit shift unit 11 are input to the byte shift unit 12. Thus, even if the input first octet is any value of "1 to 255" in decimal, the value input to the byte shift unit 12 is "128 to 255" in decimal, and the leading bit is Becomes "1" without fail.
[0028]
After the third octet, the data is input to the byte shift unit 12 via the counter unit 6, the input pre-buffer unit 7, the input post-buffer unit 10, and the input bit shift unit 11 so as to follow the second octet. You. Thereafter, this operation is continued until all data is input, and the state transition control unit 5 detects the end of input of the last data.
[0029]
In the case of modulo N data input, the first octet input to the byte shift unit 12 is shifted one byte at a time so as to move to the highest position, and the parameter is corrected and shifted while compensating for "0" in the empty space. (S8). In this way, the parameter length is measured (S6), and the parameter length is stored from the state transition control unit 5 (S7). This parameter length is stored in the byte shift amount storage unit 13.
[0030]
When data of modulus N is input, parameters are stored in the modulus N register 21 and when data of number A is input, parameters are stored in the number A register 22 (S9). At the time of inputting the modulus N, the number A may be input thereafter. Therefore, when the number A is further input, the process returns to the step S2, and when not, the process ends (S10).
[0031]
After the parameters of the modulus N are input, the parameters of the number A are input, and the process is almost the same as that of the method N. The only difference from the method N is the method of determining the bit shift amount in the input bit shift unit 11 and the byte shift amount in the byte shift unit 12. The value determined in this case is used as it is. Therefore, the first octet head "1" detecting section 8 does not operate. After the data of the number A is input, it is bit-shifted by the value of the bit shift amount determination unit 9 by the input bit shift unit 11 (S11), and is shifted by the byte shift unit 12 by the value of the byte shift amount storage unit 13, Is performed (S8).
[0032]
As for the input of the exponent exponent B, it is not necessary to shift and input like the modulus N or the number A, so that the parameter is directly stored in the exponent exponent B register 23 from the output of the counter unit 6 (S9).
The input of the three parameters is completed as described above.
[0033]
(2) Parameter Conversion for Inputting Parameters to the Redundant Binary Operation Unit The redundant binary operation is different from the binary expression used in general, and shows two bits of data of one ordinary bit. Therefore, it is necessary to convert a normal binary representation into a redundant binary representation. The parameters stored in the modulus N register 21 and the number A register 22 are converted into a redundant binary expression, and stored in a redundant binary expression modulus N register 31 and a redundant binary expression number A register 32.
[0034]
(3) Exponentiation remainder operation in redundant binary operation unit The multiplicand register 44 of the redundant binary multiplication unit 41 always receives the data of the remainder R register 33 in the redundant binary expression. The dividend register 45 of the redundant binary divider 42 always receives the data of the redundant binary representation modulus N register 31. As the divisor of the redundant binary division unit 42, the multiplication result of the redundant binary multiplication unit 41 is always input.
[0035]
When the operation is started (S121), first, the initialization circuit 34 initializes the remainder R register 24 and the remainder R register 33 in the redundant binary expression to “1” (R = 1, i = k) ( S122).
[0036]
{Circle around (1)} The data of the redundant R register 33 in the redundant binary expression is input to the redundant binary multiplier parameter input unit 43 of the redundant binary multiplier 41. After the input, multiplication and division are performed in the redundant binary multiplication unit 41 and the redundant binary division unit 42 (S123), and the intermediate result is output to the redundant binary operation intermediate result register 46.
[0037]
Result of this operation (R i + 1 = {R i · (R i · 2 j )} mod (N · 2 j ): where j = value of byte shift amount storage unit 13 + value of bit shift amount determination unit 9) Is output to the redundant binary arithmetic operation result register 46, and the result returned to the normal binary representation is output to the arithmetic intermediate result register 47. This value becomes the data of the next remainder R register 24. The data in the remainder R register 24 is again converted into a redundant binary representation and stored in the redundant R remainder 33 register.
[0038]
▲ 2 ▼ watching first bit of data羃指number B register 23 "1" (b i = 1) unless (S124), this task skip.
[0039]
The data of the number A register 32 in the redundant binary representation is input to the redundant binary multiplication parameter input unit 43, multiplication and division are performed (S125), and the operation (R i + 1 = {A · (R i · 2 j )}). The result of mod (N · 2 j )) is output to the redundant binary number calculation intermediate result register 46, and the result returned to the normal binary representation is output to the arithmetic halfway result register 47.
[0040]
(3) The value of the first bit of the data of the exponent B register 23 is discarded, and the next bit is set as the first bit. At the same time, if the value of the exponent exponent B bit length register 35 is not 0 (i = 0), the value is reduced by 1 (i = i−1) and the process returns to (1). When i = 0, this phase ends (S126, S127, S128).
[0041]
(4) Output of Operation Result The value of the remainder R register 24 is the operation result to be obtained. However, since this value is multiplied by 2j, inverse correction is performed as follows when outputting parameters.
[0042]
In response to an instruction from the state transition control unit 5, the first octet of the operation result in the remainder R register 24 is taken into the output pre-stage buffer unit 14. Next, the first octet taken into the output pre-buffer section 14 is moved to the output post-buffer section 15, and the second octet is taken into the output pre-buffer section 14.
[0043]
A total of 16 bits of data, in which the 8 bits of the output post-buffer unit 15 are upper 8 bits (first octet) and the 8 bits of the output pre-buffer unit 14 are lower 8 bits (second octet), are output bit The shift unit 16 shifts to the lower order according to the value from the bit shift amount determination unit 9 determined when the modulus N is input. Then, only the upper 8 bits of the output of the output bit shift unit 16 are output as 8-bit data. The number of octets of the data to be output is output until the value of the counter unit 6 at the time of input of the modulus N is reduced to 0 (S13 to S17).
[0044]
The output of the parameters of the modulus N and the number A other than the operation result is exactly the same as that of the output from the remainder R register 24. Further, since the output of the exponent B is not bit-shifted or byte-shifted, it is directly output from the exponent register 23.
[0045]
【The invention's effect】
As described above, according to the present invention, the most significant bit of the method for the modular exponentiation operation, which is a disadvantage, is “1” while taking advantage of the multiple-length high-speed operation, which is an advantage of the redundant binary operation method. , That is, the limitation that the bit length is limited to a constant value can be solved.
[Brief description of the drawings]
FIG. 1 is a block diagram showing an embodiment of the present invention. FIG. 2 is a block diagram showing details of a parameter input / output correction unit and a parameter register unit. FIG. 3 is a detail of a parameter conversion unit and an improved redundant binary operation unit. FIG. 4 is an overall operation flowchart. FIG. 5 is a detailed operation flowchart at the time of modular exponentiation operation.
DESCRIPTION OF SYMBOLS 1 ... Parameter input / output correction part, 2 ... Parameter register part, 3 ... Parameter conversion part, 4 ... Improved redundant binary operation part, 5 ... State transition control part.

Claims (6)

法Nと該法N以下の自然数からなる数A及び羃指数Bとを入力し、法Nがdビットに限定される冗長2進演算方法を利用して羃乗剰余演算R=Amod Nを行い、少なくとも演算結果の剰余Rを出力する羃乗剰余演算方法において、
法Nのデータを上位からmビット毎に入力用前段データ記憶手段に取り込むとともに該法Nのデータが何mビット入力されたかをデータカウント手段で計測し、
入力用前段データ記憶手段に最初に取り込まれたデータの先頭から何ビット目に最初に“1”が現れたかを検出し、
該検出したビット数をビットシフト量として決定し、
入力用前段データ記憶手段内のデータを入力用後段データ記憶手段に順次転送し、
入力用前段データ記憶手段内のデータを下位mビットとし入力用後段データ記憶手段内のデータを上位mビットとして、その2mビットを前記ビットシフト量だけ上位にシフトし、
該シフトした後の2mビットのデータの上位mビットをmビットシフトデータ記憶手段に格納し、
法Nのデータ入力完了後、データカウント手段の値とmビットシフトデータ記憶手段の容量/mとの差分をシフト量としてシフト量記憶手段に記憶し、
mビットシフトデータ記憶手段のデータをシフト量記憶手段の値だけ上位にmビット単位にシフトして法記憶手段に記憶し、
数Aのデータを上位からmビット毎に入力用前段データ記憶手段に取り込むとともに該数Aのデータが何mビット入力されたかをデータカウント手段で計測し、
入力用前段データ記憶手段内のデータを入力用後段データ記憶手段に順次転送し、
入力用前段データ記憶手段内のデータを下位mビットとし入力用後段データ記憶手段内のデータを上位mビットとして、その2mビットを前記ビットシフト量だけ上位にシフトし、
該シフトした後の2mビットのデータの上位mビットをmビットシフトデータ記憶手段に格納し、
数Aのデータ入力完了後、mビットシフトデータ記憶手段のデータをシフト量記憶手段の値だけ上位にmビット単位にシフトして数記憶手段に記憶し、
羃指数Bのデータを羃指数記憶手段に直接取り込んで記憶するとともに該羃指数Bのデータが何ビット入力されたかをデータカウント手段で計測して記憶し、記憶された法N、数A及び羃指数Bのデータを使用して冗長2進演算手段に羃乗剰余演算を行わせ、
演算結果の剰余Rを剰余記憶手段に記憶し、
剰余記憶手段より剰余Rのデータを上位からmビット毎に出力用前段データ記憶手段に取り込み、
出力用前段データ記憶手段内のデータを出力用後段データ記憶手段に順次転送し、
出力用前段データ記憶手段内のデータを下位mビットとし出力用後段データ記憶手段内のデータを上位mビットとして、その2mビットを前記ビットシフト量だけ下位にシフトして出力する
ことを特徴とする羃乗剰余演算方法。
A modulo N, a number A consisting of a natural number less than or equal to the modulus N and a power exponent B are input, and a modular exponentiation operation R = A B mod N using a redundant binary operation method in which the modulus N is limited to d bits. , And at least the remainder R of the operation result is output,
The data of the modulus N is taken into the input preceding data storage means for each m bits from the higher order, and the number of m bits of the data of the modulus N is measured by the data counting means,
Detecting at which bit from the beginning of the data first taken into the input pre-stage data storage means a "1" first appears;
The detected bit number is determined as a bit shift amount,
Sequentially transferring the data in the input pre-stage data storage means to the input post-stage data storage means,
The data in the input pre-stage data storage means is set to the lower m bits, the data in the input post-stage data storage means is set to the upper m bits, and the 2m bits are shifted upward by the bit shift amount.
Storing the upper m bits of the shifted 2m bit data in m bit shifted data storage means;
After completion of the data input of the modulus N, the difference between the value of the data count means and the capacity / m of the m-bit shift data storage means is stored in the shift amount storage means as a shift amount,
data in the m-bit shift data storage means is shifted upward by the value of the shift amount storage means in m-bit units and stored in the modulus storage means;
The data of the number A is taken into the input preceding data storage means for each m bits from the high order, and the number of m bits of the data of the number A is measured by the data counting means,
Sequentially transferring the data in the input pre-stage data storage means to the input post-stage data storage means,
The data in the input pre-stage data storage means is set to the lower m bits, the data in the input post-stage data storage means is set to the upper m bits, and the 2m bits are shifted upward by the bit shift amount.
Storing the upper m bits of the shifted 2m bit data in m bit shifted data storage means;
After the data input of the number A is completed, the data in the m-bit shift data storage means is shifted upward by the value of the shift amount storage means in m-bit units and stored in the number storage means,
The data of the exponent exponent B is directly taken into the exponent exponent storage means and stored, and how many bits of the data of the exponent exponent B are input is measured and stored by the data counting means, and the stored modulus N, number A and exponent are stored. Using the data of the exponent B, the redundant binary arithmetic means performs a modular exponentiation operation,
Storing the remainder R of the operation result in the remainder storage means,
The data of the remainder R is fetched from the remainder storage means into the output pre-stage data storage means for each m bits from the high order,
Sequentially transferring the data in the output pre-stage data storage means to the output post-stage data storage means,
The data in the output pre-stage data storage means is the lower m bits, the data in the output post-data storage means is the upper m bits, and the 2m bits are shifted down by the bit shift amount and output. Modulo exponentiation method.
法記憶手段より法Nのデータを上位からmビット毎に出力用前段データ記憶手段に取り込み、
出力用前段データ記憶手段内のデータを出力用後段データ記憶手段に順次転送し、
出力用前段データ記憶手段内のデータを下位mビットとし出力用後段データ記憶手段内のデータを上位mビットとして、その2mビットをデータ入力時に決定したビットシフト量だけ下位にシフトして出力する
ことを特徴とする請求項1記載の羃乗剰余演算方法。
The data of the modulus N is fetched from the legal storage means into the output pre-stage data storage means for each m bits from the high order,
Sequentially transferring the data in the output pre-stage data storage means to the output post-stage data storage means,
The data in the output pre-stage data storage means is the lower m bits, the data in the output post-stage data storage means is the upper m bits, and the 2m bits are shifted down by the bit shift amount determined at the time of data input and output. 2. The method according to claim 1, further comprising:
数記憶手段より数Aのデータを上位からmビット毎に出力用前段データ記憶手段に取り込み、
出力用前段データ記憶手段内のデータを出力用後段データ記憶手段に順次転送し、
出力用前段データ記憶手段内のデータを下位mビットとし出力用後段データ記憶手段内のデータを上位mビットとして、その2mビットを法Nのデータ入力時に決定したビットシフト量だけ下位にシフトして出力する
ことを特徴とする請求項1記載の羃乗剰余演算方法。
The data of the number A is fetched from the number storage means into the output pre-stage data storage means for each m bits from the higher order,
Sequentially transferring the data in the output pre-stage data storage means to the output post-stage data storage means,
The data in the output pre-stage data storage means is set to the lower m bits, the data in the output post-stage data storage means is set to the upper m bits, and the 2 m bits are shifted to the lower order by the bit shift amount determined at the time of inputting the modulus N data. 2. The method according to claim 1, further comprising outputting the result.
羃指数記憶手段より羃指数Bのデータを上位からmビット毎に出力用前段データ記憶手段に取り込み、
出力用前段データ記憶手段内のデータを出力用後段データ記憶手段に順次転送し、
出力用前段データ記憶手段内のデータを下位mビットとし出力用後段データ記憶手段内のデータを上位mビットとしてそのまま出力する
ことを特徴とする請求項1記載の羃乗剰余演算方法。
The data of the exponent exponent B is taken from the exponent exponent storage means into the output pre-stage data storage means for each m bits from the high order,
Sequentially transferring the data in the output pre-stage data storage means to the output post-stage data storage means,
2. The modular exponentiation arithmetic method according to claim 1, wherein the data in the output pre-stage data storage means is set as the lower m bits, and the data in the output post-stage data storage means is output as it is as the upper m bits.
法Nと該法N以下の自然数からなる数A及び羃指数Bとを入力し、法Nがdビットに限定される冗長2進演算方法を利用して羃乗剰余演算R=Amod Nを行い、少なくとも演算結果の剰余Rを出力する羃乗剰余演算装置において、
法Nもしくは数Aのデータを上位からmビット毎に取り込む入力用前段データ記憶手段と、
法Nもしくは数Aのデータが何mビット入力されたか及び羃指数Bのデータが何ビット入力されたかを計測するデータカウント手段と、
入力用前段データ記憶手段に最初に取り込まれた法Nのデータの先頭から何ビット目に最初に“1”が現れたかを検出する先頭“1”ビット検出手段と、
前記先頭“1”ビット検出手段で検出したビット数をビットシフト量として決定するビットシフト量決定手段と、
入力用前段データ記憶手段のデータを次に受け取る入力用後段データ記憶手段と、
入力用前段データ記憶手段内のデータを下位mビットとし入力用後段データ記憶手段内のデータを上位mビットとして、ビットシフト量決定手段で決定したシフト量だけ上位にシフトする2mビット上位シフト手段と、
法N、数A及び羃指数Bのデータを使用して冗長2進演算方法により羃乗剰余演算を行う冗長2進演算手段と、
2mビット上位シフト手段によりシフトした後の2mビットのデータ又は冗長2進演算手段より得られる剰余Rあるいはこれに加えて法Nもしくは数Aもしくは羃指数Bのデータの上位mビットを格納するmビットシフトデータ記憶手段と、
法Nのデータ入力完了後、データカウント手段の値とmビットシフトデータ記憶手段の容量/mとの差分をシフト量として記憶するシフト量記憶手段と、
mビットデータシフト記憶手段より演算結果の剰余Rあるいはこれに加えて法Nもしくは数Aもしくは羃指数Bのデータを上位からmビット毎に取り込む出力用前段データ記憶手段と、
出力用前段データ記憶手段のデータを次に受け取る出力用後段データ記憶手段と、
出力用前段データ記憶手段内のデータを下位mビットとし出力用後段データ記憶手段内のデータを上位mビットとして、演算結果の剰余R、法N及び数Aのみビットシフト量決定手段で決定したビットシフト量だけ下位にシフトする2mビット下位シフト手段とを備えた
ことを特徴とする羃乗剰余演算装置。
A modulo N, a number A consisting of a natural number less than or equal to the modulus N and a power exponent B are input, and a modular exponentiation operation R = A B mod N using a redundant binary operation method in which the modulus N is limited to d bits. And a modular exponentiation operation device that outputs at least the remainder R of the operation result,
Input pre-stage data storage means for taking in modulo N or data of number A every m bits from the higher order;
Data counting means for measuring how many bits of data of modulo N or number A are input and how many bits of data of exponent B are input;
A leading "1" bit detecting means for detecting at which bit "1" first appears from the beginning of modulo N data first taken into the input preceding data storage means;
Bit shift amount determining means for determining the number of bits detected by the leading "1" bit detecting means as a bit shift amount;
An input post-stage data storage unit that receives data of the input pre-stage data storage unit next,
2m-bit upper shift means for shifting the data in the input preceding data storage means to lower m bits and the data in the input latter data storage means to upper m bits to shift the data upward by the shift amount determined by the bit shift amount determining means; ,
Redundant binary arithmetic means for performing modular exponentiation by a redundant binary arithmetic method using data of modulus N, number A and exponent B;
2 m-bit data after shifting by 2 m-bit high-order shift means or m bits for storing the remainder R obtained by redundant binary operation means or the high-order m bits of modulo N, number A, or exponent B data Shift data storage means,
A shift amount storing means for storing, as a shift amount, a difference between the value of the data counting means and the capacity / m of the m-bit shift data storing means after completion of the data input of the modulus N;
an output pre-stage data storage means for taking in the remainder R of the operation result from the m-bit data shift storage means or data of the modulus N or the number A or the exponent B in addition to the m bits from the upper bit for each m bits;
An output post-stage data storage unit that receives data of the output pre-stage data storage unit next;
The data in the output pre-stage data storage means are the lower m bits, and the data in the output post-data storage means are the upper m bits. A 2m-bit lower shift means for shifting lower by a shift amount;
法Nを冗長2進表現に変換する法N−冗長2進変換手段と、
数Aを冗長2進表現に変換する数A−冗長2進変換手段と、
剰余Rを冗長2進表現に変換する数A−冗長2進変換手段と、
演算結果の剰余Rを格納する演算結果格納手段と、
演算結果格納手段の内容を“1”に初期化する初期化手段と、
kビットの羃指数Bのデータが入力された時、k≧i≧1なるiを用いて
B=b×2k−1 +bk−1 ×2k−2 +……+b×2i−1 +……+b×2+b×2
とし、i=kとして、演算結果の剰余R及び法Nを冗長2進表現にして法Nの格納ビット数と同一ビット数だけ上位ビットからR×2d−k =(R×R×2d−k )mod (N×2d−k )の演算を行い、また、b=1であれば、R×2d−k =(A×R×2d−k )mod (N×2d−k )の演算を行い、iを1つずつ減じて0になるまで前記演算を繰り返し行うN×2d−k ビット冗長2進羃乗剰余手段と、
冗長2進数を通常の2進数に戻す全加算手段と、
演算結果格納手段の上位d−kを求める羃乗剰余演算結果として出力する演算結果出力手段とからなる冗長2進演算手段を備えた
ことを特徴とする請求項5記載の羃乗剰余演算装置。
A modulo N-redundant binary conversion means for converting the modulo N into a redundant binary representation;
A number A-redundant binary conversion means for converting the number A into a redundant binary representation;
A number A-redundant binary conversion means for converting the remainder R into a redundant binary representation;
Operation result storage means for storing the remainder R of the operation result;
Initialization means for initializing the contents of the operation result storage means to "1";
When data of a power exponent B of k bits is input, B = b k × 2 k−1 + b k−1 × 2 k−2 +... + b i × 2 i using i satisfying k ≧ i ≧ 1 -1 +... + B 2 × 2 1 + b 1 × 2 0
When i = k, the remainder R and the modulus N of the operation result are expressed in redundant binary notation, and the same number of bits as the number of bits stored in the modulus N is used, starting from the higher-order bits and R × 2 d−k = (R × R × 2 d -K ) mod (N × 2 d−k ), and if b i = 1, R × 2 d−k = (A × R × 2 d−k ) mod (N × 2 d) N × 2 d−k- bit redundant binary power residue means for performing the operation of −k ) and repeating the above operation until i becomes 0 by decreasing i by one;
Full addition means for returning a redundant binary number to a normal binary number;
6. The modular exponentiation arithmetic unit according to claim 5, further comprising redundant binary arithmetic means comprising: an arithmetic result output means for outputting as a modular exponentiation operation result for obtaining the higher order dk of the arithmetic result storage means.
JP28685394A 1994-11-21 1994-11-21 Method and apparatus for modular exponentiation operation Expired - Lifetime JP3555091B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP28685394A JP3555091B2 (en) 1994-11-21 1994-11-21 Method and apparatus for modular exponentiation operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP28685394A JP3555091B2 (en) 1994-11-21 1994-11-21 Method and apparatus for modular exponentiation operation

Publications (2)

Publication Number Publication Date
JPH08147266A JPH08147266A (en) 1996-06-07
JP3555091B2 true JP3555091B2 (en) 2004-08-18

Family

ID=17709881

Family Applications (1)

Application Number Title Priority Date Filing Date
JP28685394A Expired - Lifetime JP3555091B2 (en) 1994-11-21 1994-11-21 Method and apparatus for modular exponentiation operation

Country Status (1)

Country Link
JP (1) JP3555091B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6175850B1 (en) 1997-02-03 2001-01-16 Nippon Telegraph And Telephone Corporation Scheme for carrying out modular calculations based on redundant binary calculation
JP5175983B2 (en) * 2009-09-24 2013-04-03 株式会社東芝 Arithmetic unit

Also Published As

Publication number Publication date
JPH08147266A (en) 1996-06-07

Similar Documents

Publication Publication Date Title
US4893268A (en) Circuit and method for accumulating partial products of a single, double or mixed precision multiplication
JP3970337B2 (en) Hardware-optimized Reed-Solomon decoder for large data blocks
JP2835153B2 (en) High radix divider
ARAKI et al. Fast inverters over finite field based on Euclid's algorithm
US5261001A (en) Microcircuit for the implementation of RSA algorithm and ordinary and modular arithmetic, in particular exponentiation, with large operands
US6523054B1 (en) Galois field arithmetic processor
CA2294554A1 (en) Method and circuit for multiplication using booth encoding and iterative addition techniques
CA2329104C (en) Method and apparatus for calculating a reciprocal
JP3555091B2 (en) Method and apparatus for modular exponentiation operation
JP3551113B2 (en) Divider
US8909689B2 (en) Arithmetic device
JPH10500513A (en) Digital division execution unit
JP3271120B2 (en) Device for fast multiplication of binary numbers
JPH10283164A (en) Division circuit
JPH09146924A (en) Method and device for arithmetic, and microprocessor
JP3422001B2 (en) Division / residue calculation method and apparatus
JPH10307707A (en) Circuit and method for deciding multiple
EP1504338B1 (en) "emod" a fast modulus calculation for computer systems
JP2578482B2 (en) Floating point arithmetic unit
JP2645422B2 (en) Floating point processor
CN118245017B (en) Binary floating-point multiplication device in memory and operation method thereof
GB2372353A (en) Method and apparatus for calculating a reciprocal
JP4428778B2 (en) Arithmetic device, arithmetic method, and computing device
JP3104569B2 (en) Division circuit
JP2993119B2 (en) Floating point arithmetic unit

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040427

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7426

Effective date: 20040430

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040430

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R360 Written notification for declining of transfer of rights

Free format text: JAPANESE INTERMEDIATE CODE: R360

R370 Written measure of declining of transfer procedure

Free format text: JAPANESE INTERMEDIATE CODE: R370

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20090521

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090521

Year of fee payment: 5

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20100521

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20100521

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110521

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20110521

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120521

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20120521

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130521

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20140521

Year of fee payment: 10

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

EXPY Cancellation because of completion of term