JP2004240298A - Hash function processor - Google Patents
Hash function processor Download PDFInfo
- Publication number
- JP2004240298A JP2004240298A JP2003031043A JP2003031043A JP2004240298A JP 2004240298 A JP2004240298 A JP 2004240298A JP 2003031043 A JP2003031043 A JP 2003031043A JP 2003031043 A JP2003031043 A JP 2003031043A JP 2004240298 A JP2004240298 A JP 2004240298A
- Authority
- JP
- Japan
- Prior art keywords
- register
- value
- hash function
- input data
- registers
- 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.)
- Pending
Links
Images
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、ハッシュ関数処理装置に関し、より特定的には、情報通信等の分野においてセキュリティを保護するために、任意長のデータから、逆変換が困難な固定長の値(ハッシュ値)を求めるハッシュ関数処理装置に関する。
【0002】
【従来の技術】
近年、FTTH(Fiber To The Home )やADSL(Asymmetric Digital Subscriber Line)に代表される広帯域なIP(Internet Protocol )インフラが、家庭等にも普及している。これに伴い、高速性が要求されるIP伝送路上においても、メッセージの改竄防止等、セキュリティ技術に対する需要が高まっている。メッセージ改竄防止技術の代表例として、例えば、ハッシュ関数を用いる方法が知られている。ハッシュ関数とは、任意長のメッセージから、そのメッセージに固有な固定長の値(以下、ハッシュ値という)を求める関数である。ハッシュ関数を用いて得られたハッシュ値には、極めて高いランダム性がある。すなわち、異なるメッセージに対しては、極めて高い確率で異なるハッシュ値が得られる。このような特徴を有するハッシュ関数は、メッセージの改竄を検出するための手段として利用することができる。
【0003】
従来、ハッシュ関数の処理装置としては、例えば、特許文献1に記載された処理装置が知られている。この処理装置では、複数段の演算器によって処理される処理データの流れ方向にレジスタを介設させて、複数段に分割された回路部が構成される。また、この処理装置は、少なくとも、ローテーション処理部による入力データに対するビット入れ替え処理、およびローテーション処理部からの出力データと1サイクル前のフィードバックデータとを用いて演算器で演算処理を施す間に、次サイクルの入力データおよび設定数部からの出力データに対する演算処理をオーバーラップして行うことを特徴とする。
【0004】
【特許文献1】
特開2002−72879号公報
【0005】
【発明が解決しようとする課題】
しかしながら、上記従来の処理装置では、ハッシュ関数における繰り返し処理(以下、ラウンド処理という)を行うために、最速の場合でも1ラウンドあたり2クロックサイクルが必要とされる。このため、上記従来の処理装置は、高速処理が要求されるアプリケーションには不向きである。また、オーバーラップ処理を実現するために、パイプライン処理を複数段に分割する必要があり、レジスタ等のハードウェアリソースが多く必要とされる。このように、上記従来の処理装置には、回路規模の増大やコストの増加という課題もある。
【0006】
それ故に、本発明は、ハッシュ関数におけるラウンド処理を、1ラウンドあたり1クロックサイクルで高速に実行するハッシュ関数処理装置を提供することを目的とする。また、本発明は、少ないハードウェアリソースを用いて、ハッシュ関数におけるラウンド処理を高速に実行するハッシュ関数処理装置を提供することを目的とする。
【0007】
【課題を解決するための手段および発明の効果】
第1の発明は、入力データに対して、ハッシュ関数で定められた繰り返し処理を行うハッシュ関数処理装置であって、フィードバックデータを格納する第1から第4のレジスタと、所定長の入力データを供給する入力データ供給部と、ハッシュ関数で定められた定数値を供給する定数値供給部と、第1のレジスタの値と、入力データ供給部から供給される入力データと、定数値供給部から供給される定数値とに対して、所定の演算処理を行う第1の演算処理部と、第1の演算処理部による演算結果を格納する中間値格納レジスタと、第2から第4のレジスタの値と、中間値格納レジスタの値とに対して、所定の演算処理を行う第2の演算処理部とを備え、第1および第2の演算処理部は並列に動作し、かつ、中間値格納レジスタが第1の演算処理部による演算結果を取り込む動作と、第2のレジスタが第2の演算処理部による演算結果を取り込む動作と、第3のレジスタが第2のレジスタの値を取り込む動作と、第1および第4のレジスタが第3のレジスタの値を取り込む動作と、入力データ供給部が次の入力データを取得する動作と、定数値供給部が次の定数値を取得する動作とが、1つのクロックサイクル内で並列に行われることを特徴とする。
このような第1の発明によれば、第1および第2の演算回路は並列に動作し、第1の演算回路の出力は中間値格納レジスタに書き込まれ、第2の演算回路の入力は中間値格納レジスタ等から供給される。これにより、第1および第2の演算回路と中間値格納レジスタとにより、2段のパイプライン処理が行われる。また、パイプラインに適切なタイミングでデータを供給するために、繰り返し処理で使用される入力データおよび定数値は、本来取得すべきタイミングよりも1クロックサイクル前に取得される。したがって、ハッシュ関数における繰り返し処理を、外見上1ラウンドあたり1クロックサイクルで高速に実行することができる。
【0008】
第2の発明は、入力データに対して、ハッシュ関数で定められた繰り返し処理を行うハッシュ関数処理装置であって、フィードバックデータを格納する第1から第3のレジスタと、所定長の入力データを供給する入力データ供給部と、ハッシュ関数で定められた定数値を供給する定数値供給部と、第1のレジスタの値と、入力データ供給部から供給される入力データと、定数値供給部から供給される定数値とに対して、所定の演算処理を行う第1の演算処理部と、第1の演算処理部による演算結果を格納する中間値格納レジスタと、第1から第3のレジスタの値と、中間値格納レジスタの値とに対して、所定の演算処理を行う第2の演算処理部とを備え、第1および第2の演算処理部は並列に動作し、かつ、中間値格納レジスタが第1の演算処理部による演算結果を取り込む動作と、第2のレジスタが第2の演算処理部による演算結果を取り込む動作と、第3のレジスタが第2のレジスタの値を取り込む動作と、第1のレジスタが第3のレジスタの値を取り込む動作と、入力データ供給部が次の入力データを取得する動作と、定数値供給部が次の定数値を取得する動作とが、1つのクロックサイクル内で並列に行われることを特徴とする。
このような第2の発明によれば、第1および第2の演算回路は並列に動作し、第1の演算回路の出力は中間値格納レジスタに書き込まれ、第2の演算回路の入力は中間値格納レジスタ等から供給される。これにより、第1および第2の演算回路と中間値格納レジスタとにより、2段のパイプライン処理が行われる。また、パイプラインに適切なタイミングでデータを供給するために、繰り返し処理で使用される入力データおよび定数値は、本来取得すべきタイミングよりも1クロックサイクル前に取得される。したがって、ハッシュ関数における繰り返し処理を、外見上1ラウンドあたり1クロックサイクルで高速に実行することができる。これに加えて、フィードバックデータを格納するレジスタの数を削減し、少ないハードウェアリソースを用いて、ハッシュ関数における繰り返し処理を高速に実行することができる。
【0009】
第3の発明は、第1または第2の発明において、第1の演算処理部は、第1のレジスタの値と、入力データ供給部から供給される入力データと、定数値供給部から供給される定数値とを加算することを特徴とする。
【0010】
第4の発明は、第1の発明において、第2の演算処理部は、第2から第4のレジスタの値に対して所定の論理演算を行い、当該演算結果と中間値格納レジスタの値との加算結果を所定のビット数だけ巡回シフトした上で、第2のレジスタの値と加算することを特徴とする。
【0011】
第5の発明は、第2の発明において、第2の演算処理部は、第1から第3のレジスタの値に対して所定の論理演算を行い、当該演算結果と中間値格納レジスタの値との加算結果を所定のビット数だけ巡回シフトした上で、第2のレジスタの値と加算することを特徴とする。
【0012】
第6の発明は、第1ないし第5のいずれかの発明において、ハッシュ関数がMD5(Message Digest 5)であることを特徴とする。
このような第3ないし第6の発明によれば、MD5アルゴリズムにおける繰り返し処理を、外見上1ラウンドあたり1クロックサイクルで高速に実行することができる。
【0013】
【発明の実施の形態】
(第1の実施形態)
図1は、本発明の第1の実施形態に係るハッシュ関数処理装置の論理回路図である。図1に示すハッシュ関数処理装置10は、ハッシュ関数の一種であるMessage Digest 5(以下、MD5という)におけるラウンド処理を行う。MD5は、任意長の入力データから、128ビットのハッシュ値を求める関数である。MD5アルゴリズムでは、入力データは、先頭から順に512ビットずつに分割される。その上で、分割後の各入力データ(以下、ブロックデータという)について、以下に示す処理(以下、64ラウンド処理という)が順次行われる。
【0014】
64ラウンド処理では、32ビットの変数A、B、CおよびDが使用される。各ブロックデータに対して64ラウンド処理を行う前に、変数A〜Dには、所定の初期値As〜Ds(最初のブロックデータである場合)、または、これまでのブロックデータに対する64ラウンド処理で求めた変数A〜Dの値(最初のブロックデータでない場合)のいずれかが設定される。その上で、変数iを0から63まで1ずつ順に増加させながら、次式(1)に示す演算が64回行われる。
α=β+((α+Fi(β,γ,Δ)+Xi+Ti)<<<Si) …(1)
ただし、式(1)において、<<< は左巡回シフトを表し、Fi、Xi、TiおよびSiは、それぞれ、i回目の演算における論理演算、32ビットの入力データ、32ビットの定数値、およびシフト数を表す。また、α〜Δは、iを4で割った余りjが0である場合には、順にA、B、C、Dであり、jが1である場合には、順にD、A、B、Cであり、jが2である場合には、順にC、D、A、Bであり、jが3である場合には、順にB、C、D、Aである。
【0015】
以下、式(1)を用いたi回目の演算を、第iラウンドの処理という。各ブロックデータについて第63ラウンドの処理が完了した後、変数A〜Dの値は、これまでのブロックデータに対する64ラウンド処理で求めた変数A〜Dの値と加算される。入力データに含まれるすべてのブロックデータについて64ラウンド処理を行ったとき、最後の加算で得られた結果が、求めるべきハッシュ値となる。なお、MD5アルゴリズムの詳細は、例えば、R.Rivest, ”The MD5 Message Digest Algorithm”, IETF RFC1321, 1992. に記載されている。
【0016】
図1に示すハッシュ関数処理装置10は、レジスタ101〜107および111〜114、加算器121〜128、セレクタ131〜139、巡回シフト演算ブロック141、並びに論理演算ブロック151〜154を備えている。このうち、加算器125および126は、第1の演算処理部161を構成している。また、加算器127および128、セレクタ139、巡回シフト演算ブロック141、並びに、論理演算ブロック151〜154は、第2の演算処理部162を構成している。
【0017】
図1に示す信号線のデータ幅は、128ビットの出力信号HVを除き、いずれも32ビットである。また、図1では、MD5アルゴリズムにおけるラウンド処理を制御するための制御信号や制御回路は、図面の簡単化のために省略されている。なお、この記法は、後述する図3、図5および図7にも適用される。
【0018】
図1において、レジスタ101〜104は、それぞれ、MD5アルゴリズムにおけるラウンド処理で使用されるフィードバックデータを格納する。レジスタ101〜104は、順に、第1のレジスタR1、第4のレジスタR4、第3のレジスタR3、および第2のレジスタR2とも呼ばれる。レジスタ105は、MD5アルゴリズムにおけるラウンド処理を行うときの中間データを格納する。レジスタ106は、MD5アルゴリズムにおけるラウンド処理で処理される、32ビットずつに分割された入力データXiを格納する。レジスタ107は、MD5アルゴリズムにおけるラウンド処理で各ラウンド毎に予め定められた定数値Tiを格納する。レジスタ111〜114は、それぞれ、MD5アルゴリズムにおける、これまでのブロックデータに対する64ラウンド処理で求めた値を格納する。
【0019】
加算器121は、レジスタ101の値とレジスタ111の値とを加算する。加算器122は、レジスタ102の値とレジスタ112の値とを加算する。加算器123は、レジスタ103の値とレジスタ113の値とを加算する。加算器124は、レジスタ104の値とレジスタ114の値とを加算する。加算器125は、レジスタ106の値とレジスタ107の値とを加算する。加算器126は、レジスタ101の値と加算器125の出力とを加算する。加算器127は、レジスタ105の値とセレクタ139の出力とを加算する。加算器128は、レジスタ104の値と巡回シフト演算ブロック141の出力とを加算する。
【0020】
セレクタ131は、MD5アルゴルリズムにおけるラウンド処理開始前の初期値Asと、加算器121の出力とから、適切な値を選択して出力する。セレクタ132は、MD5アルゴルリズムにおけるラウンド処理開始前の初期値Dsと、加算器122の出力とから、適切な値を選択して出力する。セレクタ133は、MD5アルゴルリズムにおけるラウンド処理開始前の初期値Csと、加算器123の出力とから、適切な値を選択して出力する。セレクタ134は、MD5アルゴルリズムにおけるラウンド処理開始前の初期値Bsと、加算器124の出力とから、適切な値を選択して出力する。
【0021】
セレクタ135は、レジスタ111の値と、レジスタ102の値と、レジスタ103の値とから、適切な値を選択して出力する。セレクタ136は、レジスタ112の値と、レジスタ103の値とから、適切な値を選択して出力する。セレクタ137は、レジスタ113の値と、レジスタ104の値とから、適切な値を選択して出力する。セレクタ138は、レジスタ114の値と、加算器128の出力とから、適切な値を選択して出力する。セレクタ139は、論理演算ブロック151〜154の出力から、適切な値を選択して出力する。なお、セレクタ131〜139は、後述するラウンド処理等を正しく行えるように、適切な値を選択して出力する。
【0022】
巡回シフト演算ブロック141は、MD5アルゴリズムに従い、巡回シフト演算を行う。より詳細には、巡回シフト演算ブロック141は、MD5アルゴリズムにおけるラウンド処理で各ラウンド毎に指定された値だけ、入力を左に巡回シフトする。なお、巡回シフト演算ブロック141におけるシフト方向は、入力に含まれる各ビットを左側が上位となるように並べたときの左方向である。
【0023】
論理演算ブロック151〜154は、MD5アルゴリズムにおけるラウンド処理で予め定められた4種類の論理演算のうち、いずれかを行う。具体的には、論理演算ブロック151は、第0〜第15ラウンドにおける論理演算を行う。論理演算ブロック152は、第16〜第31ラウンドにおける論理演算を行う。論理演算ブロック153は、第32〜第47ラウンドにおける論理演算を行う。論理演算ブロック154は、第48〜第63ラウンドにおける論理演算を行う。より詳細には、レジスタ104の値をX、レジスタ103の値をY、レジスタ102の値をZとし、論理和、論理積、否定および排他的論理和の各論理演算を、それぞれ、and、or、notおよびxorと表すとき、論理演算ブロック151は、「(XandY)or((notX)andZ)」なる論理演算を行う。論理演算ブロック152は、「(XandZ)or(Yand(notZ))」なる論理演算を行う。論理演算ブロック153は、「XxorYxorZ」なる論理演算を行う。論理演算ブロック154は、「Yxor(Xor(notZ)」なる論理演算を行う。
【0024】
ハッシュ関数処理装置10は、入力データに対して、まずハッシュ前処理を行い、次にラウンド処理を行い、最後にハッシュ後処理を行う。ハッシュ前処理では、最初のブロックデータを扱う前にレジスタに適切な値を設定する処理が行われる。ラウンド処理では、各ブロックデータに対して、MD5アルゴリズムにおける第0〜第62ラウンドの処理と、ラウンド終端処理とが行われる。ラウンド終端処理では、(a)MD5アルゴリズムにおける第63ラウンドの処理と、(b)今回求めた値と前回までに求めた値とを加算する処理と、(c)次のブロックデータを扱う前に各レジスタに適切な値を設定する処理とが行われる。ただし、最後のブロックデータに対しては、ラウンド終端処理は行われない。ハッシュ後処理では、上記(a)および(b)の処理が行われる。
【0025】
図2は、ハッシュ前処理、ラウンド処理、およびハッシュ後処理によって、レジスタ101〜107および111〜114の値が変化する様子を示す図である。図2において、マイナス記号は、レジスタの値が不定であることを表し、矢印は、レジスタの値が1つ前のクロックサイクルと同じであることを表す。なお、この記法は、後述する図4、図6および図8にも適用される。
【0026】
以下、図2を適宜参照しながら、ハッシュ関数処理装置10の動作を説明する。なお、以下の説明では、2つのレジスタAとBとが同じクロックサイクルでそれぞれある値を取り込むことを、レジスタAとBとは同時に値を取り込む、と表現する場合がある。
【0027】
(1)ハッシュ前処理
ハッシュ前処理は、レジスタ111〜114にMD5アルゴリズムで定められた初期値(図2ではAsおよびDs〜Bs)が格納された状態で、2クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ101〜104は、それぞれ、レジスタ111〜114の値(図2ではAsおよびDs〜Bs)を取り込む。同時に、レジスタ106および107は、それぞれ、外部から与えられた第0ラウンドで使用される入力データおよび定数値(図2ではX0およびT0)を取り込む。
【0028】
次に、第2のクロックサイクルでは、レジスタ105は、加算器126の出力(図2では(As+X0+T0))を取り込む。同時に、レジスタ101は、レジスタ102の値(図2ではDs)を取り込む。同時に、レジスタ106および107は、それぞれ、外部から与えられた第1ラウンドで使用される入力データおよび定数値(図2ではX1およびT1)を取り込む。
【0029】
(2)ラウンド処理
第0〜第62ラウンドの処理は、1ラウンドあたり1クロックサイクルをかけて(すなわち、各ブロックデータに対して63クロックサイクルをかけて)行われる。第0〜第62ラウンドの処理では、各クロックサイクルにおいて、レジスタ101および102は、いずれも、レジスタ103の値を取り込む。同時に、レジスタ103は、レジスタ104の値を取り込む。同時に、レジスタ104は、加算器128の出力を取り込む。同時に、レジスタ105は、加算器126の出力を取り込む。同時に、レジスタ106および107は、それぞれ、外部から与えられた、次の入力データおよび定数値を取り込む。ただし、第62ラウンドの処理では、レジスタ106および107は、任意の値を取り込んでもよい。
【0030】
例として、図2に示す第4ラウンドの処理を説明する。第0〜第3ラウンドの処理で求めた値を、順にA0、D0、C0およびB0とするとき、第3ラウンドの処理を完了した時点で、レジスタ101および102の値はD0、レジスタ103の値はC0、レジスタ104の値はB0、レジスタ105の値は(A0+X4+T4)、レジスタ106の値はX5、レジスタ107の値はT5となっている。そこで、第4ラウンドの処理では、レジスタ101および102は、いずれも、レジスタ103の値C0を取り込む。同時に、レジスタ103は、レジスタ104の値B0を取り込む。同時に、レジスタ104は、加算器128の出力A1を取り込む。ここで、A1は、式(1)において、α〜ΔにA0〜D0を、XiにX4を、TiにT4を代入したときに得られる値である。同時に、レジスタ105は、加算器126の出力(D0+X5+T5)を取り込む。同時に、レジスタ106および107は、それぞれ、次の入力データX6および次の定数値T6を取り込む。
【0031】
一方、ラウンド終端処理は、各ブロックデータに対して4クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ111は、加算器121の出力(図2ではAm)を取り込む。同時に、レジスタ102および103は、それぞれ、レジスタ103および104の値(図2ではD15およびC15)を取り込む。同時に、レジスタ104は、加算器128の出力(図2ではB15)を取り込む。なお、レジスタ101は、任意の値を取り込んでもよく、ここではレジスタ103の値を取り込むものとする。
【0032】
次に、第2のクロックサイクルでは、レジスタ112〜114は、それぞれ、加算器122〜124の出力(図2ではDm〜Bm)を取り込む。なお、レジスタ101〜104は、任意の値を取り込んでもよく、ここでは1つ前のクロックサイクルの値を保持するものとする。
【0033】
次に、第3のクロックサイクルでは、レジスタ101〜104は、それぞれ、レジスタ111〜114の値(図2ではAmおよびDm〜Bm)を取り込む。同時に、レジスタ106および107は、それぞれ、外部から与えられた第0ラウンドで使用される入力データおよび定数値(図2ではX0およびT0)を取り込む。
【0034】
次に、第4のクロックサイクルでは、レジスタ105は、加算器126の出力(図2では(Am+X0+T0))を取り込む。同時に、レジスタ101は、レジスタ102の値(図2ではDm)を取り込む。同時に、レジスタ106および107は、それぞれ、外部から与えられた第1ラウンドで使用される入力データおよび定数値(図2ではX1およびT1)を取り込む。なお、第3および第4のクロックサイクルでレジスタ106に取り込まれる入力データは、次のブロックデータに含まれるデータである。
【0035】
(3)ハッシュ後処理
ハッシュ後処理は、2クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ111は、加算器121の出力(図2ではAe)を取り込む。同時に、レジスタ102および103は、それぞれ、レジスタ103および104の値(図2ではD15およびC15)を取り込む。同時に、レジスタ104は、加算器128の出力(図2ではB15)を取り込む。なお、レジスタ101は、任意の値を取り込んでもよく、ここではレジスタ103の値を取り込むものとする。
【0036】
次に、第2のクロックサイクルでは、レジスタ112〜114は、それぞれ、加算器122〜124の出力(図2ではDe〜Be)を取り込む。なお、レジスタ101〜104は、任意の値を取り込んでもよく、ここでは1つ前のクロックサイクルの値を保持するものとする。
【0037】
第2のクロックサイクルが完了した時点でレジスタ111〜114に格納されている値(図2ではAeおよびDe〜Be)が、求めるべきハッシュ値となる。したがって、図示しない手段を用いてレジスタ111〜114の値を読み出すことにより、入力データ全体に対するハッシュ値を得ることができる。
【0038】
また、第2のクロックサイクルが完了する前の、レジスタ111および加算器122〜124の出力(図1に示す出力信号HV)は、求めるべきハッシュ値に一致する。したがって、ハッシュ関数処理装置10の外部に128ビットのレジスタを設け、設けたレジスタがこのときの出力信号HVを取り込むことにより、入力データ全体に対するハッシュ値を得ることができる。
【0039】
以下、ハッシュ関数処理装置10が奏する効果について説明する。式(1)に示すように、MD5アルゴリズムにおけるラウンド処理では、入力データおよび定数値はフィードバックデータに依存しない。したがって、式(1)に示す演算は、次式(2)および(3)に示すように、2つの演算に分解することができる。ただし、式(2)および(3)において、Qは32ビットの変数である。
Q=α+Xi+Ti …(2)
α=β+((Q+Fi(β,γ,Δ))<<<Si) …(3)
【0040】
これに対応して、ハッシュ関数処理装置10は、式(2)に示す演算処理を行う第1の演算処理部161と、式(3)に示す演算処理を行う第2の演算処理部162と、第1の演算処理部161の出力を格納するレジスタ105とを備えている。また、第1の演算処理部161と第2の演算処理部162とは並列に動作し、第2の演算処理部162の入力はレジスタ105から供給される。これにより、第1の演算処理部161と、第2の演算処理部162と、レジスタ105とによって、2段のパイプライン処理が行われる。また、パイプラインに適切なタイミングでデータを供給するために、各ラウンドで使用される入力データXiおよび定数値Tiは、本来読み込むべきタイミングよりも1クロックサイクル前に読み込まれる。さらに、ラウンド処理を実行中に正しくデータが供給されるように、ハッシュ関数処理装置10は、レジスタ102を経由せずに、レジスタ103の値をレジスタ101に直接書き込む経路も有している。
【0041】
以上のことから、本実施形態に係るハッシュ関数処理装置によれば、2段のパイプライン処理を行うことにより、MD5アルゴリズムのラウンド処理を、外見上1ラウンドあたり1クロックサイクルで高速に実行することができる。
【0042】
(第2の実施形態)
図3は、本発明の第2の実施形態に係るハッシュ関数処理装置の論理回路図である。図3に示すハッシュ関数処理装置20は、第1の実施形態に係るハッシュ関数処理装置10に含まれる回路の一部を変更したものである。ハッシュ関数処理装置20は、レジスタ201〜207および211〜214、加算器221〜228、セレクタ231〜239、巡回シフト演算ブロック241、並びに論理演算ブロック251〜254を備えている。このうち、加算器225および226は、第1の演算処理部261を構成している。また、加算器227および228、セレクタ239、巡回シフト演算ブロック241、並びに、論理演算ブロック251〜254は、第2の演算処理部262を構成している。
【0043】
ハッシュ関数処理装置20の回路構成は、第1の実施形態に係るハッシュ関数処理装置10の回路構成と、次の4つの点で相違する。第1に、セレクタ235は、レジスタ211の値と、レジスタ202の値と、レジスタ203の値と、加算器221の出力と、加算器222の出力とから、適切な値を選択して出力する。第2に、セレクタ236は、レジスタ212の値と、レジスタ203の値と、加算器222の出力とから、適切な値を選択して出力する。第3に、セレクタ237は、レジスタ213の値と、レジスタ204の値と、加算器223の出力とから、適切な値を選択して出力する。第4に、セレクタ238は、レジスタ214の値と、加算器228の出力と、加算器224の出力とから、適切な値を選択して出力する。ハッシュ関数処理装置20の上記以外の構成要素は、ハッシュ関数処理装置10と同じであるので、ここでは説明を省略する。
【0044】
ハッシュ関数処理装置20は、第1の実施形態に係るハッシュ関数処理装置10と同様に、入力データに対して、まずハッシュ前処理を行い、次にラウンド処理を行い、最後にハッシュ後処理を行う。これら3つの処理の内容は、ハッシュ関数処理装置10と同じである。図4は、これら3つの処理によって、レジスタ201〜207および211〜214の値が変化する様子を示す図である。以下、図4を適宜参照しながら、ハッシュ関数処理装置20の動作を説明する。
【0045】
(1)ハッシュ前処理
ハッシュ関数処理装置20におけるハッシュ前処理は、第1の実施形態に係るハッシュ関数処理装置10における処理と同じである。
【0046】
(2)ラウンド処理
ハッシュ関数処理装置20における第0〜第62ラウンドの処理は、第1の実施形態に係るハッシュ関数処理装置10における処理と同じである。第0〜第62ラウンドの処理は、1ラウンドあたり1クロックサイクルをかけて(すなわち、各ブロックデータに対して63クロックサイクルをかけて)行われる。
【0047】
一方、ラウンド終端処理は、各ブロックデータに対して2クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ201および211は、いずれも、加算器221の出力(図4ではAm)を取り込む。同時に、レジスタ202および203は、それぞれ、レジスタ203および204の値(図4ではD15およびC15)を取り込む。同時に、レジスタ204は、加算器228の出力(図4ではB15)を取り込む。同時に、レジスタ206および207は、それぞれ、外部から与えられた第0ラウンドで使用される入力データおよび定数値(図4ではX0およびT0)を取り込む。
【0048】
次に、第2のクロックサイクルでは、レジスタ201、202および212は、いずれも、加算器222の出力(図4ではDm)を取り込む。同時に、レジスタ203および213は、いずれも、加算器223の出力(図4ではCm)を取り込む。同時に、レジスタ204および214は、いずれも、加算器224の出力(図4ではBm)を取り込む。同時に、レジスタ205は、加算器226の出力(図4では(Am+X0+T0))を取り込む。同時に、レジスタ206および207は、それぞれ、外部から与えられた第1ラウンドで使用される入力データおよび定数値(図4ではX1およびT1)を取り込む。なお、第1および第2のクロックサイクルでレジスタ206に取り込まれる入力データは、次のブロックデータに含まれるデータである。
【0049】
(3)ハッシュ後処理
ハッシュ後処理は、2クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ211は、加算器221の出力(図4ではAe)を取り込む。同時に、レジスタ202および203は、それぞれ、レジスタ203および204の値(図4ではD15およびC15)を取り込む。同時に、レジスタ204は、加算器228の出力(図4ではB15)を取り込む。なお、レジスタ201は、任意の値を取り込んでもよく、ここでは加算器221の出力を取り込むものとする。
【0050】
次に、第2のクロックサイクルでは、レジスタ212〜214は、それぞれ、加算器222〜224の出力(図4ではDe〜Be)を取り込む。なお、レジスタ201〜204は、任意の値を取り込んでもよく、ここでは、レジスタ201は、加算器222の出力を取り込み、レジスタ202〜204は、それぞれ、加算器222〜224の出力を取り込むものとする。
【0051】
第2のクロックサイクルが完了した時点でレジスタ211〜214に格納されている値(図4ではAe〜De)が、求めるべきハッシュ値となる。したがって、図示しない手段を用いてレジスタ211〜214の値を読み出すことにより(あるいは、外部に設けたレジスタがハッシュ後処理の第2のクロックサイクルにおける出力信号HVの値を取り込むことにより)、入力データ全体に対するハッシュ値を得ることができる。
【0052】
このようにハッシュ関数処理装置20は、上述した4つの点で第1の実施形態に係るハッシュ関数処理装置10と異なるにも関わらず、MD5アルゴリズムにおけるラウンド処理を正しく実行することができる。また、第1の実施形態に係るハッシュ関数処理装置10は、4クロックサイクルをかけてラウンド終端処理を行うのに対して、ハッシュ関数処理装置20は、2クロックサイクルをかけてラウンド終端処理を行う。
【0053】
以上のことから、本実施形態に係るハッシュ関数処理装置によれば、第1の実施形態に係るハッシュ関数処理装置が奏する効果に加えて、ラウンド終端処理にかかるクロックサイクル数を減らし、ラウンド処理をより高速に実行できるという効果がある。
【0054】
(第3の実施形態)
図5は、本発明の第3の実施形態に係るハッシュ関数処理装置の論理回路図である。図5に示すハッシュ関数処理装置30は、第1の実施形態に係るハッシュ関数処理装置10に含まれる回路の一部を変更したものである。ハッシュ関数処理装置30は、レジスタ302〜307および311〜314、加算器321〜328、セレクタ331〜334および336〜339、巡回シフト演算ブロック341、並びに論理演算ブロック351〜354を備えている。このうち、加算器325および326は、第1の演算処理部361を構成している。また、加算器327および328、セレクタ339、巡回シフト演算ブロック341、並びに、論理演算ブロック351〜354は、第2の演算処理部362を構成している。
【0055】
ハッシュ関数処理装置30の回路構成は、第1の実施形態に係るハッシュ関数処理装置10の回路構成と、次の3つの点で相違する。第1に、ハッシュ関数処理装置10のレジスタ101およびセレクタ135は、ハッシュ関数処理装置20では削除されている。第2に、セレクタ336は、レジスタ311の値と、レジスタ312の値と、レジスタ303の値とから、適切な値を選択して出力する。第3に、加算器321は、レジスタ302の値とレジスタ311の値とを加算する。ハッシュ関数処理装置30の上記以外の構成要素は、ハッシュ関数処理装置10と同じであるので、ここでは説明を省略する。なお、本実施形態では、レジスタ302〜304は、順に、第1のレジスタR1、第3のレジスタR3、および第2のレジスタR2と呼ばれる。
【0056】
ハッシュ関数処理装置30は、第1の実施形態に係るハッシュ関数処理装置10と同様に、入力データに対して、まずハッシュ前処理を行い、次にラウンド処理を行い、最後にハッシュ後処理を行う。これら3つの処理の内容は、ハッシュ関数処理装置10と同じである。図6は、これら3つの処理によって、レジスタ302〜307および311〜314の値が変化する様子を示す図である。以下、図6を適宜参照しながら、ハッシュ関数処理装置30の動作を説明する。
【0057】
(1)ハッシュ前処理
ハッシュ前処理は、レジスタ311〜314にMD5アルゴリズムで定められた初期値(図6ではAsおよびDs〜Bs)が格納された状態で、2クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ302は、第1の実施形態とは異なり、レジスタ311の値(図6ではAs)を取り込む。同時に、レジスタ303および304は、それぞれ、レジスタ313および314の値(図6ではCsおよびBs)を取り込む。同時に、レジスタ306および307は、それぞれ、外部から与えられた第0ラウンドで使用される入力データおよび定数値(図6ではX0およびT0)を取り込む。
【0058】
次に、第2のクロックサイクルでは、レジスタ305は、加算器326の出力(図6では(As+X0+T0))を取り込む。同時に、レジスタ302は、第1の実施形態とは異なり、レジスタ312の値(図6ではDs)を取り込む。同時に、レジスタ306および307は、それぞれ、外部から与えられた第1ラウンドで使用される入力データおよび定数値(図6ではX1およびT1)を取り込む。
【0059】
(2)ラウンド処理
第0〜第62ラウンドの処理は、1ラウンドあたり1クロックサイクルをかけて(すなわち、各ブロックデータに対して63クロックサイクルをかけて)行われる。ハッシュ関数処理装置30による第0〜第62ラウンドの処理は、レジスタ101に対応したレジスタが存在しない点を除き、第1の実施形態に係るハッシュ関数処理装置10による処理と同じである。すなわち、各クロックサイクルにおいて、レジスタ302は、レジスタ303の値を取り込む。同時に、レジスタ303は、レジスタ304の値を取り込む。同時に、レジスタ304は、加算器328の出力を取り込む。同時に、レジスタ305は、加算器326の出力を取り込む。同時に、レジスタ306および307は、それぞれ、外部から与えられた、次の入力データおよび定数値を取り込む。ただし、第62ラウンドの処理では、レジスタ306および307は、任意の値を取り込んでもよい。
【0060】
一方、ラウンド終端処理は、各ブロックデータに対して4クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ311は、加算器321の出力(図6ではAm)を取り込む。同時に、レジスタ302および303は、それぞれ、レジスタ303および304の値(図6ではD15およびC15)を取り込む。同時に、レジスタ304は、加算器328の出力(図6ではB15)を取り込む。
【0061】
次に、第2のクロックサイクルでは、レジスタ312〜314は、それぞれ、加算器322〜324の出力(図6ではDm〜Bm)を取り込む。なお、レジスタ302〜304は、任意の値を取り込んでもよく、ここでは1つ前のクロックサイクルの値を保持するものとする。
【0062】
次に、第3のクロックサイクルでは、レジスタ302は、レジスタ311の値(図6ではAm)を取り込む。同時に、レジスタ303および304は、それぞれ、レジスタ313および314の値(図6ではCmおよびBm)を取り込む。同時に、レジスタ306および307は、それぞれ、外部から与えられた第0ラウンドで使用される入力データおよび定数値(図6ではX0およびT0)を取り込む。
【0063】
次に、第4のクロックサイクルでは、レジスタ305は、加算器326の出力(図6では(Am+X0+T0))を取り込む。同時に、レジスタ302は、レジスタ312の値(図6ではDm)を取り込む。同時に、レジスタ306および307は、それぞれ、外部から与えられた第1ラウンドで使用される入力データおよび定数値(図6ではX1およびT1)を取り込む。なお、第3および第4のクロックサイクルでレジスタ306に取り込まれる入力データは、次のブロックデータに含まれるデータである。
【0064】
(3)ハッシュ後処理
ハッシュ後処理は、2クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ311は、加算器321の出力(図6ではAe)を取り込む。同時に、レジスタ302および303は、それぞれ、レジスタ303および304の値(図6ではD15およびC15)を取り込む。同時に、レジスタ304は、加算器328の出力(図6ではB15)を取り込む。
【0065】
次に、第2のクロックサイクルでは、レジスタ312〜314は、それぞれ、加算器322〜324の出力(図6ではDe〜Be)を取り込む。なお、レジスタ302〜304は、任意の値を取り込んでもよく、ここでは1つ前のクロックサイクルの値を保持するものとする。
【0066】
第2のクロックサイクルが完了した時点でレジスタ311〜314に格納されている値(図6ではAeおよびDe〜Be)が、求めるべきハッシュ値となる。したがって、図示しない手段を用いてレジスタ311〜314の値を読み出すことにより(あるいは、外部に設けたレジスタがハッシュ後処理の第2のクロックサイクルにおける出力信号HVの値を取り込むことにより)、入力データ全体に対するハッシュ値を得ることができる。
【0067】
このようにハッシュ関数処理装置30は、上述した3つの点で第1の実施形態に係るハッシュ関数処理装置10と異なるにも関わらず、MD5アルゴリズムにおけるラウンド処理を正しく実行することができる。また、ハッシュ関数処理装置30からは、レジスタ101に対応するレジスタが除去されている。
【0068】
以上のことから、本実施形態に係るハッシュ関数処理装置によれば、第1の実施形態に係るハッシュ関数処理装置が奏する効果に加えて、回路規模を削減できるという効果がある。
【0069】
(第4の実施形態)
図7は、本発明の第4の実施形態に係るハッシュ関数処理装置の論理回路図である。図7に示すハッシュ関数処理装置40は、第3の実施形態に係るハッシュ関数処理装置30に含まれる回路の一部を変更したものである。ハッシュ関数処理装置40は、レジスタ402〜407および411〜414、加算器421〜428、セレクタ431〜434および436〜439、巡回シフト演算ブロック441、並びに論理演算ブロック451〜454を備えている。このうち、加算器425および426は、第1の演算処理部461を構成している。また、加算器427および428、セレクタ439、巡回シフト演算ブロック441、並びに、論理演算ブロック451〜454は、第2の演算処理部462を構成している。
【0070】
ハッシュ関数処理装置40の回路構成は、第3の実施形態に係るハッシュ関数処理装置30の回路構成と、次の3つの点で相違する。第1に、セレクタ436は、レジスタ411の値と、レジスタ412の値と、レジスタ403の値と、加算器421の出力とから、適切な値を選択して出力する。第2に、セレクタ437は、レジスタ413の値と、レジスタ404の値と、加算器423の出力とから、適切な値を選択して出力する。第3に、セレクタ438は、レジスタ414の値と、加算器428の出力と、加算器424の出力とから、適切な値を選択して出力する。ハッシュ関数処理装置40の上記以外の構成要素は、ハッシュ関数処理装置30と同じであるので、ここでは説明を省略する。
【0071】
ハッシュ関数処理装置40は、第3の実施形態に係るハッシュ関数処理装置30と同様に、入力データに対して、まずハッシュ前処理を行い、次にラウンド処理を行い、最後にハッシュ後処理を行う。これら3つの処理の内容は、ハッシュ関数処理装置30と同じである。図8は、これら3つの処理によって、レジスタ402〜407および411〜414の値が変化する様子を示す図である。以下、図8を適宜参照しながら、ハッシュ関数処理装置40の動作を説明する。
【0072】
(1)ハッシュ前処理
ハッシュ関数処理装置40におけるハッシュ前処理は、第3の実施形態に係るハッシュ関数処理装置30における処理と同じである。
【0073】
(2)ラウンド処理
ハッシュ関数処理装置40における第0〜第62ラウンドの処理は、第3の実施形態に係るハッシュ関数処理装置30における処理と同じである。第0〜第62ラウンドの処理は、1ラウンドあたり1クロックサイクルをかけて(すなわち、各ブロックデータに対して63クロックサイクルをかけて)行われる。
【0074】
一方、ラウンド終端処理は、各ブロックデータに対して2クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ402および411は、いずれも、加算器421の出力(図8ではAm)を取り込む。同時に、レジスタ412は、加算器422の出力(図8ではDm)を取り込む。同時に、レジスタ403は、レジスタ404の値(図8ではC15)を取り込む。同時に、レジスタ404は、加算器428の出力(図8ではB15)を取り込む。同時に、レジスタ406および407は、それぞれ、外部から与えられた第0ラウンドで使用される入力データおよび定数値(図8ではX0およびT0)を取り込む。
【0075】
次に、第2のクロックサイクルでは、レジスタ402は、レジスタ412の値(図4ではDm)を取り込む。同時に、レジスタ403および413は、いずれも、加算器423の出力(図8ではCm)を取り込む。同時に、レジスタ404および414は、いずれも、加算器424の出力(図8ではBm)を取り込む。同時に、レジスタ405は、加算器426の出力(図8では(Am+X0+T0))を取り込む。同時に、レジスタ406および407は、それぞれ、外部から与えられた第1ラウンドで使用される入力データおよび定数値(図8ではX1およびT1)を取り込む。なお、第1および第2のクロックサイクルでレジスタ406に取り込まれる入力データは、次のブロックデータに含まれるデータである。
【0076】
(3)ハッシュ後処理
ハッシュ後処理は、2クロックサイクルをかけて行われる。第1のクロックサイクルでは、レジスタ411および412は、それぞれ、加算器421および422の出力(図8ではAeおよびDe)を取り込む。同時に、レジスタ403は、レジスタ404の値(図8ではC15)を取り込む。同時に、レジスタ404は、加算器428の出力(図8ではB15)を取り込む。レジスタ402は、任意の値を取り込んでもよく、ここでは加算器421の出力を取り込むものとする。
【0077】
次に、第2のクロックサイクルでは、レジスタ413および414は、それぞれ、加算器423および424の出力(図8ではCeおよびBe)を取り込む。レジスタ402〜404は、任意の値を取り込んでもよく、ここではレジスタ402は、レジスタ412の値を取り込み、レジスタ403および404は、それぞれ、加算器423および424の出力を取り込むものとする。
【0078】
第2のクロックサイクルが完了した時点でレジスタ411〜414に格納されている値(図8ではAeおよびDe〜Be)が、求めるべきハッシュ値となる。したがって、図示しない手段を用いてレジスタ411〜414の値を読み出すことにより(あるいは、外部に設けたレジスタがハッシュ後処理の第2のクロックサイクルにおける出力信号HVの値を取り込むことにより)、入力データ全体に対するハッシュ値を得ることができる。
【0079】
このようにハッシュ関数処理装置40は、上述した4つの点で第3の実施形態に係るハッシュ関数処理装置30と異なるにも関わらず、MD5アルゴリズムにおけるラウンド処理を正しく実行することができる。また、第3の実施形態に係るハッシュ関数処理装置30は、4クロックサイクルをかけてラウンド終端処理を行うのに対して、ハッシュ関数処理装置40は、2クロックサイクルをかけてラウンド終端処理を行う。
【0080】
以上のことから、本実施形態に係るハッシュ関数処理装置によれば、第3の実施形態に係るハッシュ関数処理装置が奏する効果に加えて、ラウンド終端処理にかかるクロックサイクル数を減らし、ラウンド処理をより高速に実行できるという効果がある。すなわち、第1の実施形態に係るハッシュ関数処理装置が奏する効果に加えて、回路規模を削減し、かつ、ラウンド処理をより高速に実行できるという効果がある。
【0081】
なお、本発明のハッシュ関数処理装置は、上述したパイプライン処理によって第0〜第62ラウンドの処理を行うものであればよく、上記各実施形態で示した装置以外の変形例を構成することができる。例えば、第1の実施形態に係るハッシュ関数処理装置10について言えば、初期値As〜Dsをレジスタ111〜114に設定するタイミング、ハッシュ前処理、ラウンド終端処理、およびハッシュ後処理におけるレジスタ101〜104の更新タイミング、レジスタ111〜114の更新タイミング、任意の値を取り込んでもよいレジスタに設定される値等については、種々の設計が可能である。第2ないし第4の実施形態に係るハッシュ関数処理装置についても、これと同様である。
【0082】
また、上記各実施形態では、ハッシュ関数としてMD5アルゴリズムを使用することとしたが、ハッシュ関数として他のアルゴリズムを使用してもよいことは言うまでもない。
【図面の簡単な説明】
【図1】本発明の第1の実施形態に係るハッシュ関数処理装置の論理回路図である。
【図2】本発明の第1の実施形態に係るハッシュ関数処理装置に含まれるレジスタの値が変化する様子を示す図である。
【図3】本発明の第2の実施形態に係るハッシュ関数処理装置の論理回路図である。
【図4】本発明の第2の実施形態に係るハッシュ関数処理装置に含まれるレジスタの値が変化する様子を示す図である。
【図5】本発明の第3の実施形態に係るハッシュ関数処理装置の論理回路図である。
【図6】本発明の第3の実施形態に係るハッシュ関数処理装置に含まれるレジスタの値が変化する様子を示す図である。
【図7】本発明の第4の実施形態に係るハッシュ関数処理装置の論理回路図である。
【図8】本発明の第4の実施形態に係るハッシュ関数処理装置に含まれるレジスタの値が変化する様子を示す図である。
【符号の説明】
10、20、30、40…ハッシュ関数処理装置
101〜107、111〜114、201〜207、211〜214、302〜307、311〜314、402〜407、411〜414…レジスタ
121〜128、221〜228、321〜328、421〜428…加算器
131〜139、231〜239、331〜334、336〜339、431〜434、436〜439…セレクタ
141、241、341、441…巡回シフト演算ブロック
151〜154、251〜254、351〜354、451〜454…論理演算ブロック
161、261、361、461…第1の演算処理部
162、262、362、462…第2の演算処理部[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a hash function processing device, and more particularly, to obtain a fixed-length value (hash value) that is difficult to reverse-transform from arbitrary-length data in order to protect security in the field of information communication and the like. The present invention relates to a hash function processing device.
[0002]
[Prior art]
In recent years, broadband IP (Internet Protocol) infrastructures represented by FTTH (Fiber To The Home) and ADSL (Asymmetric Digital Subscriber Line) have become widespread in homes and the like. Along with this, demands for security techniques, such as prevention of message tampering, have been increasing even on IP transmission paths that require high speed. As a typical example of the message tampering prevention technique, for example, a method using a hash function is known. The hash function is a function for obtaining a fixed-length value (hereinafter, referred to as a hash value) unique to a message of an arbitrary length. The hash value obtained by using the hash function has extremely high randomness. That is, different hash values are obtained with extremely high probability for different messages. A hash function having such characteristics can be used as a means for detecting tampering of a message.
[0003]
Conventionally, as a processing device for a hash function, for example, a processing device described in
[0004]
[Patent Document 1]
JP-A-2002-72879
[0005]
[Problems to be solved by the invention]
However, in the above-described conventional processing apparatus, two clock cycles are required per round at the highest speed in order to perform the repetition processing (hereinafter, round processing) in the hash function. For this reason, the conventional processing apparatus is not suitable for applications requiring high-speed processing. Further, in order to realize the overlap processing, it is necessary to divide the pipeline processing into a plurality of stages, and a large number of hardware resources such as registers are required. As described above, the above-described conventional processing apparatus also has a problem that the circuit scale is increased and the cost is increased.
[0006]
Therefore, an object of the present invention is to provide a hash function processing device that executes round processing in a hash function at high speed with one clock cycle per round. Another object of the present invention is to provide a hash function processing device that executes round processing in a hash function at high speed using a small amount of hardware resources.
[0007]
Means for Solving the Problems and Effects of the Invention
A first invention is a hash function processing device that performs iterative processing defined by a hash function on input data, the first to fourth registers storing feedback data, and input data having a predetermined length. An input data supply unit for supplying, a constant value supply unit for supplying a constant value determined by the hash function, a value of the first register, input data supplied from the input data supply unit, and a constant value supply unit. A first arithmetic processing unit that performs a predetermined arithmetic processing on the supplied constant value, an intermediate value storage register that stores an arithmetic result of the first arithmetic processing unit, and a second to a fourth register. A second arithmetic processing unit for performing predetermined arithmetic processing on the value and the value of the intermediate value storage register, wherein the first and second arithmetic processing units operate in parallel and store the intermediate value. Register is the first operation An operation of taking in the operation result by the control unit, an operation of the second register taking in the operation result of the second operation processing unit, an operation of taking in the value of the second register by the third register, and the first and fourth registers. Of the third register, the operation of the input data supply unit to acquire the next input data, and the operation of the constant value supply unit to acquire the next constant value within one clock cycle. Are performed in parallel.
According to the first aspect, the first and second arithmetic circuits operate in parallel, the output of the first arithmetic circuit is written to the intermediate value storage register, and the input of the second arithmetic circuit is the intermediate value. It is supplied from a value storage register or the like. Thus, two-stage pipeline processing is performed by the first and second arithmetic circuits and the intermediate value storage register. Further, in order to supply data to the pipeline at an appropriate timing, input data and a constant value used in the repetitive processing are acquired one clock cycle before the timing at which the data should be acquired. Therefore, the iterative process in the hash function can be executed at a high speed with one clock cycle per round in appearance.
[0008]
A second invention is a hash function processing device that performs iterative processing defined by a hash function on input data, the first to third registers storing feedback data, and a predetermined length of input data. An input data supply unit for supplying, a constant value supply unit for supplying a constant value determined by the hash function, a value of the first register, input data supplied from the input data supply unit, and a constant value supply unit. A first arithmetic processing unit that performs a predetermined arithmetic processing on the supplied constant value, an intermediate value storage register that stores an arithmetic result of the first arithmetic processing unit, and a first to a third register. A second arithmetic processing unit for performing predetermined arithmetic processing on the value and the value of the intermediate value storage register, wherein the first and second arithmetic processing units operate in parallel and store the intermediate value. Register is the first operation The second register takes in the operation result of the second operation processing unit, the third register takes in the value of the second register, and the first register takes the value of the second register. The operation of capturing the value of the third register, the operation of the input data supply unit acquiring the next input data, and the operation of the constant value supply unit acquiring the next constant value are performed in parallel within one clock cycle. It is characterized by being performed.
According to the second aspect, the first and second arithmetic circuits operate in parallel, the output of the first arithmetic circuit is written to the intermediate value storage register, and the input of the second arithmetic circuit is intermediate. It is supplied from a value storage register or the like. Thus, two-stage pipeline processing is performed by the first and second arithmetic circuits and the intermediate value storage register. Further, in order to supply data to the pipeline at an appropriate timing, input data and a constant value used in the repetitive processing are acquired one clock cycle before the timing at which the data should be acquired. Therefore, the iterative process in the hash function can be executed at a high speed with one clock cycle per round in appearance. In addition to this, the number of registers for storing feedback data can be reduced, and iterative processing in the hash function can be executed at high speed using a small amount of hardware resources.
[0009]
In a third aspect based on the first or second aspect, the first arithmetic processing unit is configured to receive the value of the first register, the input data supplied from the input data supply unit, and the input data supplied from the constant value supply unit. And a constant value.
[0010]
In a fourth aspect based on the first aspect, the second arithmetic processing section performs a predetermined logical operation on the values of the second to fourth registers, and stores the arithmetic result and the value of the intermediate value storage register. Is cyclically shifted by a predetermined number of bits and then added to the value of the second register.
[0011]
In a fifth aspect based on the second aspect, the second arithmetic processing unit performs a predetermined logical operation on the values of the first to third registers, and calculates a result of the arithmetic operation with the value of the intermediate value storage register. Is cyclically shifted by a predetermined number of bits and then added to the value of the second register.
[0012]
According to a sixth aspect, in any one of the first to fifth aspects, the hash function is MD5 (Message Digest 5).
According to the third to sixth aspects, the repetitive processing in the MD5 algorithm can be executed at a high speed with one clock cycle per round in appearance.
[0013]
BEST MODE FOR CARRYING OUT THE INVENTION
(1st Embodiment)
FIG. 1 is a logic circuit diagram of the hash function processing device according to the first embodiment of the present invention. The hash
[0014]
In the 64-round process, variables A, B, C, and D of 32 bits are used. Before performing the 64-round processing on each block data, the variables A to D have predetermined initial values As to Ds (when the block data is the first block data) or the variables A to D in the 64-round processing on the block data so far. One of the obtained values of the variables A to D (when the data is not the first block data) is set. Then, the operation shown in the following equation (1) is performed 64 times while the variable i is sequentially increased from 0 to 63 in steps of one.
α = β + ((α + Fi (β, γ, Δ) + Xi + Ti) <<<< Si) (1)
Here, in the equation (1), <<<< indicates a left cyclic shift, and Fi, Xi, Ti, and Si represent a logical operation, a 32-bit input data, a 32-bit constant value, and a logical operation in the i-th operation, respectively. Indicates the shift number. Α to Δ are A, B, C, and D in order when the remainder j obtained by dividing i by 4 is 0, and D, A, B, and in order when j is 1. If it is C and j is 2, then it is C, D, A, B in order, and if j is 3, it is B, C, D, A in order.
[0015]
Hereinafter, the i-th operation using Expression (1) is referred to as an i-th round process. After the 63rd round of processing is completed for each block data, the values of the variables A to D are added to the values of the variables A to D obtained by the 64 round processing on the block data so far. When 64 rounds of processing are performed on all block data included in the input data, the result obtained by the final addition becomes the hash value to be obtained. The details of the MD5 algorithm are described in, for example, R. Rivest, "The MD5 Message Digest Algorithm", IETF RFC 1321, 1992. It is described in.
[0016]
The hash
[0017]
The data width of each of the signal lines shown in FIG. 1 is 32 bits except for the output signal HV of 128 bits. In FIG. 1, control signals and control circuits for controlling round processing in the MD5 algorithm are omitted for simplification of the drawing. This notation is also applied to FIGS. 3, 5, and 7 described below.
[0018]
In FIG. 1, registers 101 to 104 store feedback data used in round processing in the MD5 algorithm. The
[0019]
The
[0020]
The
[0021]
The
[0022]
The cyclic
[0023]
The logical operation blocks 151 to 154 perform any one of four types of predetermined logical operations in the round processing in the MD5 algorithm. Specifically, the
[0024]
The hash
[0025]
FIG. 2 is a diagram illustrating how the values of the
[0026]
Hereinafter, the operation of the hash
[0027]
(1) Hash preprocessing
The hash preprocessing is performed in two clock cycles in a state where the
[0028]
Next, in the second clock cycle, the
[0029]
(2) Round processing
The processing of the 0th to 62nd rounds is performed by taking one clock cycle per round (that is, by taking 63 clock cycles for each block data). In the processing of the 0th to 62nd rounds, each of the
[0030]
As an example, the processing of the fourth round shown in FIG. 2 will be described. When the values obtained in the processing of the 0th to third rounds are A0, D0, C0, and B0 in order, the value of the
[0031]
On the other hand, the round termination processing is performed over four clock cycles for each block data. In the first clock cycle, the
[0032]
Next, in the second clock cycle, the
[0033]
Next, in the third clock cycle, the
[0034]
Next, in the fourth clock cycle, the
[0035]
(3) Hash post-processing
Post-hash processing is performed over two clock cycles. In the first clock cycle, the
[0036]
Next, in the second clock cycle, the
[0037]
At the time when the second clock cycle is completed, the values (Ae and De to Be in FIG. 2) stored in the
[0038]
Before the second clock cycle is completed, the outputs of the
[0039]
Hereinafter, the effects provided by the hash
Q = α + Xi + Ti (2)
α = β + ((Q + Fi (β, γ, Δ)) <<<< Si) (3)
[0040]
Correspondingly, the hash
[0041]
As described above, according to the hash function processing device according to the present embodiment, the round processing of the MD5 algorithm can be executed at a high speed in one clock cycle per apparently by performing two-stage pipeline processing. Can be.
[0042]
(Second embodiment)
FIG. 3 is a logic circuit diagram of the hash function processing device according to the second embodiment of the present invention. The hash
[0043]
The circuit configuration of the hash
[0044]
The hash
[0045]
(1) Hash preprocessing
The pre-hash processing in the hash
[0046]
(2) Round processing
The processes in the 0th to 62nd rounds in the hash
[0047]
On the other hand, the round termination processing is performed by taking two clock cycles for each block data. In the first clock cycle, both the
[0048]
Next, in the second clock cycle, the
[0049]
(3) Hash post-processing
Post-hash processing is performed over two clock cycles. In the first clock cycle, the
[0050]
Next, in the second clock cycle, the
[0051]
When the second clock cycle is completed, the values (Ae to De in FIG. 4) stored in the
[0052]
As described above, the hash
[0053]
From the above, according to the hash function processing device according to the present embodiment, in addition to the effects achieved by the hash function processing device according to the first embodiment, the number of clock cycles required for round termination processing is reduced, and round processing is performed. There is an effect that execution can be performed at higher speed.
[0054]
(Third embodiment)
FIG. 5 is a logic circuit diagram of the hash function processing device according to the third embodiment of the present invention. The hash
[0055]
The circuit configuration of the hash
[0056]
The hash
[0057]
(1) Hash preprocessing
The hash preprocessing is performed over two clock cycles in a state where the
[0058]
Next, in the second clock cycle, the
[0059]
(2) Round processing
The processing of the 0th to 62nd rounds is performed by taking one clock cycle per round (that is, by taking 63 clock cycles for each block data). The processes of the 0th to 62nd rounds by the hash
[0060]
On the other hand, the round termination processing is performed over four clock cycles for each block data. In the first clock cycle, the
[0061]
Next, in the second clock cycle, the
[0062]
Next, in the third clock cycle, the
[0063]
Next, in the fourth clock cycle, the
[0064]
(3) Hash post-processing
Post-hash processing is performed over two clock cycles. In the first clock cycle, the
[0065]
Next, in the second clock cycle, the
[0066]
At the time when the second clock cycle is completed, the values (Ae and De to Be in FIG. 6) stored in the
[0067]
As described above, the hash
[0068]
As described above, according to the hash function processing device according to the present embodiment, in addition to the effect provided by the hash function processing device according to the first embodiment, there is an effect that the circuit scale can be reduced.
[0069]
(Fourth embodiment)
FIG. 7 is a logic circuit diagram of the hash function processing device according to the fourth embodiment of the present invention. A hash
[0070]
The circuit configuration of the hash
[0071]
The hash
[0072]
(1) Hash preprocessing
The pre-hash processing in the hash
[0073]
(2) Round processing
The processes in the 0th to 62nd rounds in the hash
[0074]
On the other hand, the round termination processing is performed by taking two clock cycles for each block data. In the first clock cycle, both
[0075]
Next, in the second clock cycle, the
[0076]
(3) Hash post-processing
Post-hash processing is performed over two clock cycles. In the first clock cycle, registers 411 and 412 take in the outputs (Ae and De in FIG. 8) of
[0077]
Next, in the second clock cycle, the
[0078]
At the time when the second clock cycle is completed, the values (Ae and De to Be in FIG. 8) stored in the
[0079]
As described above, the hash
[0080]
From the above, according to the hash function processing device according to the present embodiment, in addition to the effect provided by the hash function processing device according to the third embodiment, the number of clock cycles required for round termination processing is reduced, and round processing is performed. There is an effect that execution can be performed at higher speed. That is, in addition to the effects provided by the hash function processing device according to the first embodiment, there is an effect that the circuit scale can be reduced and round processing can be executed at higher speed.
[0081]
The hash function processing device of the present invention may be any device that performs the processes of the 0th to 62nd rounds by the above-described pipeline process, and may constitute a modified example other than the devices described in the above embodiments. it can. For example, regarding the hash
[0082]
Further, in each of the above embodiments, the MD5 algorithm is used as the hash function, but it goes without saying that another algorithm may be used as the hash function.
[Brief description of the drawings]
FIG. 1 is a logic circuit diagram of a hash function processing device according to a first embodiment of the present invention.
FIG. 2 is a diagram illustrating a state where a value of a register included in the hash function processing device according to the first embodiment of the present invention changes.
FIG. 3 is a logic circuit diagram of a hash function processing device according to a second embodiment of the present invention.
FIG. 4 is a diagram illustrating a state where a value of a register included in a hash function processing device according to a second embodiment of the present invention changes.
FIG. 5 is a logic circuit diagram of a hash function processing device according to a third embodiment of the present invention.
FIG. 6 is a diagram illustrating a state in which the value of a register included in a hash function processing device according to a third embodiment of the present invention changes.
FIG. 7 is a logic circuit diagram of a hash function processing device according to a fourth embodiment of the present invention.
FIG. 8 is a diagram illustrating a state in which a value of a register included in a hash function processing device according to a fourth embodiment of the present invention changes.
[Explanation of symbols]
10, 20, 30, 40 ... hash function processing device
101-107, 111-114, 201-207, 211-214, 302-307, 311-314, 402-407, 411-414 ... registers
121-128, 221-228, 321-328, 421-428 ... adders
131-139, 231-239, 331-334, 336-339, 431-434, 436-439 ... selector
141, 241, 341, 441... Cyclic shift operation block
151-154, 251-254, 351-354, 451-454 ... Logic operation block
161, 261, 361, 461: first arithmetic processing unit
162, 262, 362, 462: second arithmetic processing unit
Claims (6)
フィードバックデータを格納する第1から第4のレジスタと、
所定長の入力データを供給する入力データ供給部と、
ハッシュ関数で定められた定数値を供給する定数値供給部と、
前記第1のレジスタの値と、前記入力データ供給部から供給される入力データと、前記定数値供給部から供給される定数値とに対して、所定の演算処理を行う第1の演算処理部と、
前記第1の演算処理部による演算結果を格納する中間値格納レジスタと、
前記第2から第4のレジスタの値と、前記中間値格納レジスタの値とに対して、所定の演算処理を行う第2の演算処理部とを備え、
前記第1および第2の演算処理部は並列に動作し、かつ、前記中間値格納レジスタが前記第1の演算処理部による演算結果を取り込む動作と、前記第2のレジスタが前記第2の演算処理部による演算結果を取り込む動作と、前記第3のレジスタが前記第2のレジスタの値を取り込む動作と、前記第1および第4のレジスタが前記第3のレジスタの値を取り込む動作と、前記入力データ供給部が次の入力データを取得する動作と、前記定数値供給部が次の定数値を取得する動作とが、1つのクロックサイクル内で並列に行われることを特徴とする、ハッシュ関数処理装置。A hash function processing device that performs iterative processing defined by a hash function on input data,
First to fourth registers for storing feedback data;
An input data supply unit for supplying input data of a predetermined length,
A constant value supply unit that supplies a constant value determined by a hash function,
A first arithmetic processing unit that performs predetermined arithmetic processing on the value of the first register, the input data supplied from the input data supply unit, and the constant value supplied from the constant value supply unit When,
An intermediate value storage register for storing a calculation result by the first calculation processing unit;
A second arithmetic processing unit that performs predetermined arithmetic processing on the values of the second to fourth registers and the value of the intermediate value storage register;
The first and second arithmetic processing units operate in parallel, and the intermediate value storage register fetches the operation result by the first arithmetic processing unit, and the second register performs the second arithmetic operation. An operation of capturing a calculation result by the processing unit, an operation of capturing the value of the second register by the third register, an operation of capturing the value of the third register by the first and fourth registers, A hash function, wherein the operation of the input data supply unit to obtain the next input data and the operation of the constant value supply unit to obtain the next constant value are performed in parallel within one clock cycle. Processing equipment.
フィードバックデータを格納する第1から第3のレジスタと、
所定長の入力データを供給する入力データ供給部と、
ハッシュ関数で定められた定数値を供給する定数値供給部と、
前記第1のレジスタの値と、前記入力データ供給部から供給される入力データと、前記定数値供給部から供給される定数値とに対して、所定の演算処理を行う第1の演算処理部と、
前記第1の演算処理部による演算結果を格納する中間値格納レジスタと、
前記第1から第3のレジスタの値と、前記中間値格納レジスタの値とに対して、所定の演算処理を行う第2の演算処理部とを備え、
前記第1および第2の演算処理部は並列に動作し、かつ、前記中間値格納レジスタが前記第1の演算処理部による演算結果を取り込む動作と、前記第2のレジスタが前記第2の演算処理部による演算結果を取り込む動作と、前記第3のレジスタが前記第2のレジスタの値を取り込む動作と、前記第1のレジスタが前記第3のレジスタの値を取り込む動作と、前記入力データ供給部が次の入力データを取得する動作と、前記定数値供給部が次の定数値を取得する動作とが、1つのクロックサイクル内で並列に行われることを特徴とする、ハッシュ関数処理装置。A hash function processing device that performs iterative processing defined by a hash function on input data,
First to third registers for storing feedback data;
An input data supply unit for supplying input data of a predetermined length,
A constant value supply unit that supplies a constant value determined by a hash function,
A first arithmetic processing unit that performs predetermined arithmetic processing on the value of the first register, the input data supplied from the input data supply unit, and the constant value supplied from the constant value supply unit When,
An intermediate value storage register for storing a calculation result by the first calculation processing unit;
A second arithmetic processing unit that performs predetermined arithmetic processing on the values of the first to third registers and the value of the intermediate value storage register;
The first and second arithmetic processing units operate in parallel, and the intermediate value storage register fetches the operation result by the first arithmetic processing unit, and the second register performs the second arithmetic operation. An operation of taking in the operation result by the processing unit, an operation of taking in the value of the second register by the third register, an operation of taking in the value of the third register by the first register, A hash function processing device, wherein the operation of the unit to obtain the next input data and the operation of the constant value supply unit to obtain the next constant value are performed in parallel within one clock cycle.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003031043A JP2004240298A (en) | 2003-02-07 | 2003-02-07 | Hash function processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003031043A JP2004240298A (en) | 2003-02-07 | 2003-02-07 | Hash function processor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004240298A true JP2004240298A (en) | 2004-08-26 |
Family
ID=32957757
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003031043A Pending JP2004240298A (en) | 2003-02-07 | 2003-02-07 | Hash function processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004240298A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007166279A (en) * | 2005-12-14 | 2007-06-28 | Nippon Telegr & Teleph Corp <Ntt> | IPsec CIRCUIT AND IPsec PROCESSING METHOD |
US7962753B2 (en) | 2006-11-08 | 2011-06-14 | Oki Semiconductor Co., Ltd. | Method and a circuit for SHA operation with power saved |
-
2003
- 2003-02-07 JP JP2003031043A patent/JP2004240298A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007166279A (en) * | 2005-12-14 | 2007-06-28 | Nippon Telegr & Teleph Corp <Ntt> | IPsec CIRCUIT AND IPsec PROCESSING METHOD |
JP4647479B2 (en) * | 2005-12-14 | 2011-03-09 | 日本電信電話株式会社 | IPsec circuit and IPsec processing method |
US7962753B2 (en) | 2006-11-08 | 2011-06-14 | Oki Semiconductor Co., Ltd. | Method and a circuit for SHA operation with power saved |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102096609B (en) | Instruction-set architecture for programmable cyclic redundancy check (CRC) computations | |
Abdulrahman et al. | Faster kyber and dilithium on the cortex-m4 | |
KR100377172B1 (en) | Key Scheduller of encryption device using data encryption standard algorithm | |
US11716076B2 (en) | Circuits and methods for performing hash algorithm | |
CN114615069A (en) | Quartet lightweight encryption algorithm implementation device and method | |
JP3940714B2 (en) | Arithmetic device and encryption / decryption arithmetic device | |
JP2502836B2 (en) | Preprocessing device for division circuit | |
JP2004240298A (en) | Hash function processor | |
JP4567753B2 (en) | Parity generation circuit, counting circuit, and counting method | |
JP2004240299A (en) | Hash function processor | |
CN113741972B (en) | SM3 algorithm parallel processing method and electronic equipment | |
JP3709760B2 (en) | Hash device | |
JP2002358010A (en) | Exponentiation remainder computing element | |
CN112988235B (en) | Hardware implementation circuit and method of high-efficiency third-generation secure hash algorithm | |
JPH11224183A (en) | Pseudo-random number generating device | |
JP4057876B2 (en) | Control method of Galois field multiplier | |
US6941448B2 (en) | Data-driven processor having multiple-precision data processing function and data processing method thereof | |
CN113971015B (en) | UIA2 computing circuit, data processing method, chip, electronic device and storage medium | |
Ali | Efficient implementation of linearisation attacks on F-FCSR-16 type key-stream generators | |
KR100377173B1 (en) | Encryption device using data encryption standard algorithm | |
KR100761132B1 (en) | Apparatus and method for computing SHA-1 | |
CN113723035A (en) | Modulo operation method with variable bit width and modulo operation circuit | |
Gazzoni Filho et al. | Efficient isochronous fixed-weight sampling with applications to NTRU | |
CN112861154A (en) | SHA algorithm execution method, storage medium and electronic device for data flow architecture | |
WO2013051139A1 (en) | Multiplication method for finite fields, calculator, and program |