JP2001109375A - Pseudo random number generator - Google Patents
Pseudo random number generatorInfo
- Publication number
- JP2001109375A JP2001109375A JP28507499A JP28507499A JP2001109375A JP 2001109375 A JP2001109375 A JP 2001109375A JP 28507499 A JP28507499 A JP 28507499A JP 28507499 A JP28507499 A JP 28507499A JP 2001109375 A JP2001109375 A JP 2001109375A
- Authority
- JP
- Japan
- Prior art keywords
- value
- output
- random number
- carry
- control signal
- 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
- 238000004364 calculation method Methods 0.000 claims description 21
- 230000003247 decreasing effect Effects 0.000 abstract 1
- 238000007792 addition Methods 0.000 description 23
- 238000000034 method Methods 0.000 description 20
- 238000010586 diagram Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 3
- 230000033772 system development Effects 0.000 description 2
- 241001279686 Allium moly Species 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Abstract
Description
【0001】[0001]
【発明の属する技術分野】本発明は、素数である確立の
高い疑似乱数を生成するための装置に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an apparatus for generating a pseudo-random number having a high probability, which is a prime number.
【0002】[0002]
【従来の技術】一般に、素数を生成する際には、素数を
生成するための公式が存在しない関係上、整数を無作為
に生成して、これら整数が素数であるか否かを判定し、
このような動作を素数が得られるまで繰り返す必要があ
る。ただし、整数が素数か否かを判定する際には、大き
な計算量が必要となる結果、実際には、単純に、整数を
無作為に生成するのではなく、「素数である確率の高い
整数」を生成して、このようにして生成された整数に対
して素数の判定であるか否かを判定している。2. Description of the Related Art In general, when generating prime numbers, since there is no formula for generating prime numbers, integers are randomly generated, and it is determined whether or not these integers are prime numbers.
It is necessary to repeat such an operation until a prime number is obtained. However, when determining whether or not an integer is a prime number, a large amount of computation is required.In practice, instead of simply generating an integer at random, an “integer with a high probability of being a prime number” is used. Is generated, and it is determined whether or not the generated integer is a prime number determination.
【0003】ここで、図6を参照して、「素数である確
率の高い整数」を生成する手法について概説する。ま
ず、整数Xを無作為に生成する(手順610)。つま
り、乱数を生成する。そして、整数Xが偶数であれば明
らかに素数でないので、整数Xの最下位ビットを1にす
る(手順620)。Here, a method of generating “an integer having a high probability of being a prime number” will be outlined with reference to FIG. First, an integer X is randomly generated (procedure 610). That is, a random number is generated. If the integer X is even, it is obviously not a prime number, so the least significant bit of the integer X is set to 1 (procedure 620).
【0004】次に、j=1として(手順630)、Xが
Pjで割り切れるかどうかを検査する(手順640)。
そして、手順640において、割り切れると、手順61
0に戻る。手順640において、割り切れないと、j=
m(mは正の整数)であるか否かを検査する(手順65
0)。j=mであると、処理を終了してXを擬似乱数と
して出力する。一方、j=mでないと、j=j+1(手
順660)として、手順640に戻る。なお、ここで、
P1,P2,…,Pmは互いに異なる小さな素数であ
る。[0004] Next, as j = 1 (Step 630), X is examined whether divisible by P j (Step 640).
Then, in step 640, if divisible, in step 61
Return to 0. In step 640, if not divisible, j =
m (m is a positive integer) (step 65)
0). If j = m, the process ends and X is output as a pseudo-random number. On the other hand, if j = m is not satisfied, j = j + 1 (procedure 660) and the procedure returns to procedure 640. Here,
P 1, P 2, ..., P m are different small primes from each other.
【0005】図6に示す手法を用いて、擬似乱数Xを生
成すれば、Xが、P1,P2,…,Pmを素因数にもつ
ことがなく、単純に無作為に生成された整数よりも素数
である確率が高くなる。[0005] If the pseudo-random number X is generated using the method shown in FIG. 6, X does not have P 1 , P 2 ,..., P m as prime factors, and is simply an integer generated at random. The probability of being a prime number is higher.
【0006】[0006]
【発明が解決しようとする課題】素数定理からすると、
無作為に生成されたnビット(nは正の整数)の整数が
素数である確率は、1/n程度であることが知られてい
る。従って、図6で説明した手法では、1つのnビット
素数が得られるまでに約n個の整数を無作為に生成する
必要がある。According to the prime number theorem,
It is known that the probability that an n-bit (n is a positive integer) randomly generated integer is a prime number is about 1 / n. Therefore, in the method described with reference to FIG. 6, it is necessary to randomly generate about n integers until one n-bit prime is obtained.
【0007】このため、数百ビットから数千ビットもの
素数が秘密鍵として使われる公開鍵暗号においては、1
つの素数が得られるまでに数百から数千個もの整数が無
駄に生成され、大量の計算を行わなければならないとい
う問題点がある。For this reason, in public key cryptography in which a prime number of hundreds to thousands of bits is used as a secret key, 1
There is a problem that hundreds to thousands of integers are generated uselessly until one prime number is obtained, and a large amount of calculations must be performed.
【0008】ところで、素数生成の際、計算量を削減す
る手法として、中国人の剰余定理を用いた手法が知られ
ている。この手法について概説すると、与えられた任意
の非負整数Aに対して、αj={A mod(Pj−1)}
+1とすると、常にαj≠0(modPj)であるか
ら、P1,P2,…,Pmが素数であれば、連立1次合
同式X=αj(mod Pj),X=α2(mod P2),
…,X=αm(mod Pm)の解が存在する。その解をX
とすると(同じXで表現しているので注意)、Xは
P1,P2,…,Pmのいずれでも割り切れない。As a technique for reducing the amount of calculation when generating prime numbers, a technique using the Chinese remainder theorem is known. Briefly describing this method, for any given non-negative integer A, α j = {A mod (P j −1)}
When you +1, because it is always α j ≠ 0 (modP j) , P 1, P 2, ..., if the P m is a prime number, simultaneous linear congruence X = α j (mod P j ), X = α 2 (mod P 2 ),
, X = α m (mod P m ) exists. The solution is X
(Note that it is represented by the same X), X is not divisible by any of P 1 , P 2 ,..., P m .
【0009】P1,P2,…,Pmを、2以上の素数を
小さいものから順に並べた系列とすれば、Xがm個の小
さな素数P1,P2,…,Pmを素因数にもたないとい
うことになるから、Xが素数である確率は、無作為に与
えられた整数が素数である確率よりも高くなる。[0009] P 1, P 2, ..., a P m, if from the smaller of two or more of prime numbers and the side-by-side series in the order, a small prime number P 1 of X are m, P 2, ..., prime the P m Therefore, the probability that X is a prime number is higher than the probability that a randomly given integer is a prime number.
【0010】なお、前述の連立1次合同式の解Xは、X
=α1(P1P2…Pm/P1)β 1+α2(P1P2
…Pm/P2)β2+…+αm(P1P2…Pm/
Pm)β m(mod P1P2…Pm)によって簡単に求め
られることが知られている。ここでβj(j=1,2,
…,m)は、合同式(P1P2…Pm/Pj)βj=1
(mod Pj)を満たすような整数である。このため、乱
数Aをそのまま出力するのではなく、上述のような操作
によってAから得られるXを乱数として出力してやれ
ば、素数である確率の高い乱数が得られることになる。Note that the solution X of the above-mentioned simultaneous linear congruential equation is X
= Α1(P1P2… Pm/ P1) Β 1+ Α2(P1P2
… Pm/ P2) Β2+ ... + αm(P1P2… Pm/
Pm) Β m(Mod P1P2… PmEasily asked by
Is known to be. Where βj(J = 1, 2,
…, M) is the congruential formula (P1P2… Pm/ Pj) Βj= 1
(Mod Pj). Because of this,
Instead of outputting the number A as it is, the operation described above
Output X obtained from A as a random number
For example, a random number having a high probability of being a prime number can be obtained.
【0011】しかしながら、中国人の剰余定理に基づく
乱数生成手法では、乗除算を必要とするので、高速に処
理できないという問題点がある。もちろん、演算テーブ
ルを用いて乗除算を加減算に置き換えると高速に処理で
きるが、そのためには、演算テーブルを記憶するための
大容量のメモリが必要となってしまう。However, the random number generation method based on the Chinese remainder theorem has a problem that high-speed processing cannot be performed because multiplication and division are required. Of course, if multiplication / division is replaced with addition / subtraction using an operation table, high-speed processing can be performed. However, a large-capacity memory for storing the operation table is required.
【0012】なお、従来の素数生成手法及び公開鍵暗号
については、例えば、シュナイア著「アプライド・クリ
プトグラフィー(第2版)」(Bruce Schneier, Applied
Cryptography: Protocols, Algorithms, and Source C
ode in C, Second Edition,JohnWiley & Sons, Inc. 19
96)等に詳しい解説がある。また、中国人の剰余定理を
用いた乱数の生成手法については、特願平9−2903
50号明細書に詳しい解説がある。従って、ここでは、
詳しい説明を省略する。The conventional prime number generation method and public key cryptography are described in, for example, “Applied Cryptography (2nd Edition)” by Schneier (Bruce Schneier, Applied
Cryptography: Protocols, Algorithms, and Source C
ode in C, Second Edition, John Wiley & Sons, Inc. 19
96) has a detailed explanation. For a method of generating random numbers using the Chinese remainder theorem, see Japanese Patent Application No. 9-2903.
No. 50 has a detailed explanation. Therefore, here
Detailed description is omitted.
【0013】本発明の目的は、計算量が少なく高速に疑
似乱数を生成することのできる方法及び装置を提供する
ことにある。An object of the present invention is to provide a method and an apparatus which can generate a pseudo random number at a high speed with a small amount of calculation.
【0014】本発明の他の目的は、メモリ容量が小さく
て高速に疑似乱数を生成することのできる装置を提供す
ることにある。Another object of the present invention is to provide an apparatus which has a small memory capacity and can generate pseudo random numbers at high speed.
【0015】[0015]
【課題を解決するための手段】本発明によれば、複数の
乱数から素数である確率の高い乱数を疑似乱数として生
成する際用いられる装置であって、制御信号が論理反転
された反転信号とクロック信号との論理和によって得ら
れたクロックパルスが与えられ前記制御信号が“1”で
ある際前記クロック信号が入力される度に第1乃至第m
(mは2以上の整数)の乱数を発生する乱数生成装置
と、前記第1乃至前記第mの乱数のそれぞれに“1”を
加算して第1乃至第mの加算結果を得る第1の加算手段
と、前記第1乃至第mの加算結果にそれぞれ第1乃至第
mの予め定められた乗算数を乗算して第1乃至第mの乗
算結果を生成する乗算手段と、前記第1乃至前記第mの
乗算結果を加算して加算結果を得て該加算結果を前記初
期値として出力する第2の加算手段と、前記制御信号が
“1”である際前記クロック信号が入力されると前記第
1乃至前記第mの乱数をそれぞれ第1乃至第mの初期状
態値として設定して前記制御信号が“0”である際桁上
がりが“1”であると前記クロック信号が入力される度
にカウント値を“1”増加して前記カウント値が予め定
められたカウント値であると桁上がり出力として“1”
を出力し前記カウント値が前記予め定められたカウント
値以外であると桁上がり出力として“0”を出力する第
1乃至第mのカウンタと、前記第1のカウンタの桁上が
り入力に“1”を与え前記第2乃至前記第mのカウンタ
の桁上がり入力に前記第1乃至前記第(m−1)のカウ
ンタの桁上がり出力を与える供給手段と、第1乃至第m
の選択値及び該第1乃至該第mの選択値をそれぞれ2倍
した第1乃至第mの倍数が与えられ第j(jは1〜mの
いずれかの数)のカウンタの桁上がり入力が“0”であ
ると“0”を選択して選択値として出力し前記第jのカ
ウンタの桁上がり入力が“1”でかつその桁上がり出力
が“0”であると第jの選択値を前記選択値として出力
し前記第jのカウンタの桁上がり入力が“1”でかつそ
の桁上がり出力が“1”であると第jの倍数を前記選択
値として出力する第2のセレクタ手段と、記憶値と前記
選択値とを加算して合計値を出力する第3の加算手段
と、前記制御信号が“1”である際前記クロック信号が
与えられると前記初期値を前記記憶値として記憶し前記
制御信号が“0”であると前記クロック信号が与えられ
る度に前記合計値を前記記憶値として記憶するするとと
もに前記クロック信号が与えられる都度前記記憶値を前
記疑似乱数として出力するレジスタ手段とを有すること
を特徴とする疑似乱数生成装置が得られる。According to the present invention, there is provided an apparatus used for generating a random number having a high probability of being a prime number from a plurality of random numbers as a pseudo-random number, comprising: an inverted signal obtained by logically inverting a control signal; When a clock pulse obtained by a logical sum with a clock signal is applied and the control signal is "1", each time the clock signal is input, the first to mth clock signals are input.
(M is an integer of 2 or more) random number generation device, and a first to obtain a first to m-th addition result by adding "1" to each of the first to m-th random numbers An adder for multiplying the first to m-th addition results by first to m-th predetermined multiplication numbers to generate first to m-th multiplication results, respectively; Second adding means for adding the m-th multiplication result to obtain the addition result and outputting the addition result as the initial value; and when the clock signal is input when the control signal is "1". The first to m-th random numbers are set as first to m-th initial state values, respectively, and when the control signal is "0" and the carry is "1", the clock signal is input. Every time the count value is increased by "1" and the count value is set to a predetermined count value. There and as a carry output "1"
And the first through m-th counters outputting "0" as a carry output when the count value is other than the predetermined count value, and "1" as a carry input of the first counter. Supply means for giving the carry output of the first through (m-1) th counters to the carry input of the second through mth counters;
And the first through m-th multiples of the first through m-th selection values, respectively, are given, and the carry input of the j-th (j is any number from 1 to m) counter is input. If it is "0", it selects "0" and outputs it as a selected value. If the carry input of the j-th counter is "1" and its carry output is "0", the j-th selected value is Second selector means for outputting as the selected value and outputting a j-th multiple as the selected value when the carry input of the j-th counter is "1" and the carry output is "1"; Third addition means for adding a storage value and the selected value to output a total value, and storing the initial value as the storage value when the clock signal is supplied when the control signal is "1". When the control signal is "0", the total value is calculated each time the clock signal is supplied. Pseudorandom number generator, wherein the stored value every time the clock signal is supplied as well as stores the serial memory value having a register means for outputting as said pseudo-random number is obtained.
【0016】さらに、本発明によれば、複数の乱数から
素数である確率の高い乱数を疑似乱数として生成する際
用いられる装置であって、制御信号が論理反転された反
転信号とクロック信号との論理和によって得られたクロ
ックパルスが与えられ前記制御信号が“1”である際前
記クロック信号が入力される度に第1乃至第m(mは2
以上の整数)の乱数を発生する乱数生成装置と、前記第
1乃至前記第mの乱数のそれぞれに“1”を加算して第
1乃至第mの加算結果を得る第1の加算手段と、前記第
1乃至第mの加算結果にそれぞれ第1乃至第mの予め定
められた乗算数を乗算して第1乃至第mの乗算結果を生
成する乗算手段と、前記第1乃至前記第mの乗算結果を
加算して加算結果を出力する第2の加算手段と、該加算
結果からそれぞれ第1乃至第mの減算数を減算して第1
乃至第mの減算結果を得る第1の減算手段と、前記加算
結果と前記第1乃至前記第mの減算数とをそれぞれ比較
して比較結果を出力する第1の比較手段と、該比較結果
に応じて前記加算結果及び前記第1及び前記第mの減算
結果を選択的に前記初期値として出力する第1のセレク
タ手段と、前記制御信号が“1”である際前記クロック
信号が入力されると前記第1乃至前記第mの乱数をそれ
ぞれ第1乃至第mの初期状態値として設定して前記制御
信号が“0”である際桁上がりが“1”であると前記ク
ロック信号が入力される度にカウント値を“1”増加し
て前記カウント値が予め定められたカウント値であると
桁上がり出力として“1”を出力し前記カウント値が前
記予め定められたカウント値以外であると桁上がり出力
として“0”を出力する第1乃至第mのカウンタと、前
記第1のカウンタの桁上がり入力に“1”を与え前記第
2乃至前記第mのカウンタの桁上がり入力に前記第1乃
至前記第(m−1)のカウンタの桁上がり出力を与える
供給手段と、第1乃至第mの選択値及び該第1乃至該第
mの選択値をそれぞれ2倍した第1乃至第mの倍数が与
えられ第j(jは1〜mのいずれかの数)のカウンタの
桁上がり入力が“0”であると“0”を選択して選択値
として出力し前記第jのカウンタの桁上がり入力が
“1”でかつその桁上がり出力が“0”であると第jの
選択値を前記選択値として出力し前記第jのカウンタの
桁上がり入力が“1”でかつその桁上がり出力が“1”
であると第jの倍数を前記選択値として出力する第2の
セレクタ手段と、記憶値と前記選択値とを加算して合計
値を出力する第3の加算手段と、前記合計値からそれぞ
れ前記第1乃至前記第mの減算数を減算して第1乃至第
mの減算計算結果を得る第2の減算手段と、前記合計値
と前記第1乃至前記第mの減算数とをそれぞれ比較して
比較計算結果を出力する第2の比較手段と、該比較計算
結果に応じて前記合計値及び前記第1及び前記第mの減
算計算結果を選択的にセレクト値として出力する第2の
セレクタ手段と、前記制御信号が“1”である際前記ク
ロック信号が与えられると前記初期値を前記記憶値とし
て記憶し前記制御信号が“0”であると前記クロック信
号が与えられる度に前記セレクト値を前記記憶値として
記憶するするとともに前記クロック信号が与えられる都
度前記記憶値を前記疑似乱数として出力するレジスタ手
段とを有することを特徴とする疑似乱数生成装置が得ら
れる。Further, according to the present invention, there is provided an apparatus used for generating a random number having a high probability of being a prime number from a plurality of random numbers as a pseudo-random number, wherein a control signal is logically inverted and an inverted signal and a clock signal are generated. When a clock pulse obtained by a logical sum is applied and the control signal is “1”, the first to m-th (m is 2) every time the clock signal is input.
A random number generation device that generates a random number of the above (integer), a first adding unit that adds “1” to each of the first to m-th random numbers to obtain first to m-th addition results, Multiplying means for multiplying the first to m-th addition results by first to m-th predetermined multiplication numbers to generate first to m-th multiplication results, respectively; A second adding means for adding the multiplication result and outputting the addition result, and subtracting a first to m-th subtraction number from the addition result to obtain a first
First subtraction means for obtaining a subtraction result from the first to the m-th subtraction number; first comparison means for comparing the addition result with the first to the m-th subtraction number to output a comparison result; First selector means for selectively outputting the addition result and the first and m-th subtraction results as the initial value in response to the control signal, and the clock signal is input when the control signal is "1". Then, the first to m-th random numbers are set as first to m-th initial state values, respectively, and when the control signal is "0" and the carry is "1", the clock signal is input. Each time the count value is incremented by "1", if the count value is a predetermined count value, "1" is output as a carry output, and the count value is other than the predetermined count value. Output "0" as carry output The first to m-th counters, and giving "1" to the carry input of the first counter to the first to (m-1) th carry to the carry input of the second to m-th counters. And a supply means for providing a carry output of the counter, and the first to m-th selected values and the first to m-th multiples of twice the first to m-th selected values, respectively, and j-th (j If the carry input of the counter of any of 1 to m) is "0", "0" is selected and output as a selected value, and the carry input of the j-th counter is "1" and If the carry output is "0", the j-th selected value is output as the selected value, and the carry input of the j-th counter is "1" and the carry output is "1".
, A second selector for outputting a j-th multiple as the selected value, a third adding unit for adding a stored value and the selected value to output a total value, and Second subtraction means for subtracting the first to m-th subtraction numbers to obtain first to m-th subtraction calculation results, and comparing the total value with the first to m-th subtraction numbers, respectively. Second comparison means for outputting a comparison calculation result according to the comparison result, and second selector means for selectively outputting the sum value and the first and m-th subtraction calculation results as select values according to the comparison calculation result. When the control signal is "1", the initial value is stored as the storage value when the clock signal is supplied, and when the control signal is "0", the select value is stored each time the clock signal is supplied. Is stored as the storage value The pseudorandom number generator is obtained, characterized in that the stored value each time the clock signal is applied and a register means for outputting as said pseudo-random numbers.
【0017】[0017]
【発明の実施の形態】以下本発明について、図面を参照
して説明する。DESCRIPTION OF THE PREFERRED EMBODIMENTS The present invention will be described below with reference to the drawings.
【0018】図1を参照して、図示の疑似乱数生成装置
は、乱数生成装置110、初期値生成装置120、及び
素数候補生成装置130を備えている。入力端子162
から供給される制御信号SETは、否定回路150によ
って論理反転され、反転制御信号とされる。論理和回路
140は、入力端子161から供給されるクロック信号
CLKと反転制御信号との論理和を求め論理和信号を乱
数生成装置110のクロック入力端子に供給する。Referring to FIG. 1, the pseudo random number generation device shown includes a random number generation device 110, an initial value generation device 120, and a prime candidate generation device 130. Input terminal 162
Is inverted by the NOT circuit 150 to form an inverted control signal. The OR circuit 140 calculates the OR of the clock signal CLK supplied from the input terminal 161 and the inversion control signal, and supplies the OR signal to the clock input terminal of the random number generation device 110.
【0019】クロック入力端子にクロックパルス(論理
和信号)が供給される度に、乱数生成装置110は、新
しい乱数(AIm,…,AI2,AI1)を生成する。
ここで、AIjは、0≦AIj<Pj−1を満足する整
数である。なお、P1,P2,…,Pmは、予め定めら
れた2以上の素数であり、相異なるものとする。Each time a clock pulse (OR signal) is supplied to the clock input terminal, the random number generator 110 generates a new random number (AI m ,..., AI 2 , AI 1 ).
Here, AI j is an integer satisfying 0 ≦ AI j <P j −1. Note that P 1 , P 2 ,..., P m are predetermined prime numbers of 2 or more, and are different from each other.
【0020】乱数生成装置110は、入力端子162か
ら供給される制御信号SETが“1”の時、入力端子1
61からクロックパルスが供給される度に、新しい乱数
(AIm,…,AI2,AI1)を生成する。When the control signal SET supplied from the input terminal 162 is “1”, the random number generation device 110
Each time a clock pulse is supplied from 61, a new random number (AI m ,..., AI 2 , AI 1 ) is generated.
【0021】初期値生成装置120は、乱数生成装置1
10からの乱数系列(AIm,…,AI2,AI1)か
ら、後述する素数候補生成装置130の初期値として用
いられる値XIを生成して、初期値データを出力する。The initial value generation device 120 includes the random number generation device 1
From the random number sequence (AI m ,..., AI 2 , AI 1 ) from 10, a value XI used as an initial value of the prime candidate generation device 130 described later is generated, and the initial value data is output.
【0022】素数候補生成装置130は、入力端子14
2から供給される制御信号SETが“1”の時、入力端
子161からクロックパルスが供給されると、乱数生成
装置110の出力した乱数系列(AIm,…,AI2,
AI1)及び初期値生成装置120の出力した初期値X
Iを、初期状態として設定する。また、素数候補生成装
置130は、入力端子162から供給される制御信号S
ETが0の時には、入力端子161からクロックパルス
が供給される度に、出力端子161を介して新しい乱数
(整数)を出力する。The prime candidate generating device 130 is connected to the input terminal 14
When the clock signal is supplied from the input terminal 161 when the control signal SET supplied from the second random number 2 is “1”, the random number sequence (AI m ,..., AI 2 ,.
AI 1 ) and the initial value X output from the initial value generation device 120
I is set as an initial state. Further, the prime candidate generation device 130 outputs the control signal S supplied from the input terminal 162.
When ET is 0, a new random number (integer) is output via the output terminal 161 each time a clock pulse is supplied from the input terminal 161.
【0023】ここで、図2を参照して、初期値生成装置
の構成について説明する。乱数生成装置110(図1参
照)の出力した乱数AIjが、それぞれ入力端子211
j(j=1〜m)から入力され、それぞれ加算器201
jに供給される。加算器201jは、入力端子211j
から供給された整数に“1”を加算して、得られた加算
結果を出力する。乗算器202jは、加算器201jの
出力にδjを乗算し、乗算結果を出力する。ここで、δ
jは、δj=P1P2…Pm/Pjと定義される予め定
められた整数である。Here, the configuration of the initial value generating device will be described with reference to FIG. The random numbers AI j output from the random number generation device 110 (see FIG. 1) are
j (j = 1 to m), and each of the adders 201
j . The adder 201 j has an input terminal 211 j
"1" is added to the integer supplied from, and the obtained addition result is output. The multiplier 202 j multiplies the output of the adder 201 j by δ j and outputs a multiplication result. Where δ
j is a predetermined integer defined as δ j = P 1 P 2 ... P m / P j .
【0024】加算器203は、乗算器2021〜202
mの出力を加算して、加算結果を出力端子212から出
力する。The adder 203 includes multipliers 202 1 to 202
The outputs of m are added, and the addition result is output from the output terminal 212.
【0025】次に、図3を参照して、素数候補生成装置
の構成について説明する。Pj−1進カウンタ301j
は、入力端子312から供給される制御信号SETが
“1”の時、入力端子315からクロックパルスが供給
されると、入力端子311jから供給される値(図1に
示す乱数生成装置110の出力した乱数AIj)を初期
値として設定する。Next, the configuration of the prime candidate generation device will be described with reference to FIG. P j −1 base counter 301 j
When the control signal SET "1" supplied from the input terminal 312, from the input terminal 315 when the clock pulse is supplied, the value supplied from the input terminal 311 j (random number generator 110 shown in FIG. 1 The output random number AI j ) is set as an initial value.
【0026】また、Pj−1進カウンタ301jは、入
力端子312から供給される制御信号SETが“0”の
時で、かつ、桁上がり入力が“1”の場合には、入力端
子315からクロックパルスが供給される度に、カウン
タ値を“1”だけ増加する(ただし、カウンタ値がPj
−1に等しい場合には、カウンタ値を“0”に戻す)。When the control signal SET supplied from the input terminal 312 is “0” and the carry input is “1”, the P j −1-ary counter 301 j outputs the input terminal 315 Increments the counter value by “1” every time a clock pulse is supplied from the counter (where the counter value is P j
If it is equal to -1, the counter value is returned to "0").
【0027】カウンタ値がPj−1に等しい場合には、
Pj−1進カウンタ301jは、桁上がり出力として
“1”を出力し、それ以外の場合には、桁上がり出力と
して“0”を出力する。そして、P1−1進カウンタ3
011の桁上がり入力には、“1”が供給され、Pj−
1進カウンタ301jの桁上がり入力には、Pj−1−
1進カウンタ301j−1の桁上がり出力が供給される
(ここでは、j=2,3,…,m)。If the counter value is equal to P j -1 then:
The P j −1 base counter 301 j outputs “1” as a carry output, and otherwise outputs “0” as a carry output. And P 1 -ary counter 3
“1” is supplied to the carry input of 01 1 and P j −
The carry input of the binary counter 301 j includes P j−1 −
The carry output of the primary counter 301 j-1 is supplied (here, j = 2, 3,..., M).
【0028】セレクタ302jには、カウンタ301j
の桁上がり入力と桁上がり出力が、制御信号として供給
されており、カウンタ301jの桁上がり入力が“0”
であれば、“0”を選択して出力する。また、カウンタ
301jの桁上がり入力が“1”でカウンタ301jの
桁上がり出力が“0”であれば、δjを選択して出力す
る。そして、カウンタ301jの桁上がり入力が“1”
でカウンタ301jの桁上がり出力が“1”であれば、
2δjを選択して出力する。The selector 302 j has a counter 301 j
Carry inputs and carry outputs are, are supplied as a control signal, carry input of counter 301 j is "0"
If so, "0" is selected and output. Also, carry output of the counter 301 j with carry input of counter 301 j is "1" if "0", and selects and outputs the [delta] j. Then, carry input of the counter 301 j is "1"
If the carry output of the counter 301 j is “1”,
And selects and outputs the 2δ j.
【0029】加算器303は、後述するレジスタ304
に記憶された値に、セレクタ302 1〜302mの出力
を加算して、加算結果を出力する。レジスタ304は、
入力端子312から供給される制御信号SETが“1”
の時に、入力端子315からクロックパルスが供給され
ると、入力端子313から供給される値(図2に示す初
期値生成装置120が出力端子212から出力するX
I)を記憶する。The adder 303 has a register 304 to be described later.
Is stored in the selector 302 1~ 302mOutput
And outputs the addition result. Register 304 is
The control signal SET supplied from the input terminal 312 is “1”
, A clock pulse is supplied from the input terminal 315
Then, the value supplied from the input terminal 313 (the initial value shown in FIG.
X output from the output terminal 212 by the period value generation device 120
I) is stored.
【0030】さらに、レジスタ304は、入力端子31
2から供給される制御信号SETが“0”の時には、入
力端子315からクロックパルスが供給される度に、加
算器303の出力を記憶する。レジスタ304に記憶さ
れた値は、加算器303に供給されるとともに乱数(整
数)として出力端子314から出力される。Further, the register 304 is connected to the input terminal 31.
When the control signal SET supplied from 2 is “0”, each time a clock pulse is supplied from the input terminal 315, the output of the adder 303 is stored. The value stored in the register 304 is supplied to the adder 303 and output from the output terminal 314 as a random number (integer).
【0031】ここで、図1乃至図3を参照して、本発明
による疑似乱数生成装置の動作について説明する。Here, the operation of the pseudorandom number generator according to the present invention will be described with reference to FIGS.
【0032】中国人の剰余定理により、P1,P2,
…,Pmが素数であれば、0<αj<Pjであるような
αjに対して、Xに関する連立1次合同式X=α1(mo
d P1),X=α2(mod P2),…,X=αm(mod
Pm)の解が存在し、その解Xは(同じXで表現してい
るので注意)、X=α1(P1P2…Pm/P1)β1
+α2(P1P2…Pm/P2)β2+…+αm(P1
P2…Pm/Pm)βm+γP1P2…Pmによって与
えられる。ここでβj(j=1,2,…,m)は、合同
式(P1P2…Pm/Pj)βj=1(mod Pj)を満
たす整数であり、γは任意の整数である。According to the Chinese remainder theorem, P 1 , P 2 ,
.., Pm is a prime number, for α j such that 0 <α j <P j , the simultaneous linear congruential equation X about X = α 1 (mo
d P 1 ), X = α 2 (mod P 2 ),..., X = α m (mod
There is a solution of P m ), and the solution X is (note that it is represented by the same X), and X = α 1 (P 1 P 2 ... P m / P 1 ) β 1
+ Α 2 (P 1 P 2 ... P m / P 2 ) β 2 +... + Α m (P 1
It is given by P 2 ... P m / P m ) β m + γP 1 P 2 ... P m. Here, β j (j = 1, 2,..., M) is an integer satisfying the congruence formula (P 1 P 2 ... P m / P j ) β j = 1 (mod P j ), and γ is an arbitrary It is an integer.
【0033】このようにして生成されたXは、P1,P
2,…,Pmのいずれでも割り切れないので、ランダム
に生成された整数よりも、素数である確率が高い。この
原理は、前述した特願平9−290350号明細書にお
いて、素数候補を生成する際に用いられた原理である。X generated in this manner is represented by P 1 , P
2, ..., since not divisible either P m, than an integer randomly generated, there is a high probability a prime number. This principle is the principle used when generating a prime number candidate in the specification of Japanese Patent Application No. 9-290350.
【0034】図示の疑似乱数生成装置では、この原理に
加えて、さらに、以下の3つの原理に用いてより効率的
に素数候補を生成する。The pseudo-random number generator shown in the figure generates a prime candidate more efficiently by using the following three principles in addition to this principle.
【0035】まず、第1の原理では、差分によって計算
効率が改善する。つまり、(α1,α2,…,αm)に
対応して、Xに関する連立1次合同式X=α1(mod P
1),X=α2(mod P2),…,X=αm(mod
Pm)の解がX0であり、一方、(α1,α2,…,α
j+1,…,αm)に対して、Xに関する連立1次合同
式X=α1(mod P1),X=α2(mod P2),…,
X=αj+1(mod Pj),…,X=αm(mod Pm)
の解がXjであれば、中国人の剰余定理を用いて、直接
(α1,α2,…,αj+1,…,αm)からXjを求
めなくとも、Xj=X0+δj(ここで、δj=(P1
P2…Pm/Pj)βjで定義される定数)という操作
によって、即ち、1回の加算によって、Xjを求めるこ
とができる。First, according to the first principle, the calculation efficiency is improved by the difference. That is, corresponding to (α 1 , α 2 ,..., Α m ), the simultaneous linear congruential equation X about X = α 1 (mod P
1 ), X = α 2 (mod P 2 ),..., X = α m (mod
P m ) is X 0 , while (α 1 , α 2 ,..., Α
j + 1 ,..., α m ), a simultaneous linear congruential equation for X, X = α 1 (mod P 1 ), X = α 2 (mod P 2 ),.
X = α j + 1 (mod P j ),..., X = α m (mod P m )
If the solution is X j, using the Chinese remainder theorem, direct (α 1, α 2, ... , α j + 1, ..., α m) from without seeking X j, X j = X 0 + δ j (where δ j = (P 1
X j can be obtained by the operation of P 2 ... P m / P j ) (a constant defined by β j ), that is, by one addition.
【0036】なお、前述の特願平9−290350号明
細書に記載された素数候補の生成方法では、乗除算が必
要であり、乗除算を無くして加減算だけで素数候補を生
成するためには、演算テーブルを用いて乗除算を加減算
に置き換えることが必要である。In the method of generating prime candidates described in the specification of Japanese Patent Application No. 9-290350, multiplication and division are required. In order to eliminate the multiplication and division and generate prime candidates only by addition and subtraction, , It is necessary to replace multiplication and division with addition and subtraction using an operation table.
【0037】第2の原理では、(α1,α2,…,
αm)の表現方法および差分の変化方法を工夫して、同
一の素数候補を重複して出現させることなく連続して素
数候補が生成できる。つまり、αj=Aj+1とする
と、Ajは0≦Aj<Pj−1であるが、(Am,…,
A2,A1)をj桁目がPj−1進数として表現された
数と見なし、さらに、Ajをその数の下からj桁目と見
なして、数(Am,…,A2,A1)を1ずつ増加して
いくと(ただし、オーバーフローが生じたら0に戻すも
のとする)、同一の数(Am,…,A2,A1)、即
ち、同一の(α1,α2,…,αm)の組が出現するこ
とはない。もちろん、数(Am,…,A2,A1)をP
1P2…Pm以上増加させると、同一の数(Am,…,
A2,A1)が出現するが、通常は、P1P2…Pmは
非常に大きな値(数百から数千ビットの数)に選ばれる
ので、事実上、同一の数(Am,…,A2,A1)が出
現することはない。そして、P1,P2,…,Pmのい
ずれでも割り切れないような値をXの初期値として、A
jがPj−2より小さい時に、Ajに1が加算された場
合には、Xにδjを加算する。一方、AjがPj−2に
等しい時に、Ajに1が加算されてAjが“0”に戻っ
た場合には、Xに2δjを加算する(Ajは、Pj−1
の剰余系として見た場合には、値が“1”しか変化して
いないが、対応するα jの値は、値が“2”だけ変化し
ているので、2δjを加算しなければならない)。According to the second principle, (α1, Α2,…,
αm) And how to change the difference
Consecutive primes without the appearance of one prime candidate
Number candidates can be generated. That is, αj= Aj+1
And AjIs 0 ≦ Aj<Pj-1 but (Am,…,
A2, A1) Is the Pth digitjExpressed as a decimal number
As a number, and AjIs the jth digit from the bottom of the number
The number (Am, ..., A2, A1) By 1
Go to (However, if overflow occurs, return to 0
), The same number (Am, ..., A2, A1), Immediately
And the same (α1, Α2,…, Αm) Pairs appear
And not. Of course, the number (Am, ..., A2, A1) To P
1P2… PmWhen the number is increased, the same number (Am,…,
A2, A1) Appears, but usually P1P2… PmIs
Chosen for very large values (hundreds to thousands of bits)
So, in effect, the same number (Am, ..., A2, A1) Comes out
It will not manifest. And P1, P2, ..., PmNo
A value that is not divisible by the deviation is set as the initial value of X, and A
jIs PjWhen less than -2, AjWhen 1 is added to
If X is δjIs added. On the other hand, AjIs Pj-2
When equal, AjIs added to 1 and AjReturns to “0”
If X is 2δj(AjIs Pj-1
When viewed as a remainder system, the value changes only by "1".
Not, but the corresponding α jChanges the value by “2”
2δjMust be added).
【0038】このようにして、Xの値を更新してゆけ
ば、Xの値は、常に、P1,P2,…,Pmのいずれで
も割り切れない。また、同一のXの値が重複して出現す
ることも無い。なお、上述のようにすると、桁上がりが
生じる場合には、1度に複数回の(最大でm回の)加算
が行われるが、平均すれば、依然として、1回の操作に
つき加算が1回程度しか行われないので、このようにし
ても計算効率が犠牲になることは無い。[0038] In this way, if Yuke to update the value of X, the value of X is, always, P 1, P 2, ... , not divisible by any of the P m. Further, the same value of X does not appear repeatedly. In the above-described manner, when a carry occurs, a plurality of additions (at most m times) are performed at once, but on average, one addition is still performed for one operation. This is done only to the extent that this does not sacrifice computational efficiency.
【0039】第3の原理では、中国人の剰余定理に基づ
く素数候補生成方法において、βjが合同式(P1P2
…Pm/Pj)βj=1(mod Pj)を満たすような整
数でなくとも、βjがPjと互いに素な整数であれば、
素数候補が生成できる。つまり、合同式(P1P2…P
m/Pj)βj=1(mod Pj)を満たすような整数β
jの代わりに、β´jを用いると、X=α1(P1P2
…Pm/P1)β´1+α2(P1P2…Pm/P2)
β´2+…+αm(P1P2…Pm/Pm)β´m+γ
P1P2…Pmによって与えられるXの値は、Xに関す
る連立1次合同式X=α1(mod P1),X=α2(mo
d P2),…,X=αm(mod Pm)の解ではなくなる
が、β´jがPjと互いに素であれば、αjβ´j/β
j≠0(mod Pj)であるから、そのXの値は、Xに関
する連立1次合同式X=α1β´ 1/β1(mod
P1),X=α2β´2/β2(mod P2),…,X=
αmβ´ m/βm(mod Pm)の解であり、依然とし
て、P1,P2,…,Pmのいずれでも割り切れない。The third principle is based on the Chinese remainder theorem.
In the prime candidate generation method, βjIs a joint expression (P1P2
… Pm/ Pj) Βj= 1 (mod Pj)
Not a number, but βjIs PjIf the integer is relatively prime to
Prime number candidates can be generated. That is, the congruential expression (P1P2… P
m/ Pj) Βj= 1 (mod PjAn integer β that satisfies
jInstead of β 'jIs used, X = α1(P1P2
… Pm/ P1) Β '1+ Α2(P1P2… Pm/ P2)
β '2+ ... + αm(P1P2… Pm/ Pm) Β 'm+ Γ
P1P2… PmThe value of X given by
Simultaneous primary joint expression X = α1(Mod P1), X = α2(Mo
d P2), ..., X = αm(Mod PmIs not a solution of)
But β 'jIs PjIs relatively prime with αjβ 'j/ Β
j≠ 0 (mod Pj), The value of X is related to X
Simultaneous primary congruence formula X = α1β ' 1/ Β1(Mod
P1), X = α2β '2/ Β2(Mod P2), ..., X =
αmβ ' m/ Βm(Mod Pm) And still
And P1, P2, ..., PmIt is not divisible by either.
【0040】このため、βjを“1”に選ぶことによっ
て、僅かではあるが、定数δj=(P1P2…Pm/P
j)βjの桁数を短縮して、定数を記憶するのに必要な
メモリを節約することができる。For this reason, by selecting β j to be “1”, a slight but constant δ j = (P 1 P 2 ... P m / P
j ) The number of digits of β j can be shortened to save memory required for storing constants.
【0041】従って、疑似乱数生成装置では、まず、入
力端子162に供給される制御信号SETを“1”とし
て、入力端子161にクロックパルスを1個供給した
後、入力端子162に供給される制御信号SETを
“0”とする。その後、入力端子161にクロックパル
スを供給する度に、P1,P2,…、Pmのいずれでも
割り切れないXの値が出力端子163に得られる。な
お、注意しておくが、図1乃至図3においては、Ajの
初期値がAIjと表現され、Xの初期値がXIと表現さ
れており、また、Pj−1進カウンタ301jの内容が
Ajに対応している。Accordingly, in the pseudo random number generation device, first, the control signal SET supplied to the input terminal 162 is set to “1”, one clock pulse is supplied to the input terminal 161, and then the control signal supplied to the input terminal 162 is supplied. The signal SET is set to “0”. Thereafter, the degree to supply the clock pulses to the input terminal 161, P 1, P 2, ..., the value of X can not be divided either P m is obtained at the output terminal 163. Although It is noted that in FIG. 1 to FIG. 3, the initial value of Aj is expressed as AI j, the initial value of X are expressed as XI, also, the P j -1 binary counter 301 j The content corresponds to Aj .
【0042】次に、図4を参照して、初期値生成装置1
20の他の例について説明する。Next, with reference to FIG.
20 will be described.
【0043】図2に示す例では、加算器203の出力が
そのまま出力端子212に供給されていたのに対して、
図4に示す例では、加算器203の出力が減算器40
1、比較器402、及びセレクタ403に供給されてお
り、セレクタ403の出力が出力端子212に供給され
ている。In the example shown in FIG. 2, while the output of the adder 203 is supplied to the output terminal 212 as it is,
In the example shown in FIG. 4, the output of the adder 203 is the subtractor 40
1, the comparator 402, and the selector 403, and the output of the selector 403 is supplied to the output terminal 212.
【0044】減算器401は、加算器203の出力(Z
とする)から、それぞれ1P1P2…Pm,2P1P2
…Pm,…,mP1P2…Pmを減じて、得られた結果
Z−1P1P2…Pm,Z−2P1P2…Pm,…,Z
−mP1P2…Pmをそれぞれ出力する。The subtractor 401 outputs the output of the adder 203 (Z
), Respectively, 1P 1 P 2 ... P m , 2P 1 P 2
... P m, ..., by subtracting the mP 1 P 2 ... Pm, resulting Z-1P 1 P 2 ... P m, Z-2P 1 P 2 ... P m, ..., Z
-MP 1 P 2 ... the P m outputs respectively.
【0045】比較器402は、それぞれ加算器203の
出力Zと1P1P2…Pm,2P1P2…Pm,…,m
P1P2…Pmとの大小を比較して比較結果を出力す
る。セレクタ403は、比較器402の出力(比較結
果)がZ<P1P2…Pmであることを示していると、
加算器203の出力を選択して出力する。一方、比較器
402の出力がkP1P2…Pm≦Z<(k+1)P1
P2…Pmであることを示してると、減算器401の出
力Z−kP1P2…Pmを選択して出力する。The comparator 402 outputs Z and 1P 1 P 2 ... P m of the adders 203, 2P 1 P 2 ... P m, ..., m
P 1 P 2 ... by comparing the magnitude of the P m and outputs a comparison result. The selector 403, the output of comparator 402 (the comparison result) indicates that it is a Z <P 1 P 2 ... P m,
The output of the adder 203 is selected and output. On the other hand, the output of the comparator 402 is kP 1 P 2 ... P m ≦ Z <(k + 1) P 1
If it indicates that a P 2 ... P m, and selects and outputs the output Z-kP 1 P 2 ... P m of the subtracter 401.
【0046】かくして、セレクタ403の出力は常に、
P1P2…Pmよりも小さな値となる。なお、必要に応
じて、セレクタ403における選択規則を変更すること
によって、セレクタ403の出力の値域を変更すること
も可能である。Thus, the output of selector 403 is always
A smaller value than the P 1 P 2 ... P m. Note that the range of the output of the selector 403 can be changed by changing the selection rule in the selector 403 as necessary.
【0047】図5を参照して、素数候補生成装置130
の他の例について説明する。Referring to FIG. 5, prime candidate generating apparatus 130
Another example will be described.
【0048】図3に示す例では、加算器303の出力が
そのままレジスタ304に供給されているのに対して、
図4に示す例では、加算器303の出力が減算器50
1、比較器502、セレクタ503に供給されており、
セレクタ503の出力がレジスタ304に供給されてい
る。In the example shown in FIG. 3, while the output of the adder 303 is supplied to the register 304 as it is,
In the example shown in FIG. 4, the output of the adder 303 is
1, the comparator 502 and the selector 503,
The output of the selector 503 is supplied to the register 304.
【0049】減算器501は、それぞれ加算器303の
出力(Zとする)から、1P1P2…Pm,2P1P2
…Pm,…,mP1P2…Pmを減じて、得られた結果
Z−1P1P2…Pm,Z−2P1P2…Pm,…,Z
−mP1P2…Pmをそれぞれ出力する。The subtractor 501 calculates 1P 1 P 2 ... P m , 2P 1 P 2 from the output (Z) of the adder 303.
... P m, ..., by subtracting the mP 1 P 2 ... P m, resulting Z-1P 1 P 2 ... P m, Z-2P 1 P 2 ... P m, ..., Z
-MP 1 P 2 ... the P m outputs respectively.
【0050】比較器502は、それぞれ加算器303の
出力Zと1P1P2…Pm,2P1P2…Pm,…,m
P1P2…Pmの大小を比較して、比較結果を出力す
る。セレクタ503は、比較器502(比較結果)の出
力がZ<P1P2…Pmであることを示していると、加
算器303の出力を選択して出力する。一方、比較器5
02の出力がkP1P2…Pm≦Z<(k+1)P1P
2…Pmであることを示していると、減算器501の出
力Z−kP1P2…Pmを選択して出力する。The comparator 502 outputs Z and 1P 1 P 2 ... P m of the adders 303, 2P 1 P 2 ... P m, ..., m
Comparing the magnitude of the P 1 P 2 ... P m, and outputs a comparison result. The selector 503, the output of comparator 502 (the comparison result) of the show that is Z <P 1 P 2 ... P m, and selects the output of the adder 303. On the other hand, the comparator 5
02 is kP 1 P 2 ... P m ≦ Z <(k + 1) P 1 P
2 ... If it indicates that a P m, and selects and outputs the output Z-kP 1 P 2 ... P m of the subtracter 501.
【0051】かくして、セレクタ503の出力は常に、
P1P2…Pmよりも小さな値となる。なお、必要に応
じて、セレクタ503における選択規則を変更すること
によって、セレクタ503の出力の値域を変更すること
も可能である。Thus, the output of the selector 503 is always
A smaller value than the P 1 P 2 ... P m. Note that the range of the output of the selector 503 can be changed by changing the selection rule in the selector 503 as necessary.
【0052】以上の説明においては、加算器203及び
加算器303として、m入力の加算器を用いたが、m入
力の加算器に代えて2入力の加算器を用いて、時分割で
加算を行うようにしても良い。時分割で加算する場合に
は、定数δ1,δ2,…,δ mのうち下位桁に位置する
もの(すなわち添え字の小さなもの)だけをメモリに記
憶して、それ以外の定数を必要な時に計算によって生成
しても良い。そうすれば、定数を記憶するのに必要なメ
モリの量を節約できる。In the above description, the adder 203 and the adder 203
Although an adder with m inputs is used as the adder 303,
Using a two-input adder instead of a power adder,
The addition may be performed. When adding in time division
Is the constant δ1, Δ2,…, Δ mIs located at the lower digit of
Only the ones (ie those with small subscripts)
Remember, other constants are generated by calculation when needed
You may. That way, the methods needed to remember the constants are
The amount of moly can be saved.
【0053】[0053]
【発明の効果】以上説明したように、本発明では、1回
の加算だけで素数候補を生成できるようにしたから(時
分割で加算する場合でも、平均すると、1回程度の加算
で生成できる)、素数候補即ち素数である確率の高い乱
数を高速に生成できるという効果がある。As described above, according to the present invention, a prime number candidate can be generated by only one addition (even when adding by time division, it can be generated by about one addition on average). ), There is an effect that a prime candidate, that is, a random number having a high probability of being a prime number can be generated at high speed.
【0054】さらに、本発明では、発生する乱数の数m
を大きくしても、素数候補の生成に要する計算量がほと
んど変わらず、その結果、計算量を増やすことなく、素
数候補が素数である確率を大きくできるという効果があ
る。Further, in the present invention, the number m of random numbers generated
Even if is increased, the amount of calculation required to generate prime candidates hardly changes, and as a result, there is an effect that the probability that a prime candidate is a prime number can be increased without increasing the amount of calculation.
【図1】本発明による疑似乱数生成装置の一例を示すブ
ロック図である。FIG. 1 is a block diagram showing an example of a pseudo random number generation device according to the present invention.
【図2】図1に示す初期値生成装置の一例を示すブロッ
ク図である。FIG. 2 is a block diagram showing an example of an initial value generation device shown in FIG.
【図3】図1に示す素数候補生成装置の一例を示すブロ
ック図である。FIG. 3 is a block diagram illustrating an example of a prime candidate generation apparatus illustrated in FIG. 1;
【図4】図1に示す初期値生成装置の他の例を示すブロ
ック図である。FIG. 4 is a block diagram showing another example of the initial value generation device shown in FIG. 1;
【図5】図1に示す素数候補生成装置の他の例を示すブ
ロック図である。FIG. 5 is a block diagram showing another example of the prime candidate generation device shown in FIG. 1;
【図6】従来の疑似乱数の生成手法を説明するための流
れ図である。FIG. 6 is a flowchart for explaining a conventional pseudo random number generation technique.
110 乱数生成装置 120 初期値生成装置 130 素数候補生成装置 110 random number generator 120 initial value generator 130 prime candidate generator
───────────────────────────────────────────────────── フロントページの続き (72)発明者 吉川 博晴 東京都中央区勝どき三丁目12番1号 リコ ーシステム開発株式会社内 (72)発明者 梁 青 東京都中央区勝どき三丁目12番1号 リコ ーシステム開発株式会社内 Fターム(参考) 5J104 AA23 GA04 NA04 ──────────────────────────────────────────────────続 き Continuing on the front page (72) Inventor Hiroharu Yoshikawa 3-12-1, Kachidoki, Chuo-ku, Tokyo Inside Ricoh System Development Co., Ltd. (72) Inventor Liang, 3-12-1, Kachidoki, Chuo-ku, Tokyo F-term (reference) in Ricoh System Development Co., Ltd. 5J104 AA23 GA04 NA04
Claims (6)
数を疑似乱数として生成する際用いられる装置であっ
て、制御信号が論理反転された反転信号とクロック信号
との論理和によって得られたクロックパルスが与えられ
前記制御信号が“1”である際前記クロック信号が入力
される度に第1乃至第m(mは2以上の整数)の乱数を
発生する乱数生成装置と、前記第1乃至前記第mの乱数
のそれぞれに“1”を加算して第1乃至第mの加算結果
を得る第1の加算手段と、前記第1乃至第mの加算結果
にそれぞれ第1乃至第mの予め定められた乗算数を乗算
して第1乃至第mの乗算結果を生成する乗算手段と、前
記第1乃至前記第mの乗算結果を加算して加算結果を得
て該加算結果を前記初期値として出力する第2の加算手
段と、前記制御信号が“1”である際前記クロック信号
が入力されると前記第1乃至前記第mの乱数をそれぞれ
第1乃至第mの初期状態値として設定して前記制御信号
が“0”である際桁上がりが“1”であると前記クロッ
ク信号が入力される度にカウント値を“1”増加して前
記カウント値が予め定められたカウント値であると桁上
がり出力として“1”を出力し前記カウント値が前記予
め定められたカウント値以外であると桁上がり出力とし
て“0”を出力する第1乃至第mのカウンタと、前記第
1のカウンタの桁上がり入力に“1”を与え前記第2乃
至前記第mのカウンタの桁上がり入力に前記第1乃至前
記第(m−1)のカウンタの桁上がり出力を与える供給
手段と、第1乃至第mの選択値及び該第1乃至該第mの
選択値をそれぞれ2倍した第1乃至第mの倍数が与えら
れ第j(jは1〜mのいずれかの数)のカウンタの桁上
がり入力が“0”であると“0”を選択して選択値とし
て出力し前記第jのカウンタの桁上がり入力が“1”で
かつその桁上がり出力が“0”であると第jの選択値を
前記選択値として出力し前記第jのカウンタの桁上がり
入力が“1”でかつその桁上がり出力が“1”であると
第jの倍数を前記選択値として出力する第2のセレクタ
手段と、記憶値と前記選択値とを加算して合計値を出力
する第3の加算手段と、前記制御信号が“1”である際
前記クロック信号が与えられると前記初期値を前記記憶
値として記憶し前記制御信号が“0”であると前記クロ
ック信号が与えられる度に前記合計値を前記記憶値とし
て記憶するするとともに前記クロック信号が与えられる
都度前記記憶値を前記疑似乱数として出力するレジスタ
手段とを有することを特徴とする疑似乱数生成装置。1. A device used for generating a random number having a high probability of being a prime number from a plurality of random numbers as a pseudo-random number, wherein a control signal is obtained by a logical sum of a logically inverted inverted signal and a clock signal. A random number generation device that generates a first to m-th (m is an integer of 2 or more) random numbers each time the clock signal is input when a clock pulse is supplied and the control signal is “1”; A first adding means for adding “1” to each of the m-th random numbers to obtain first to m-th addition results; and a first to m-th random number added to the first to m-th addition results, respectively. Multiplying means for multiplying a predetermined multiplication number to generate first to m-th multiplication results; adding the first to m-th multiplication results to obtain an addition result; A second adding means for outputting the value as a value, and the control signal When the clock signal is inputted when the control signal is "1", the first to m-th random numbers are respectively set as first to m-th initial state values, and when the control signal is "0", carry is carried out. Is "1", the count value is incremented by "1" each time the clock signal is input, and if the count value is a predetermined count value, "1" is output as a carry output, and If the value is other than the predetermined count value, the first to m-th counters output "0" as a carry output, and "1" is supplied to the carry input of the first counter to provide the second counter. Supply means for providing the carry output of the first to (m-1) th counters to the carry input of the mth counter; the first to mth selected values and the first to mth counters 1 to m-th, each of which is twice the selected value of When a multiple is given and the carry input of the j-th (j is any number from 1 to m) counter is “0”, “0” is selected and output as a selected value, and the j-th counter digit is output. If the carry input is "1" and the carry output is "0", the j-th selected value is output as the selected value, and the carry input of the j-th counter is "1" and the carry output. Is the first value, the second selector means for outputting the j-th multiple as the selected value, the third adding means for adding the stored value and the selected value to output the total value, When the clock signal is supplied when the signal is "1", the initial value is stored as the storage value. When the control signal is "0", the total value is stored each time the clock signal is supplied. And the clock signal is given. Pseudorandom number generator, characterized in that it comprises a register means for outputting the stored value as the pseudo-random number.
数を疑似乱数として生成する際用いられる装置であっ
て、制御信号が論理反転された反転信号とクロック信号
との論理和によって得られたクロックパルスが与えられ
前記制御信号が“1”である際前記クロック信号が入力
される度に第1乃至第m(mは2以上の整数)の乱数を
発生する乱数生成装置と、前記第1乃至前記第mの乱数
のそれぞれに“1”を加算して第1乃至第mの加算結果
を得る第1の加算手段と、前記第1乃至第mの加算結果
にそれぞれ第1乃至第mの予め定められた乗算数を乗算
して第1乃至第mの乗算結果を生成する乗算手段と、前
記第1乃至前記第mの乗算結果を加算して加算結果を出
力する第2の加算手段と、該加算結果からそれぞれ第1
乃至第mの減算数を減算して第1乃至第mの減算結果を
得る第1の減算手段と、前記加算結果と前記第1乃至前
記第mの減算数とをそれぞれ比較して比較結果を出力す
る第1の比較手段と、該比較結果に応じて前記加算結果
及び前記第1及び前記第mの減算結果を選択的に前記初
期値として出力する第1のセレクタ手段と、前記制御信
号が“1”である際前記クロック信号が入力されると前
記第1乃至前記第mの乱数をそれぞれ第1乃至第mの初
期状態値として設定して前記制御信号が“0”である際
桁上がりが“1”であると前記クロック信号が入力され
る度にカウント値を“1”増加して前記カウント値が予
め定められたカウント値であると桁上がり出力として
“1”を出力し前記カウント値が前記予め定められたカ
ウント値以外であると桁上がり出力として“0”を出力
する第1乃至第mのカウンタと、前記第1のカウンタの
桁上がり入力に“1”を与え前記第2乃至前記第mのカ
ウンタの桁上がり入力に前記第1乃至前記第(m−1)
のカウンタの桁上がり出力を与える供給手段と、第1乃
至第mの選択値及び該第1乃至該第mの選択値をそれぞ
れ2倍した第1乃至第mの倍数が与えられ第j(jは1
〜mのいずれかの数)のカウンタの桁上がり入力が
“0”であると“0”を選択して選択値として出力し前
記第jのカウンタの桁上がり入力が“1”でかつその桁
上がり出力が“0”であると第jの選択値を前記選択値
として出力し前記第jのカウンタの桁上がり入力が
“1”でかつその桁上がり出力が“1”であると第jの
倍数を前記選択値として出力する第2のセレクタ手段
と、記憶値と前記選択値とを加算して合計値を出力する
第3の加算手段と、前記合計値からそれぞれ前記第1乃
至前記第mの減算数を減算して第1乃至第mの減算計算
結果を得る第2の減算手段と、前記合計値と前記第1乃
至前記第mの減算数とをそれぞれ比較して比較計算結果
を出力する第2の比較手段と、該比較計算結果に応じて
前記合計値及び前記第1及び前記第mの減算計算結果を
選択的にセレクト値として出力する第2のセレクタ手段
と、前記制御信号が“1”である際前記クロック信号が
与えられると前記初期値を前記記憶値として記憶し前記
制御信号が“0”であると前記クロック信号が与えられ
る度に前記セレクト値を前記記憶値として記憶するする
とともに前記クロック信号が与えられる都度前記記憶値
を前記疑似乱数として出力するレジスタ手段とを有する
ことを特徴とする疑似乱数生成装置。2. A device used for generating a random number having a high probability of being a prime number from a plurality of random numbers as a pseudo-random number, wherein a control signal is obtained by a logical sum of a logically inverted inverted signal and a clock signal. A random number generation device that generates a first to m-th (m is an integer of 2 or more) random numbers each time the clock signal is input when a clock pulse is supplied and the control signal is “1”; A first adding means for adding “1” to each of the m-th random numbers to obtain first to m-th addition results; and a first to m-th random number added to the first to m-th addition results, respectively. Multiplying means for multiplying a predetermined multiplication number to generate first to m-th multiplication results, and second adding means for adding the first to m-th multiplication results and outputting an addition result , From the result of the addition
First subtraction means for subtracting the first through m-th subtraction numbers to obtain first through m-th subtraction results; and comparing the addition result with the first through the m-th subtraction numbers to obtain a comparison result. First comparing means for outputting, the first selector means for selectively outputting, as the initial value, the addition result and the first and m-th subtraction results according to the comparison result; When the clock signal is inputted when the control signal is "1", the first to m-th random numbers are respectively set as first to m-th initial state values, and when the control signal is "0", carry is carried out. Is "1", the count value is incremented by "1" each time the clock signal is input, and if the count value is a predetermined count value, "1" is output as a carry output, and The value is other than the predetermined count value First to m-th counters that output “0” as carry output; and “1” to the carry input of the first counter, and the first to m-th counters provide the carry input of the second to m-th counters. 1 to the (m-1) th
And a supply means for providing a carry output of the counter, and the first to m-th selected values and the first to m-th multiples of twice the first to m-th selected values, respectively, and j-th (j Is 1
If the carry input of any of the counters is any of "0", "0" is selected and output as a selected value, and the carry input of the j-th counter is "1" and its digit If the carry output is "0", the j-th selected value is output as the selected value. If the carry input of the j-th counter is "1" and the carry output is "1", the j-th selected value is output. Second selector means for outputting a multiple as the selected value, third adding means for adding the stored value and the selected value to output a total value, and the first to m-th values respectively based on the total value. A second subtraction means for subtracting the subtraction number from the first to obtain first to m-th subtraction calculation results, and comparing the total value with the first to the m-th subtraction numbers to output a comparison calculation result A second comparing means, and the total value and the first and the second values in accordance with a result of the comparison calculation. Second selector means for selectively outputting the m-th subtraction calculation result as a select value, and storing the initial value as the storage value when the clock signal is supplied when the control signal is "1". Register means for storing the select value as the storage value each time the clock signal is applied when the control signal is "0", and outputting the storage value as the pseudo-random number each time the clock signal is applied; A pseudorandom number generation device, comprising:
成装置において、第jの乱数をAIjで表した際、AI
jは、0≦AIj<Pj−1を満足する整数であり、P
jは2以上の素数であることを特徴とする疑似乱数生成
装置。3. The pseudo-random number generator according to claim 1, wherein when the j-th random number is represented by AI j , AI
j is an integer satisfying 0 ≦ AI j <P j −1;
A pseudorandom number generator, wherein j is a prime number of 2 or more.
において、第jの予め定められた乗算数及び前記第jの
選択値をδjで表した時、前記δjはδj=P1P2…
Pm/Pjで定義される整数であることを特徴とする疑
似乱数生成装置。4. The pseudo-random number generator according to claim 3, wherein when the j-th predetermined multiplier and the j-th selected value are represented by δ j , δ j is δ j = P 1 P 2 ...
Pseudorandom number generator which is a integer defined by P m / P j.
において、前記予め定められたカウント値はPj−1で
あることを特徴とする疑似乱数生成装置。5. The pseudo-random number generation device according to claim 4, wherein the predetermined count value is P j −1.
において、第jの乱数をAIjで表した際、AIjは、
0≦AIj<Pj−1を満足する整数であり、Pjは2
以上の素数であり、第jの予め定められた乗算数及び前
記第jの選択値をδjで表した時、前記δjはδj=P
1P2…Pm/Pjで定義される整数であり、前記予め
定められたカウント値はPj−1であり、さらに、前記
第1乃至第mの減算数はそれぞれ1P1P2…Pm,2
P1P2…Pm,…,mP1P 2…Pmであり、前記比
較結果が、加算結果<P1P2…Pmであると、前記第
1のセレクタ手段は、前記加算結果を前記初期値として
選択し、前記比較結果が、jP1P2…Pm≦加算結果
<(j+1)P1P2…Pmであると、第jの減算結果
を前記初期値として選択し、また、前記比較計算結果
が、加算計算結果<P1P2…Pmであると、前記第2
のセレクタ手段は、前記加算計算結果を前記セレクト値
として選択し、前記比較計算結果が、jP1P2…Pm
≦加算計算結果<(j+1)P1P2…Pmであると、
第jの減算計算結果を前記セレクト値として選択するよ
うにしたことを特徴とする疑似乱数生成装置。6. The pseudorandom number generator according to claim 2.
, The j-th random number is AIjWhen represented by AIjIs
0 ≦ AIj<PjIs an integer satisfying −1, and PjIs 2
The prime number, j-th predetermined multiplier and
The j-th selected value is δjWhen represented by the above δjIs δj= P
1P2… Pm/ PjIs an integer defined by
The determined count value is Pj-1;
The first to m-th subtraction numbers are each 1P1P2… Pm, 2
P1P2… Pm, ..., mP1P 2… PmAnd the ratio
If the comparison result is the addition result <P1P2… PmAnd the second
1 selector means sets the addition result as the initial value.
And the comparison result is jP1P2… Pm≤ addition result
<(J + 1) P1P2… Pm, The j-th subtraction result
Is selected as the initial value, and the comparison calculation result
Is the addition calculation result <P1P2… Pm, The second
Selector means for converting the addition calculation result into the select value
And the comparison calculation result is jP1P2… Pm
≦ addition calculation result <(j + 1) P1P2… PmIs
The j-th subtraction calculation result is selected as the select value.
A pseudo-random number generator, characterized in that:
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP28507499A JP2001109375A (en) | 1999-10-06 | 1999-10-06 | Pseudo random number generator |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP28507499A JP2001109375A (en) | 1999-10-06 | 1999-10-06 | Pseudo random number generator |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2001109375A true JP2001109375A (en) | 2001-04-20 |
Family
ID=17686820
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP28507499A Pending JP2001109375A (en) | 1999-10-06 | 1999-10-06 | Pseudo random number generator |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2001109375A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2011010277A (en) * | 2009-06-24 | 2011-01-13 | Intel Corp | Cryptographic key generation using stored input value and stored output value |
-
1999
- 1999-10-06 JP JP28507499A patent/JP2001109375A/en active Pending
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2011010277A (en) * | 2009-06-24 | 2011-01-13 | Intel Corp | Cryptographic key generation using stored input value and stored output value |
| US8971530B2 (en) | 2009-06-24 | 2015-03-03 | Intel Corporation | Cryptographic key generation using a stored input value and a stored count value |
| US9800409B2 (en) | 2009-06-24 | 2017-10-24 | Intel Corporation | Cryptographic key generation using a stored input value and a stored count value |
| US10341099B2 (en) | 2009-06-24 | 2019-07-02 | Intel Corporation | Cryptographic key generation using a stored input value and a stored count value |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3022439B2 (en) | Pseudo random number generation method and apparatus | |
| US20090196420A1 (en) | Cryptographic system incorporating a digitally generated chaotic numerical sequence | |
| US7486789B2 (en) | Device and method for calculation on elliptic curve | |
| KR100591761B1 (en) | Montgomery Modular Multiplication Method Using Montgomery Modular Multiplier and Carry Store Addition | |
| US20050097153A1 (en) | Pseudorandom number generator | |
| WO2010034326A1 (en) | State machine and generator for generating a description of a state machine feedback function | |
| US20020101984A1 (en) | Power-residue calculating unit using Montgomery algorithm | |
| Yakut et al. | Secure and efficient hybrid random number generator based on sponge constructions for cryptographic applications | |
| US6763366B2 (en) | Method for calculating arithmetic inverse over finite fields for use in cryptography | |
| CN1051661C (en) | Code sequence generator | |
| US7480691B2 (en) | Arithmetic device for multiple precision arithmetic for Montgomery multiplication residue arithmetic | |
| Wang et al. | A high-throughput Toom-Cook-4 polynomial multiplier for lattice-based cryptography using a novel winograd-schoolbook algorithm | |
| Lee et al. | Enhancing stochastic computing using a novel hybrid random number generator integrating LFSR and Halton sequence | |
| JP2006072891A (en) | Method and apparatus for generating pseudo-random sequence having controllable period based on cellular automaton | |
| KR100478974B1 (en) | Serial finite-field multiplier | |
| O'Rourke et al. | Achieving NTRU with Montgomery multiplication | |
| JP2001109375A (en) | Pseudo random number generator | |
| JP2004038020A (en) | Cryptographic pseudo-random number generator and program | |
| KR100564764B1 (en) | Finite Field Polynomial Multiplication Apparatus and Method | |
| EP1126359B1 (en) | Frequency synthesizer and gaussian noise generator using the same | |
| US20060161610A1 (en) | Device and method for generating a sequence of numbers | |
| JP2004334212A (en) | Montgomery multiplier and multiplication method | |
| US7471789B2 (en) | Encryption circuit achieving higher operation speed | |
| Stehlé | On the randomness of bits generated by sufficiently smooth functions | |
| KR100564765B1 (en) | Finite polynomial division device and method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20040729 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20040811 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20050105 |