JP2007218997A - Prime number generation device, program and method - Google Patents

Prime number generation device, program and method Download PDF

Info

Publication number
JP2007218997A
JP2007218997A JP2006036779A JP2006036779A JP2007218997A JP 2007218997 A JP2007218997 A JP 2007218997A JP 2006036779 A JP2006036779 A JP 2006036779A JP 2006036779 A JP2006036779 A JP 2006036779A JP 2007218997 A JP2007218997 A JP 2007218997A
Authority
JP
Japan
Prior art keywords
prime number
divisor
prime
candidate
remainder
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.)
Withdrawn
Application number
JP2006036779A
Other languages
Japanese (ja)
Inventor
Hidehiro Kumakyu
英洋 熊給
Akito Niwa
朗人 丹羽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Toshiba Digital Solutions Corp
Original Assignee
Toshiba Corp
Toshiba Solutions Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp, Toshiba Solutions Corp filed Critical Toshiba Corp
Priority to JP2006036779A priority Critical patent/JP2007218997A/en
Publication of JP2007218997A publication Critical patent/JP2007218997A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a prime number generation device, a program and a method, in which a second prime number having a form of polynomial of a first prime number, which is not limited to the prime number of a safe prime, is generated at high speed. <P>SOLUTION: The first prime number p and the second prime number f(p) having the form of the polynomial f(p)(=a<SB>n</SB>×p<SP>n</SP>+a<SB>n-1</SB>×p<SP>n-1</SP>+...+a<SB>2</SB>×p<SP>2</SP>+a<SB>1</SB>×p+a<SB>0</SB>), where a constant term (a<SB>0</SB>) is not 0, which is calculated from the first prime number, are generated, and thereby, the second prime number f(p) having the form of the polynomial of the first prime number is generated without being limited by the prime number (2p+1) of the safe prime form. In addition to that, a percentage of performing a full-scale prime number judgment method which takes time is decreased by performing the full-scale prime number judgment including Fermats small theorem, after performing trial division which is calculated at high speed beforehand, and thereby, the first and the second prime numbers p and f(p) are generated at high speed. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、素数を生成するための素数生成装置、プログラム及び方法に係り、例えば、セーフプライム形の素数に限定されず、第1素数の多項式の形をもつ第2素数を高速に生成し得る素数生成装置、プログラム及び方法に関する。   The present invention relates to a prime number generating apparatus, a program, and a method for generating a prime number. For example, the present invention is not limited to a prime number of a safe prime type, and can generate a second prime number having a polynomial form of a first prime number at high speed. The present invention relates to a prime number generation device, a program, and a method.

暗号分野においては、pを素数としたとき、2p+1という形の素数が、暗号の安全性を高めるために用いられている。この形の素数はセーフプライム(safe prime)と呼ばれる。セーフプライムは、ディフィー−へルマン(Diffie-Hellman)鍵交換を始めとして、多くの暗号通信プロトコルで用いられている。   In the cryptographic field, when p is a prime number, a prime number of the form 2p + 1 is used to increase the security of the encryption. This form of prime number is called a safe prime. Safe prime is used in many cryptographic communication protocols, including Diffie-Hellman key exchange.

このセーフプライムを生成するための効率的な方法は、今のところ知られていない。一般的な素数生成方法においては、素数候補の乱数pを素数判定し、素数であれば、さらにセーフプライム候補の数2p+1を素数判定することにより、セーフプライム形の素数2p+1を生成している。   An efficient method for generating this safe prime is not known so far. In a general prime number generation method, a prime prime number 2p + 1 is generated by determining a prime number of a prime candidate random number p and, if it is a prime number, further determining a prime number of a safe prime candidate number 2p + 1.

図8は一般的な素数生成方法を説明するためのフローチャートである。この素数生成方法は、素数候補pの簡易素数判定(ST1〜ST4)、素数候補pの本格的素数判定(ST5)、セーフプライム候補2p+1の簡易素数判定(ST6〜ST9)、セーフプライム候補2p+1の本格的素数判定(ST10)から構成されている。具体的には、この素数判定方法は、例えばコンピュータからなる素数生成装置に実行される。   FIG. 8 is a flowchart for explaining a general prime number generation method. This prime number generation method includes simple prime number determination of the prime candidate p (ST1 to ST4), full-scale prime number determination of the prime number candidate p (ST5), simple prime number determination of the safe prime candidate 2p + 1 (ST6 to ST9), and the safe prime candidate 2p + 1. It consists of full-scale prime number determination (ST10). Specifically, this prime number determination method is executed by a prime number generation device including, for example, a computer.

始めに、素数生成装置は、除数識別情報iをi=0として初期化する(ST1)。続いて、素数生成装置は、素数候補としての乱数pを生成する(ST2)。なお、ステップST1,ST2の順序は逆でもよい。   First, the prime number generating apparatus initializes the divisor identification information i as i = 0 (ST1). Subsequently, the prime number generation device generates a random number p as a prime number candidate (ST2). Note that the order of steps ST1 and ST2 may be reversed.

次に、素数生成装置は、素数候補pに対し、予め保持しておいた除数テーブルを用い、除数識別情報i=1から順次、試行割算を行う(ST3)。   Next, the prime number generation apparatus sequentially performs trial division from the divisor identification information i = 1 using the divisor table held in advance for the prime number candidate p (ST3).

ここで、除数識別情報iは、除数テーブルから除数primes[i]を読み出すために用いられる。なお、除数テーブルは、除数識別情報i及び除数primes[i]が互いに関連付けて記述されている。除数識別情報iは、1,2,…,PRIMES_NUM−1,PRIMES_NUM、のように、自然数としている。   Here, the divisor identification information i is used to read the divisor primes [i] from the divisor table. In the divisor table, divisor identification information i and divisor primes [i] are described in association with each other. The divisor identification information i is a natural number such as 1, 2,..., PRIMES_NUM−1, PRIMES_NUM.

素数生成装置は、素数候補pを除数primes[i]で割り算した剰余が0のとき(p÷primes[i]=0)、又は除数識別情報iが最大値PRIMES_NUMの場合の割り算を終えたとき(i=PRIMES_NUM)、ステップST3の試行割算を終了する。   The prime number generation device has finished division when the remainder obtained by dividing the prime candidate p by the divisor primes [i] is 0 (p ÷ primes [i] = 0) or when the divisor identification information i is the maximum value PRIMES_NUM (I = PRIMES_NUM), the trial division in step ST3 ends.

素数生成装置は、ステップST3の試行割算を終了したときの除数識別情報iが最大値PRIMES_NUMであるか否かを判定し(ST4)、否の場合(試行割算に失敗した場合)にはステップST1に戻る。   The prime number generation apparatus determines whether or not the divisor identification information i when the trial division in step ST3 ends is the maximum value PRIMES_NUM (ST4). If not (if trial division fails), Return to step ST1.

一方、ステップST4の判定の結果、除数識別情報iが最大値PRIMES_NUMの場合(試行割算に成功した場合)、素数生成装置は、素数候補pに対し、フェルマー(Fermat)法、ミラー−ラビン(Miller-Rabin)法などの、本格的な素数判定を行う(ST5)。   On the other hand, if the result of the determination in step ST4 is that the divisor identification information i is the maximum value PRIMES_NUM (when the trial division is successful), the prime number generation device uses the Fermat method, Miller-Rabin ( Miller-Rabin) method and other full-scale prime number determination is performed (ST5).

ステップST5の素数判定の結果、素数候補pが素数ではない場合(NGの場合)には、ステップST1に戻る。   As a result of the prime number determination in step ST5, if the prime candidate p is not a prime number (in the case of NG), the process returns to step ST1.

ステップST5の素数判定の結果、素数候補pが素数である場合(OKの場合)には、素数生成装置は、除数識別情報iをi=0として初期化する(ST6)。続いて、素数生成装置は、セーフプライム候補としての数2p+1を計算する(ST7)。なお、ステップST6,ST7の順序は逆でもよい。   As a result of the prime number determination in step ST5, when the prime number candidate p is a prime number (in the case of OK), the prime number generation device initializes the divisor identification information i as i = 0 (ST6). Subsequently, the prime number generation device calculates the number 2p + 1 as a safe prime candidate (ST7). Note that the order of steps ST6 and ST7 may be reversed.

次に、素数生成装置は、セーフプライム候補2p+1に対し、前述同様に、除数テーブルを用いて試行割算を行う(ST8)。素数生成装置は、セーフプライム候補2p+1を除数primes[i]で割り算した剰余が0のとき((2p+1)÷primes[i]=0)、又は除数識別情報iが最大値PRIMES_NUMの場合の割り算を終えたとき(i=PRIMES_NUM)、ステップST8の試行割算を終了する。   Next, the prime number generating apparatus performs trial division on the safe prime candidate 2p + 1 using the divisor table as described above (ST8). The prime number generation device is used when the remainder obtained by dividing the safe prime candidate 2p + 1 by the divisor primes [i] is 0 ((2p + 1) ÷ primes [i] = 0), or when the divisor identification information i is the maximum value PRIMES_NUM. When the division is finished (i = PRIMES_NUM), the trial division in step ST8 is finished.

素数生成装置は、ステップST8の試行割算を終了したときの除数識別情報iが最大値PRIMES_NUMであるか否かを判定し(ST9)、否の場合(試行割算に失敗した場合)にはステップST1に戻る。   The prime number generation apparatus determines whether or not the divisor identification information i when the trial division in step ST8 is completed is the maximum value PRIMES_NUM (ST9). If not (if the trial division fails), Return to step ST1.

一方、ステップST9の判定の結果、除数識別情報iが最大値PRIMES_NUMの場合(試行割算に成功した場合)、素数生成装置は、セーフプライム候補2p+1に対し、フェルマー(Fermat)法、ミラー−ラビン(Miller-Rabin)法などの、本格的な素数判定を行う(ST10)。   On the other hand, when the divisor identification information i is the maximum value PRIMES_NUM as a result of the determination in step ST9 (when the trial division is successful), the prime number generation device performs the Fermat (Fermat) method, Miller-Rabin on the safe prime candidate 2p + 1. Full-fledged prime number determination such as (Miller-Rabin) method is performed (ST10).

ステップST10の素数判定の結果、セーフプライム候補2p+1が素数ではない場合(NGの場合)には、ステップST1へ戻る。   As a result of the prime number determination in step ST10, when the safe prime candidate 2p + 1 is not a prime number (in the case of NG), the process returns to step ST1.

ステップST10の素数判定の結果、セーフプライム候補2p+1が素数である場合(OKの場合)には、素数生成装置は、セーフプライム形の素数2p+1と、素数pとを出力する。   If the result of the prime number determination in step ST10 is that the safe prime candidate 2p + 1 is a prime number (in the case of OK), the prime number generation device outputs a safe prime type prime number 2p + 1 and a prime number p.

なお、以上のような一般的な素数生成方法に限らず、セーフプライムを生成する方法には種々の方式がある(例えば非特許文献1,2参照)。ここで、非特許文献1には、セーフプライムqを生成するために、(q−1)/2を乱数として生成し、この乱数を素数判定し、素数判定に合格したら、qを素数判定する方式が開示されている。   In addition to the general prime number generation method as described above, there are various methods for generating a safe prime (see, for example, Non-Patent Documents 1 and 2). Here, in Non-Patent Document 1, in order to generate a safe prime q, (q-1) / 2 is generated as a random number, this random number is subjected to prime number determination, and if the prime number determination is passed, q is determined to be a prime number. A scheme is disclosed.

非特許文献2には、セーフプライムqを生成するために、(q−1)/2を乱数として生成し、ある定数以下の小さな奇素数rに対して、(q−1)/2≡(r−1)/2 (mod r)なる乱数(q−1)/2を除去し、残った乱数(q−1)/2を素数判定し、素数判定に合格したら、qを素数判定する方式が開示されている。
“Handbook of applied cryptography p.164” http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf “Safe Prime Generation with a Combined Sieve” http://eprint.iacr.org/2003/186.pdf
In Non-Patent Document 2, in order to generate the safe prime q, (q-1) / 2 is generated as a random number, and for a small odd number r less than a certain constant, (q-1) / 2≡ ( R-1) / 2 (mod r) random number (q-1) / 2 is removed, the remaining random number (q-1) / 2 is primed, and if the prime number judgment is passed, q is primed Is disclosed.
“Handbook of applied cryptography p.164” http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf “Safe Prime Generation with a Combined Sieve” http://eprint.iacr.org/2003/186.pdf

しかしながら、以上のような素数生成方法では、次のような問題がある。
例えば、図8に示した方法では、乱数pの値が大きくなるにつれ、セーフプライム形の素数2p+1を生成するための時間が、非常に増大するという問題がある。このため、素数生成装置を備えた情報機器や、このような情報機器を複数台備えた情報システム(以下、情報機器等という)においては、素数生成装置の計算負荷を増大させ、システム稼働率を低下させる問題がある。
However, the above prime number generation method has the following problems.
For example, the method shown in FIG. 8 has a problem that as the value of the random number p increases, the time required to generate the safe prime type prime number 2p + 1 greatly increases. For this reason, in an information device equipped with a prime number generation device or an information system (hereinafter referred to as an information device) provided with a plurality of such information devices, the calculation load of the prime number generation device is increased, and the system operation rate is increased. There is a problem to lower.

このような問題を解決する観点から、情報機器等では、セーフプライムを予め生成して保持する方式や、セーフプライムではない、一般的な素数を用いた暗号通信を行う方式が知られている。しかしながら、これらの方式は、情報機器等のセキュリティレベルを低下させる場合があるので、上記問題を実際に解決したとは言えない。なお、非特許文献1に記載の方法は、前述した図8に示した方法と同様の問題があると考えられる。   From the viewpoint of solving such a problem, a method for generating and holding a safe prime in advance and a method for performing cryptographic communication using a general prime number that is not a safe prime are known in information equipment and the like. However, since these methods may lower the security level of information equipment and the like, it cannot be said that the above problem has actually been solved. The method described in Non-Patent Document 1 is considered to have the same problem as the method shown in FIG.

一方、非特許文献2に記載の方法は、予め奇素数rを法として、(r−1)/2に合同な乱数をセーフプライム候補から除去した後に、残ったセーフプライム候補を素数判定するので、素数生成装置の計算負荷を減少できる。   On the other hand, since the method described in Non-Patent Document 2 uses the odd prime number r as a modulus in advance and removes random numbers congruent to (r−1) / 2 from the safe prime candidates, the remaining prime prime candidates are determined as prime numbers. The calculation load of the prime number generator can be reduced.

補足すると、素数生成装置の計算負荷は、試行割算よりも本格的素数判定の方がはるかに大きい。そこで、非特許文献2に記載の方法は、本格的素数判定の前に簡単な合成数を除去するので、素数生成装置の計算負荷を減少できる。この非特許文献2に記載の方法によれば、上記問題を解決することができる。   Supplementally, the calculation load of the prime number generation device is much larger for the full-scale prime number determination than for the trial division. Therefore, the method described in Non-Patent Document 2 removes a simple composite number before full-scale prime number determination, so that the calculation load of the prime number generator can be reduced. According to the method described in Non-Patent Document 2, the above problem can be solved.

但し、非特許文献2に記載の方法は、特に問題は無いものの、本発明者の検討によれば、セーフプライム形の素数2p+1に限定されている不都合があると考えられる。   However, although the method described in Non-Patent Document 2 is not particularly problematic, it is considered that there is an inconvenience limited to the safe prime type prime number 2p + 1 according to the study of the present inventor.

本発明は上記実情を考慮してなされたもので、セーフプライム形の素数に限定されず、第1素数の多項式の形をもつ第2素数を高速に生成し得る素数生成装置、プログラム及び方法を提供することを目的とする。   The present invention has been made in consideration of the above circumstances, and is not limited to a prime number of a safe prime type, and a prime number generating apparatus, program, and method capable of generating a second prime number having a polynomial form of a first prime number at high speed are provided. The purpose is to provide.

第1の発明は、定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、ZはXを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成する素数生成装置であって、予め除数識別情報毎に除数が記憶された除数記憶手段と、前記第1素数の候補pとして乱数を生成する乱数生成手段と、前記第1素数の候補pに基づいて、前記第2素数の候補f(p)を算出する第2素数候補算出手段と、前記各素数の候補p,f(p)に対し、前記除数記憶手段内の除数識別情報毎の除数により個別に試行割算を実行する試行割算実行手段と、前記除数記憶手段内の全ての除数による全ての試行割算の結果が剰余を持つとき、前記各素数の候補p,f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定手段とを備えた素数生成装置である。   The first invention is the first prime number for an integer coefficient polynomial f (X) ∈Z [X] whose constant term is not 0 (where X is an arbitrary integer and Z is a set whose element is X). A prime number generation device that generates p (∈Z) and a second prime number f (p) (∈Z) that can be calculated from the first prime number p, and a divisor in which a divisor is stored in advance for each divisor identification information Storage means; random number generation means for generating random numbers as the first prime candidate p; and second prime number candidate calculation for calculating the second prime number candidate f (p) based on the first prime number candidate p. Means, trial division execution means for individually executing trial division by divisor for each divisor identification information in the divisor storage means for each prime number candidate p, f (p), and in the divisor storage means When the result of all the trial divisions by all the divisors has a remainder, for each prime number candidate p, f (p) Fermat's little theorem is a prime number generator with a prime number judging means for performing a primality test including.

第2の発明は、定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、ZはXを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成する素数生成装置であって、予め除数識別情報毎に除数が記憶されており、試行割算結果の剰余が前記除数識別情報に関連付けて記憶される除数記憶手段と、前記第1素数の候補pとして乱数を生成する乱数生成手段と、前記第1素数の候補pに対し、前記除数記憶手段内の除数識別情報毎の除数により個別に試行割算を実行する第1割算実行手段と、前記第1割算実行手段による試行割算の結果が剰余kを持つとき、当該剰余kを前記除数記憶手段に書き込む剰余書込手段と、前記剰余書込手段により書き込まれた剰余kに基づいて、前記多項式f(k)を計算する多項式計算手段と、前記多項式f(k)に対し、前記除数記憶手段内の除数識別情報毎の除数により個別に試行割算を実行する第2割算実行手段と、前記除数記憶手段内の全ての除数による全ての試行割算の結果が剰余を持つとき、前記第1素数の候補p及び前記第2素数の候補f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定手段とを備えた素数生成装置である。   The second invention is a first prime number for a polynomial f (X) ∈Z [X] of integer coefficients whose constant term is not 0 (where X is an arbitrary integer and Z is an element whose element is X). A prime number generation device that generates p (∈Z) and a second prime number f (p) (∈Z) that can be calculated from the first prime number p, and a divisor is stored in advance for each divisor identification information. A divisor storage means for storing the remainder of the trial division result in association with the divisor identification information, a random number generating means for generating a random number as the first prime number candidate p, and the first prime number candidate p. When the result of trial division by the first division execution means and the first division execution means for executing trial division individually by the divisor for each divisor identification information in the divisor storage means has a remainder k, A remainder writing means for writing the remainder k to the divisor storage means and writing by the remainder writing means A polynomial calculation means for calculating the polynomial f (k) based on the remainder k, and a trial division for the polynomial f (k) by the divisor for each divisor identification information in the divisor storage means And the second prime number candidate p and the second prime number candidate f (p) when the result of all trial divisions by all the divisors in the divisor storage means has a remainder. On the other hand, it is a prime number generating device provided with a prime number judging means for executing a prime number judging method including Fermat's little theorem.

(作用)
第1の発明によれば、第1素数pと、この第1素数pから算出可能で定数項が0ではない多項式の形をもつ第2素数f(p)とを生成する構成により、セーフプライム形の素数に限定されず、第1素数の多項式の形をもつ第2素数を生成することができる。
(Function)
According to the first aspect of the present invention, a safe prime is generated by generating the first prime number p and the second prime number f (p) having a polynomial form that can be calculated from the first prime number p and whose constant term is not 0. The second prime number having the form of a polynomial of the first prime number can be generated without being limited to the prime number of the shape.

これに加え、第1の発明によれば、高速に計算可能な試行割算を先に行った後に、本格的な素数判定法(フェルマーの小定理を含む素数判定法)を行う構成により、時間のかかる本格的な素数判定法の実行割合を減少できるので、前述した第1及び第2素数p,f(p)を高速に生成することができる。   In addition to this, according to the first invention, after performing trial division that can be calculated at high speed first, a full-fledged prime number determination method (prime number determination method including Fermat's small theorem) is used. Therefore, the first and second prime numbers p and f (p) described above can be generated at high speed.

第2の発明によれば、第1の発明の作用効果に加え、第2素数の候補f(p)に関する試行割算を、剰余kの多項式f(k)に関する試行割算により行う構成により、従来とは異なり、試行割算をワードサイズで実行できるので、第1及び第2素数p,f(p)をより一層高速に生成することができる。   According to the second invention, in addition to the effects of the first invention, the trial division related to the second prime candidate f (p) is performed by the trial division related to the polynomial f (k) of the remainder k. Unlike the prior art, trial division can be performed in word size, so that the first and second prime numbers p and f (p) can be generated even faster.

なお、第1及び第2の各発明は「装置」として表現したが、これに限らず、「プログラム」、「方法」又は「コンピュータ読み取り可能な記憶媒体」として表現してもよい。   The first and second inventions are expressed as “devices”, but are not limited thereto, and may be expressed as “programs”, “methods”, or “computer-readable storage media”.

以上説明したように本発明によれば、セーフプライム形の素数に限定されず、第1素数の多項式の形をもつ第2素数を高速に生成できる。   As described above, according to the present invention, the second prime number having a polynomial form of the first prime number can be generated at high speed without being limited to the prime number of the safe prime type.

以下、本発明の各実施形態を図面を用いて説明する。なお、以下の説明中、乱数、素数、素数候補、定数項、整数係数、多項式、除数、剰余などの語を用いるが、これらは、乱数データ、素数データ、素数候補データ、定数項データ、整数係数データ、多項式データ、除数データ、剰余データ等のように、「データ」の語を追記して読み替えてもよい。   Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the following description, terms such as random numbers, prime numbers, prime candidates, constant terms, integer coefficients, polynomials, divisors, and remainders are used. These are random number data, prime number data, prime candidate data, constant term data, integers, etc. The term “data” may be added and read as coefficient data, polynomial data, divisor data, remainder data, or the like.

(第1の実施形態)
図1は本発明の第1の実施形態に係る素数生成装置の構成を示す模式図である。この素数生成装置10は、定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、Zは整数Xを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成するものである。ここで、第2素数f(p)は、例えば多項式の次数をnとし、次数毎の整数係数をan,an-1,…,a2,a1とし、定数項をa0としたとき、次式に示すように計算される。
(First embodiment)
FIG. 1 is a schematic diagram showing a configuration of a prime number generating apparatus according to the first embodiment of the present invention. The prime number generation apparatus 10 is configured to calculate an integer coefficient polynomial f (X) ∈Z [X] whose constant term is not 0 (where X is an arbitrary integer, Z is a set having the integer X as an element), One prime number p (εZ) and a second prime number f (p) (εZ) that can be calculated from the first prime number p are generated. Here, the second prime number f (p), for example the degree of the polynomial is n, the integer coefficients for each order a n, a n-1, ..., and a 2, a 1, a constant term was a 0 Is calculated as shown in the following equation.

f(p)=an・pn + an-1・pn-1 + … + a2・p2 + a1・p + a0
このような第2素数f(p)は、次数n=1、整数係数a1=2、定数項a0=1の場合、セーフプライム2p+1となる。但し、第2素数f(p)は、セーフプライム2p+1に限定されない。
f (p) = a n · p n + a n−1 · p n−1 +... + a 2 · p 2 + a 1 · p + a 0
Such a second prime number f (p) is safe prime 2p + 1 when the order n = 1, the integer coefficient a 1 = 2 and the constant term a 0 = 1. However, the second prime number f (p) is not limited to the safe prime 2p + 1.

この素数生成装置10は、具体的には携帯電話又はスマートカードなどの演算機の素数生成部として構成され、ハードウェア及びソフトウェアの組合せにより素数生成処理を行うものである。   Specifically, the prime number generation device 10 is configured as a prime number generation unit of a computing machine such as a mobile phone or a smart card, and performs prime number generation processing by a combination of hardware and software.

例えば素数生成装置10においては、プログラム記憶部11、テーブル記憶部12、RAM13、入出力I/F14、CPU(中央処理装置)15、乱数生成部16及び演算部17が互いにバスを介して接続されている。   For example, in the prime number generation device 10, a program storage unit 11, a table storage unit 12, a RAM 13, an input / output I / F 14, a CPU (central processing unit) 15, a random number generation unit 16, and a calculation unit 17 are connected to each other via a bus. ing.

プログラム記憶部11は、CPU15に実行されるプログラムが記憶されるハードウェア資源としてのメモリであり、例えばROM(リードオンリーメモリ)が使用可能となっている。ここで、プログラムは、例えば図3又は図4に示す素数生成機能を実現させるためのものである。この素数生成機能としては、例えば以下の機能(f11-1)〜(f11-5)を含んでいる。   The program storage unit 11 is a memory as a hardware resource in which a program executed by the CPU 15 is stored. For example, a ROM (read only memory) can be used. Here, the program is for realizing the prime number generation function shown in FIG. 3 or FIG. 4, for example. As this prime number generation function, for example, the following functions (f11-1) to (f11-5) are included.

(f11-1) 除数識別情報毎に除数が記憶された除数テーブルTをテーブル記憶部12に予め記憶させる機能。
(f11-2) 乱数生成部16の制御により、第1素数の候補pとして乱数を生成する機能。
(f11-3) 演算部17の制御により、第1素数の候補pに基づいて、第2素数の候補f(p)を算出する第2素数候補算出機能。
(f11-4) 演算部17の制御により、各素数の候補p,f(p)に対し、除数テーブルT内の除数識別情報毎の除数により個別に試行割算を実行する試行割算実行機能。
(f11-5) 演算部17の制御により、除数テーブルT内の全ての除数による全ての試行割算の結果が剰余を持つとき、各素数の候補p,f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定機能。
(f11-1) A function of previously storing a divisor table T in which a divisor is stored for each divisor identification information in the table storage unit 12.
(f11-2) A function for generating a random number as the first prime candidate p under the control of the random number generator 16.
(f11-3) A second prime number candidate calculation function for calculating the second prime number candidate f (p) based on the first prime number candidate p under the control of the calculation unit 17.
(f11-4) Trial division execution function for performing trial division individually for each prime number candidate p, f (p) by divisor for each divisor identification information in the divisor table T under the control of the arithmetic unit 17 .
(f11-5) When the result of all the trial divisions by all the divisors in the divisor table T has a remainder under the control of the arithmetic unit 17, Fermat's small is obtained for each prime candidate p, f (p). Prime number judgment function that executes prime number judgment methods including theorems.

係るプログラムは、外部の記憶媒体又はネットワークから予めプログラム記憶部11にインストールされてもよい。   Such a program may be installed in the program storage unit 11 in advance from an external storage medium or a network.

テーブル記憶部12は、CPU15から読出/書込可能なハードウェア資源としてのRAM(ランダムアクセスメモリ)である。テーブル記憶部12は、予め除数テーブルTが記憶されており、さらにCPU15により、演算に必要なデータや演算途中のデータ等が記憶される。除数テーブルTは、図2に示すように、予め除数識別情報i毎に除数primes[i]が記述されたものである。   The table storage unit 12 is a RAM (Random Access Memory) as a hardware resource that can be read / written from the CPU 15. The table storage unit 12 stores a divisor table T in advance, and the CPU 15 stores data necessary for calculation, data being calculated, and the like. As shown in FIG. 2, the divisor table T is a table in which divisor primes [i] is described in advance for each divisor identification information i.

除数識別情報iは、前述同様に、1,2,…,PRIMES_NUM−1,PRIMES_NUM、のように、自然数としている。なお、ここでは、除数識別情報iの最大値PRIMES_NUMを6542としている。   The divisor identification information i is a natural number such as 1, 2,..., PRIMES_NUM-1, PRIMES_NUM, as described above. Here, the maximum value PRIMES_NUM of the divisor identification information i is set to 6542.

除数primes[i]は、小さい順に数えてi番目の素数である。このような除数の数列に関する説明は、文献(D. E. Knuth 著(中川圭介訳),“KNUTH 第4分冊 準数値算法/算術演算”,サイエンス社,p.205, 1986.)に記載されている。なお、ここでは、除数テーブルTにおける除数の最大値を“65521”としている。また、除数テーブルTは、予めプログラム記憶部11内のプログラムに含まれていてもよい。   The divisor primes [i] is the i-th prime number counted in ascending order. An explanation of such divisor sequences is given in the literature (D. E. Knuth (translated by Keisuke Nakagawa), “KNUTH 4th Volume Quasi-Numerical Arithmetic / Arithmetic Operations”, Science, p. 205, 1986.). Here, the maximum value of the divisor in the divisor table T is “65521”. The divisor table T may be included in advance in the program in the program storage unit 11.

不揮発性メモリ13は、例えば生成された素数p,f(p)などがCPU15から読出/書込可能に記憶されるハードウェア資源としてのメモリであり、例えば、EEPROM(Electric Erasable Programmable ROM)が使用可能となっている。但し、不揮発性メモリ13は、必須ではなく省略してもよい。   The non-volatile memory 13 is a memory as a hardware resource in which generated prime numbers p, f (p), etc. are stored so as to be readable / writable from the CPU 15, for example, an EEPROM (Electric Erasable Programmable ROM) is used. It is possible. However, the nonvolatile memory 13 is not essential and may be omitted.

入出力I/F14は、素数生成装置10と、この素数生成装置10を保持する情報機器との間のインターフェイス機器であり、例えば、素数生成指令を入力し、得られた素数p,f(p)を出力する際に用いられる。   The input / output I / F 14 is an interface device between the prime number generation device 10 and an information device that holds the prime number generation device 10. For example, the prime number generation command is input and the prime numbers p, f (p ) Is output.

ここでいう情報機器としては、何らかの暗号処理を実行するものであれば任意のデバイスが適用可能である。何らかの暗号処理とは、例えば公開鍵暗号方式における暗号処理、復号処理、署名生成処理又は署名検証処理などである。情報機器の例としては、スマートカード又は携帯電話等の如き、ユーザ毎に携帯可能なデバイスが挙げられる。情報機器の用途は任意であり、例えば、非匿名又は匿名のユーザ認証などが挙げられる。   As the information equipment here, any device can be applied as long as it performs some kind of cryptographic processing. Some encryption processing is, for example, encryption processing, decryption processing, signature generation processing, or signature verification processing in a public key cryptosystem. Examples of the information equipment include devices that can be carried by each user, such as smart cards or mobile phones. The usage of the information device is arbitrary, and examples thereof include non-anonymous or anonymous user authentication.

CPU15は、プログラム記憶部11内のプログラムを実行することにより、例えば図3に示す手順で各部12〜17を制御し、素数生成処理を実行する機能を有するものである。   The CPU 15 has a function of executing the prime number generation process by controlling the units 12 to 17 by executing the program in the program storage unit 11, for example, according to the procedure shown in FIG.

乱数生成部16は、CPU15により制御されて乱数pを生成し、この乱数pをバスに送出するハードウェア資源としての乱数生成回路である。ここで、乱数生成部16により生成される乱数pは、真の乱数又は疑似乱数のいずれでもよい。   The random number generation unit 16 is a random number generation circuit as a hardware resource that is controlled by the CPU 15 to generate a random number p and sends the random number p to a bus. Here, the random number p generated by the random number generation unit 16 may be a true random number or a pseudo-random number.

なお、乱数生成部16は、独立のハードウェア資源で実現する場合に限らず、CPU15とプログラムで実現してもよい。また、乱数生成部16を省略し、乱数pを外部から入力させる構成としてもよい。   Note that the random number generation unit 16 is not limited to being realized by independent hardware resources, but may be realized by the CPU 15 and a program. Alternatively, the random number generation unit 16 may be omitted and the random number p may be input from the outside.

演算部17は、CPU15により制御され、例えばCPU15から入力されたデータに基づいて演算を実行し、演算結果をバスに出力するハードウェア資源としての演算回路である。なお、演算部17は、処理速度を向上させる観点から独立のハードウェア回路として設けられており、例えばコプロセッサ等の如き、多倍長の演算が可能なものであるが、ハードウェア回路に限らず、CPU15とプログラムで実現してもよい。   The arithmetic unit 17 is an arithmetic circuit as a hardware resource that is controlled by the CPU 15 and executes an arithmetic operation based on, for example, data input from the CPU 15 and outputs an arithmetic result to a bus. Note that the arithmetic unit 17 is provided as an independent hardware circuit from the viewpoint of improving the processing speed, and can perform multiple-length arithmetic such as a coprocessor, but is not limited to the hardware circuit. Instead, it may be realized by the CPU 15 and a program.

なお、このような素数生成装置10は、ハードウェア及びソフトウェアの組合せに限らず、ハードウェア又はソフトウェアのいずれか一方により構成されてもよい。   Note that such a prime number generation device 10 is not limited to a combination of hardware and software, and may be configured by either hardware or software.

次に、以上のように構成された素数生成装置による素数生成方法を図3及び図4のフローチャートを用いて述べる。始めに、図3により従来との大きな違いを簡単に述べ、しかる後、図4により素数生成方法を説明する。なお、図4による説明は、多項式f(p)を2p+1の形に規定すると、図3による説明に読み替えることができる。   Next, a prime number generation method by the prime number generation apparatus configured as described above will be described with reference to the flowcharts of FIGS. First, a large difference from the prior art will be briefly described with reference to FIG. 3, and then a prime number generation method will be described with reference to FIG. Note that the description of FIG. 4 can be read as the description of FIG. 3 when the polynomial f (p) is defined in the form of 2p + 1.

従来との違いは、図3に示すように、第1素数候補pの本格的素数判定ステップST5を、第1及び第2素数候補p,f(p)の簡易素数判定ステップ(ST1〜ST4及びST6〜ST9)の後に実行することである。これに加え、図4に示すように、従来の第2素数2p+1に代えて第2素数f(p)を生成するため、第2素数f(p)に関連するステップST7’,ST8’,ST10’にはダッシュ記号’を付している。以下、図4を参照しながら順次説明する。   The difference from the prior art is that, as shown in FIG. 3, the full prime number determination step ST5 of the first prime number candidate p is changed to the simple prime number determination steps (ST1 to ST4 and ST and ST) of the first and second prime number candidates p and f (p). This is to be executed after ST6 to ST9). In addition, as shown in FIG. 4, in order to generate the second prime number f (p) instead of the conventional second prime number 2p + 1, steps ST7 ′, ST8 ′, ST10 relating to the second prime number f (p) are generated. 'Is a dash. Hereinafter, this will be described in sequence with reference to FIG.

始めに、図示しない情報機器では、何らかの暗号処理中に、第1素数p及び第2素数f(p)を生成する必要が生じたとする。ここで、情報機器においては、保持する素数生成装置10に入出力I/F14を介して素数生成指令を入力する。   First, it is assumed that an information device (not shown) needs to generate a first prime number p and a second prime number f (p) during some cryptographic processing. Here, in the information device, a prime number generation command is input to the held prime number generation device 10 via the input / output I / F 14.

素数生成装置10においては、素数生成指令を受けると、CPU15が除数識別情報iをi=0として初期化する(ST1)。   In the prime number generation device 10, upon receiving a prime number generation command, the CPU 15 initializes the divisor identification information i as i = 0 (ST1).

続いて、素数生成装置10においては、CPU15が乱数生成部16を制御し、乱数生成部16が、第1素数候補としての乱数pを生成する(ST2)。なお、ステップST1,ST2の順序は逆でもよい。   Subsequently, in the prime number generation device 10, the CPU 15 controls the random number generation unit 16, and the random number generation unit 16 generates a random number p as a first prime number candidate (ST2). Note that the order of steps ST1 and ST2 may be reversed.

次に、素数生成装置10においては、第1素数候補pに対し、予め保持しておいた除数テーブルTを用い、除数識別情報i=1から順次、試行割算を行う(ST3)。   Next, the prime number generation apparatus 10 performs trial division sequentially from the divisor identification information i = 1 using the divisor table T held in advance for the first prime number candidate p (ST3).

具体的には、CPU15は、第1素数候補pと、除数テーブルT内の除数識別情報i毎の除数primes[i]とをバスを介して演算部17に入力する。演算部17は、第1素数候補pを除数primes[i]で割り算し、得られた剰余をバスに出力する。   Specifically, the CPU 15 inputs the first prime candidate p and the divisor primes [i] for each divisor identification information i in the divisor table T to the computing unit 17 via the bus. The arithmetic unit 17 divides the first prime number candidate p by the divisor primes [i] and outputs the obtained remainder to the bus.

CPU15は、第1素数候補pを除数primes[i]で割り算した剰余が0のとき(p÷primes[i]=0)、又は除数識別情報iが最大値PRIMES_NUMの場合の割り算を終えたとき(i=PRIMES_NUM)、ステップST3の試行割算を終了する。   When the remainder obtained by dividing the first prime candidate p by the divisor primes [i] is 0 (p ÷ primes [i] = 0), or when the division when the divisor identification information i is the maximum value PRIMES_NUM is finished (I = PRIMES_NUM), the trial division in step ST3 ends.

CPU15は、ステップST3の試行割算を終了したときの除数識別情報iが最大値PRIMES_NUMであるか否かを判定し(ST4)、否の場合(試行割算に失敗した場合)にはステップST1に戻る。   The CPU 15 determines whether or not the divisor identification information i when the trial division in step ST3 ends is the maximum value PRIMES_NUM (ST4). If not (if trial division fails), step ST1 is performed. Return to.

一方、ステップST4の判定の結果、除数識別情報iが最大値PRIMES_NUMの場合(試行割算に成功した場合)には、CPU15は、除数識別情報iをi=0として初期化する(ST6)。   On the other hand, as a result of the determination in step ST4, when the divisor identification information i is the maximum value PRIMES_NUM (when the trial division is successful), the CPU 15 initializes the divisor identification information i as i = 0 (ST6).

続いて、素数生成装置10においては、CPU15が演算部17を制御し、演算部17が第2素数候補としての多項式f(p)を計算する(ST7’)。具体的には、CPU15は、第1素数候補pと、所定の多項式f(X)の形とに基づいて、次数n,n-1,…,2,1及び次数毎の整数係数an,an-1,…,a2,a1を順次、バスを介して演算部17に入力する。演算部17は、第1素数候補pと、多項式f(X)の次数及び次数毎の整数係数とに基づいて、第1素数候補pに対する次数のベキ乗を計算し、得られたベキ乗結果と整数係数とを乗算し、得られた多項式の変数項をバスを介してRAM(テーブル記憶部12)に書き込む。また、CPU15は、n次から1次までの変数項an・pn,an-1・pn-1,…,a2・p2,a1・pと、定数項a0とをバスを介して演算部17に入力する。演算部17は、これら変数項と、定数項とを加算し、得られた多項式f(p)をバスを介してRAM(テーブル記憶部12)に書き込む。なお、ステップST6,ST7’の順序は逆でもよい。 Subsequently, in the prime number generation device 10, the CPU 15 controls the calculation unit 17, and the calculation unit 17 calculates the polynomial f (p) as the second prime number candidate (ST7 '). Specifically, CPU 15 includes a first prime candidate p, based on the shape of a predetermined polynomial f (X), the order n, n-1, ..., integer coefficient for each 2,1 and order a n, a n−1 ,..., a 2 , a 1 are sequentially input to the arithmetic unit 17 via the bus. The computing unit 17 calculates the power of the degree for the first prime candidate p based on the first prime candidate p, the order of the polynomial f (X), and the integer coefficient for each order, and the obtained power result And the integer coefficient are written, and the variable term of the obtained polynomial is written to the RAM (table storage unit 12) via the bus. Further, the CPU 15 obtains the variable terms a n · p n , a n-1 · p n-1 , ..., a 2 · p 2 , a 1 · p and the constant term a 0 from the nth order to the first order. It inputs to the calculating part 17 via a bus | bath. The arithmetic unit 17 adds the variable term and the constant term, and writes the obtained polynomial f (p) to the RAM (table storage unit 12) via the bus. Note that the order of steps ST6 and ST7 ′ may be reversed.

次に、素数生成装置10においては、この多項式f(p)からなる第2素数候補f(p)に対し、前述同様に、除数テーブルTを用いて試行割算を行う(ST8’)。   Next, the prime number generating apparatus 10 performs trial division on the second prime number candidate f (p) composed of the polynomial f (p) using the divisor table T as described above (ST8 ').

素数生成装置10のCPU15は、第2素数候補f(p)を除数primes[i]で割り算した剰余が0のとき(f(p)÷primes[i]=0)、又は除数識別情報iが最大値PRIMES_NUMの場合の割り算を終えたとき(i=PRIMES_NUM)、ステップST8’の試行割算を終了する。   When the remainder obtained by dividing the second prime candidate f (p) by the divisor primes [i] is 0 (f (p) ÷ primes [i] = 0), the CPU 15 of the prime number generation apparatus 10 or the divisor identification information i is When the division for the maximum value PRIMES_NUM is completed (i = PRIMES_NUM), the trial division in step ST8 ′ is terminated.

CPU15は、ステップST8’の試行割算を終了したときの除数識別情報iが最大値PRIMES_NUMであるか否かを判定し(ST9)、否の場合(試行割算に失敗した場合)にはステップST1に戻る。   The CPU 15 determines whether or not the divisor identification information i when the trial division in step ST8 ′ is completed is the maximum value PRIMES_NUM (ST9). If not (step trial division fails), the step is performed. Return to ST1.

一方、ステップST9の判定の結果、除数識別情報iが最大値PRIMES_NUMの場合(試行割算に成功した場合)、CPU15は、p,f(p)の簡易素数判定(ST1〜ST4,ST6〜ST9)を終了する。換言すると、CPU15は、除数テーブルT内の全ての除数による全ての試行割算の結果が剰余を持つとき、p,f(p)の簡易素数判定(ST1〜ST4,ST6〜ST9)を終了する。   On the other hand, when the divisor identification information i is the maximum value PRIMES_NUM as a result of the determination in step ST9 (when the trial division is successful), the CPU 15 determines simple prime numbers p and f (p) (ST1 to ST4 and ST6 to ST9). ) Ends. In other words, the CPU 15 ends the simple prime number determination (ST1 to ST4, ST6 to ST9) of p and f (p) when the result of all the trial divisions by all the divisors in the divisor table T has a remainder. .

次に、素数生成装置10は、第1素数候補pに対し、フェルマー法などのように、フェルマーの小定理を含む本格的な素数判定法を実行する(ST5)。具体的には、CPU15が所定の素数判定法のアルゴリズムに従って演算部17を制御することにより、素数判定を実行する。   Next, the prime number generation device 10 executes a full-scale prime number determination method including Fermat's small theorem, such as the Fermat method, for the first prime number candidate p (ST5). Specifically, the CPU 15 controls the arithmetic unit 17 according to a predetermined prime number determination algorithm to execute the prime number determination.

ここで、所定の素数判定法としては、高速な判定の観点から、フェルマー(Fermat)の小定理を利用した素数判定法を改良して、あるところまで調べれば、素数候補が素数であることを確率的又は確定的に判定できるようにしたものを用いている。このような素数判定法のうち、確率的な素数判定法の例としては、フェルマー法、ソロベイ(Solovay)ーストラッセン(Strassen)法、ラビン法などが挙げられる。確定的な素数判定法の例としては、ミラー法、アドルマン(Adleman)−ルメリ(Rumely)法、コーエン(Cohen)−レンストラ(Lenstra)法などが挙げられる。ここで述べた素数判定法に関する説明は、文献(池野信一、小山謙二共著、“現代暗号理論”、(社)電子情報通信学会、コロナ社、p240−241、1986)に記載されている。   Here, as a predetermined prime number judgment method, from the viewpoint of high-speed judgment, the prime number judgment method using Fermat's small theorem is improved, and if it is investigated to some extent, the prime number candidate is a prime number. It uses what can be determined probabilistically or deterministically. Among such prime number determination methods, examples of the probabilistic prime number determination method include the Fermat method, the Solovay-Strassen method, and the Rabin method. Examples of deterministic prime number determination methods include the Miller method, the Adleman-Rumely method, the Cohen-Lenstra method, and the like. The explanation of the prime number judgment method described here is described in literature (Shinichi Ikeno and Kenji Koyama, “Contemporary Cryptography”, The Institute of Electronics, Information and Communication Engineers, Corona, p240-241, 1986).

さてステップST5の素数判定の結果、第1素数候補pが素数ではない場合(NGの場合)には、素数生成装置10はステップST1に戻る。   As a result of the prime number determination in step ST5, when the first prime number candidate p is not a prime number (in the case of NG), the prime number generation apparatus 10 returns to step ST1.

ステップST5の素数判定の結果、第1素数候補pが素数である場合(OKの場合)には、素数生成装置10は、第2素数候補f(p)に対し、前述同様に、フェルマー法又はミラー−ラビン法などの、本格的な素数判定を行う(ST10’)。   As a result of the prime number determination in step ST5, when the first prime number candidate p is a prime number (in the case of OK), the prime number generation device 10 applies the Fermat method or the second prime number candidate f (p) as described above. Full-fledged prime number determination such as the Miller-Rabin method is performed (ST10 ').

ステップST10’の素数判定の結果、第2素数候補f(p)が素数ではない場合(NGの場合)には、素数生成装置10はステップST1へ戻る。   As a result of the prime number determination in step ST10 ', if the second prime number candidate f (p) is not a prime number (in the case of NG), the prime number generation apparatus 10 returns to step ST1.

ステップST10’の素数判定の結果、第2素数候補f(p)が素数である場合(OKの場合)には、素数生成装置10は、第2素数f(p)と、第1素数pとを入出力I/F14から出力する。   As a result of the prime number determination in step ST10 ′, when the second prime number candidate f (p) is a prime number (in the case of OK), the prime number generation device 10 generates the second prime number f (p), the first prime number p, Are output from the input / output I / F 14.

上述したように本実施形態によれば、第1素数pと、この第1素数pから算出可能で定数項(a0)が0ではない多項式f(p)(=an・pn + an-1・pn-1 + … + a2・p2 + a1・p + a0)の形をもつ第2素数f(p)とを生成する構成により、セーフプライム形の素数(2p+1)に限定されず、第1素数pの多項式の形をもつ第2素数f(p)を生成することができる。 According to the present embodiment as described above, the first prime number p, the calculation can be constant term from the first prime number p (a 0) is not zero polynomial f (p) (= a n · p n + a n-1 · p n-1 +... + a 2 · p 2 + a 1 · p + a 0 The second prime number f (p) having the polynomial form of the first prime number p can be generated.

これに加え、本実施形態によれば、高速に計算可能な試行割算を先に行った後に、本格的な素数判定法(フェルマーの小定理を含む素数判定法)を行う構成により、時間のかかる本格的な素数判定法の実行割合を減少できるので、前述した第1及び第2素数p,f(p)を高速に生成することができる。   In addition to this, according to the present embodiment, after performing trial division that can be calculated at high speed, a configuration for performing a full-fledged prime number determination method (a prime number determination method including Fermat's little theorem) is used. Since the execution rate of such a full prime number determination method can be reduced, the first and second prime numbers p and f (p) described above can be generated at high speed.

(第2の実施形態)
次に、本発明の第2の実施形態について前述した図1を参照しながら説明する。すなわち、本実施形態は、第1の実施形態の変形例であり、試行割算のサイズを低減して素数生成の高速化を図る観点から、第2素数の候補f(p)に関する試行割算を、剰余kの多項式f(k)に関する試行割算により行うものである。
(Second Embodiment)
Next, a second embodiment of the present invention will be described with reference to FIG. That is, this embodiment is a modification of the first embodiment, and from the viewpoint of reducing the size of trial division and speeding up prime generation, trial division related to the second prime number candidate f (p). Is performed by trial division with respect to the polynomial f (k) of the remainder k.

これに伴い、除数テーブルTは、図5に示すように、予め除数識別情報i毎に除数primes[i]が記憶されており、試行割算結果の剰余k[i]が除数識別情報iに関連付けて記憶されるものとなっている。   Accordingly, as shown in FIG. 5, the divisor table T stores divisor primes [i] for each divisor identification information i in advance, and the remainder k [i] of the trial division result is stored in the divisor identification information i. It is associated and stored.

また、プログラム記憶部11内のプログラムとしては、以下の機能(f11-1’)〜(f11-5)を含むものとなっている。
(f11-1’) 予め除数識別情報毎に除数が記憶されており、試行割算結果の剰余が除数識別情報に関連付けて記憶される除数テーブルTをテーブル記憶部12に書込む機能。
(f11-2) 乱数生成部16の制御により、第1素数の候補pとして乱数を生成する機能。
(f11-6) 演算部17の制御により、第1素数の候補pに対し、除数テーブルT内の除数識別情報毎の除数により個別に試行割算を実行する第1割算実行機能。
(f11-7) 演算部17の制御により、第1割算実行機能による試行割算の結果が剰余kを持つとき、当該剰余kを除数テーブルTに書き込む剰余書込機能。
(f11-8) 演算部17の制御により、剰余書込機能により書き込まれた剰余kに基づいて、多項式f(k)を計算する多項式計算機能。
(f11-9) 演算部17の制御により、多項式f(k)に対し、除数テーブルT内の除数識別情報毎の除数により個別に試行割算を実行する第2割算実行機能。
(f11-5) 演算部17の制御により、除数テーブルT内の全ての除数による全ての試行割算の結果が剰余を持つとき、第1素数の候補p及び第2素数の候補f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定機能。
The program in the program storage unit 11 includes the following functions (f11-1 ′) to (f11-5).
(f11-1 ′) A function of writing a divisor table T in which a divisor is stored in advance for each divisor identification information and the remainder of the trial division result is stored in association with the divisor identification information in the table storage unit 12.
(f11-2) A function for generating a random number as the first prime candidate p under the control of the random number generator 16.
(f11-6) A first division execution function for performing trial division individually on the first prime candidate p by the divisor for each divisor identification information in the divisor table T under the control of the arithmetic unit 17.
(f11-7) A remainder writing function for writing the remainder k to the divisor table T when the result of the trial division by the first division execution function has the remainder k under the control of the computing unit 17.
(f11-8) A polynomial calculation function for calculating the polynomial f (k) based on the remainder k written by the remainder writing function under the control of the calculation unit 17.
(f11-9) A second division execution function for individually performing trial division on the polynomial f (k) by the divisor for each divisor identification information in the divisor table T under the control of the calculation unit 17.
(f11-5) When the result of all trial divisions by all divisors in the divisor table T has a remainder under the control of the arithmetic unit 17, the first prime candidate p and the second prime candidate f (p) On the other hand, a prime number judgment function that executes a prime number judgment method including Fermat's little theorem.

次に、以上のように構成された素数生成装置による素数生成方法を図6及び図7のフローチャートを用いて述べる。始めに、図6により従来との大きな違いを簡単に述べ、しかる後、図7により素数生成方法を説明する。なお、図7による説明は、前述同様に多項式f(p)を2p+1の形に規定すると、図6による説明に読み替えることができる。   Next, a prime number generation method by the prime number generation apparatus configured as described above will be described with reference to the flowcharts of FIGS. First, a large difference from the prior art will be briefly described with reference to FIG. 6, and then a prime number generation method will be described with reference to FIG. The description with reference to FIG. 7 can be read as the description with reference to FIG. 6 when the polynomial f (p) is defined in the form of 2p + 1 as described above.

従来との違いは、図6に示すように、第1素数候補pの本格的素数判定ステップST5を、第2素数候補f(p)の本格的素数判定ステップST10の直前に実行することと、多倍長精度(素数候補pの2倍)の簡易素数判定ステップ(ST1〜ST4及びST6〜ST9)に代えて、ワードサイズ(剰余kの2倍、除数primes[i])の簡易素数判定ステップ(ST20)を実行することとである。これに加え、図7に示すように、従来の第2素数2p+1に代えて多項式f(p)又はf(k)を生成するため、多項式f(p),f(k)に関連するステップST10’,ST23’及びST24’にはダッシュ記号’を付している。以下、図7を参照しながら順次説明する。   The difference from the prior art is that, as shown in FIG. 6, the full prime number determination step ST5 of the first prime number candidate p is executed immediately before the full prime number judgment step ST10 of the second prime number candidate f (p), Instead of simple prime number determination steps (ST1 to ST4 and ST6 to ST9) with multiple precision (twice the prime candidate p), simple prime number determination steps of word size (twice the remainder k, divisor primes [i]) (ST20) is executed. In addition, as shown in FIG. 7, in order to generate the polynomial f (p) or f (k) instead of the conventional second prime number 2p + 1, step ST10 related to the polynomials f (p) and f (k) is generated. ', ST23' and ST24 'are given a dash symbol. Hereinafter, description will be made sequentially with reference to FIG.

今、前述同様に、素数生成装置10においては、除数識別情報iをi=0として初期化し(ST1)、第1素数候補としての乱数pを生成したとする(ST2)。なお、前述同様に、ステップST1,ST2の順序は逆でもよい。   Now, as described above, in the prime number generating apparatus 10, it is assumed that the divisor identification information i is initialized as i = 0 (ST1) and the random number p as the first prime number candidate is generated (ST2). As described above, the order of steps ST1 and ST2 may be reversed.

次に、素数生成装置10においては、以下のステップST21〜ST25からなる試行割算を実行する(ST20’)。   Next, the prime number generation apparatus 10 executes trial division including the following steps ST21 to ST25 (ST20 ').

すなわち、素数生成装置10においては、第1素数候補pに対し、予め保持しておいた除数テーブルTを用い、除数識別情報i=1から順次、試行割算を行って剰余kを求める(ST21)。具体的には、CPU15は、第1素数候補pと、除数テーブルT内の除数識別情報i毎の除数primes[i]とをバスを介して演算部17に入力する。演算部17は、第1素数候補pを除数primes[i]で割り算し、得られた剰余k(=p÷primes[i])をバスに出力する。   That is, the prime number generation apparatus 10 obtains the remainder k by performing trial division sequentially from the divisor identification information i = 1 using the divisor table T held in advance for the first prime number candidate p (ST21). ). Specifically, the CPU 15 inputs the first prime candidate p and the divisor primes [i] for each divisor identification information i in the divisor table T to the computing unit 17 via the bus. The arithmetic unit 17 divides the first prime candidate p by the divisor primes [i], and outputs the obtained remainder k (= p ÷ primes [i]) to the bus.

CPU15は、この剰余kが零でない(k≠0)か否かを判定し(ST22)、否の場合(k=0の場合)、ステップST1に戻る。   The CPU 15 determines whether or not the remainder k is not zero (k ≠ 0) (ST22). If not (if k = 0), the CPU 15 returns to step ST1.

一方、ステップST22の判定の結果、剰余kが零でない場合(k≠0の場合)には、CPU15は、剰余kを対応する除数識別情報iに関連付けて除数テーブルTに書き込む。   On the other hand, if the result of the determination in step ST22 is that the remainder k is not zero (when k ≠ 0), the CPU 15 writes the remainder k in the divisor table T in association with the corresponding divisor identification information i.

しかる後、素数生成装置10においては、CPU15が演算部17を制御し、演算部17が剰余kに基づいて多項式f(k)を計算する(ST23’)。具体的には、CPU15は、剰余kと、所定の多項式f(X)の形とに基づいて、次数n,n-1,…,2,1及び次数毎の整数係数an,an-1,…,a2,a1を順次、バスを介して演算部17に入力する。演算部17は、剰余kと、多項式f(X)の次数及び次数毎の整数係数とに基づいて、剰余kに対する次数のベキ乗を計算し、得られたベキ乗結果と整数係数とを乗算し、得られた多項式の変数項をバスを介してRAM(テーブル記憶部12)に書き込む。また、CPU15は、n次から1次までの変数項an・kn,an-1・kn-1,…,a2・k2,a1・kと、定数項a0とをバスを介して演算部17に入力する。演算部17は、これら変数項と、定数項とを加算し、得られた多項式f(k)をバスを介してRAM(テーブル記憶部12)に書き込む。 Thereafter, in the prime number generating apparatus 10, the CPU 15 controls the calculation unit 17, and the calculation unit 17 calculates the polynomial f (k) based on the remainder k (ST23 '). Specifically, CPU 15 includes a remainder k, on the basis of the shape of a predetermined polynomial f (X), the order n, n-1, ..., integer coefficient for each 2,1 and order a n, a n- 1 ,..., A 2 , a 1 are sequentially input to the arithmetic unit 17 via the bus. The computing unit 17 calculates the power of the degree with respect to the remainder k based on the remainder k, the order of the polynomial f (X), and the integer coefficient for each order, and multiplies the obtained power result and the integer coefficient. Then, the obtained polynomial variable term is written to the RAM (table storage unit 12) via the bus. Further, CPU 15 is variable term a n · k n from the n-th order to first order, a n-1 · k n -1, ..., and a 2 · k 2, a 1 · k, a constant term a 0 The data is input to the arithmetic unit 17 via the bus. The arithmetic unit 17 adds the variable term and the constant term, and writes the obtained polynomial f (k) to the RAM (table storage unit 12) via the bus.

次に、素数生成装置10においては、この多項式f(k)に対し、前述同様に、除数テーブルTを用いて試行割算を行う。なお、この多項式f(k)を試行割算して得られる剰余は、前述した多項式f(p)を試行割算して得られる剰余と同じ値になる。このため、本実施形態の試行割算の方が演算サイズを低減できる利点がある。   Next, the prime number generation apparatus 10 performs trial division on the polynomial f (k) using the divisor table T as described above. The remainder obtained by trial division of the polynomial f (k) is the same value as the remainder obtained by trial division of the polynomial f (p) described above. For this reason, the trial division of this embodiment has an advantage that the calculation size can be reduced.

試行割算の後、素数生成装置10のCPU15は、多項式f(k)を除数primes[i]で割り算した剰余が零でない(f(k)÷primes[i]≠0)か否かを判定する(ST24’)。   After the trial division, the CPU 15 of the prime number generation apparatus 10 determines whether the remainder obtained by dividing the polynomial f (k) by the divisor primes [i] is not zero (f (k) ÷ primes [i] ≠ 0). (ST24 ').

ステップST24’の判定の結果、否の場合(f(k)÷primes[i]=0の場合)、ステップST1に戻る。   If the result of determination in step ST24 'is negative (if f (k) ÷ primes [i] = 0), the process returns to step ST1.

一方、ステップST24’の判定の結果、零でない場合(f(k)÷primes[i]≠0の場合)には、CPU15は、除数識別情報iを+1だけ更新し(ST25)、ステップST21に戻って処理を継続する。   On the other hand, if the result of determination in step ST24 ′ is not zero (if f (k) ÷ primes [i] ≠ 0), the CPU 15 updates the divisor identification information i by +1 (ST25), and proceeds to step ST21. Return and continue processing.

このステップST21〜ST25までの処理(ST20’)は、除数識別情報iが最大値PRIMES_NUMである場合のST24’の処理を終了するまで継続される。   The process (ST20 ') from step ST21 to ST25 is continued until the process of ST24' when the divisor identification information i is the maximum value PRIMES_NUM is completed.

CPU15は、ステップST24’の処理を終了したときの除数識別情報iが最大値PRIMES_NUMである場合には、ステップST20’の処理を終了する。換言すると、CPU15は、除数テーブルT内の全ての除数による全ての試行割算の結果が剰余を持つとき、p,f(p)の簡易素数判定(ST20’)を終了する。   When the divisor identification information i when the process of step ST24 'is completed is the maximum value PRIMES_NUM, the CPU 15 ends the process of step ST20'. In other words, the CPU 15 ends the simple prime number determination (ST20 ') of p and f (p) when the result of all the trial divisions by all the divisors in the divisor table T has a remainder.

続いて、素数生成装置10は、第1素数候補pに対し、フェルマー法などのように、フェルマーの小定理を含む本格的な素数判定法を実行する(ST5)。具体的には、CPU15が、前述した所定の素数判定法のアルゴリズムに従って演算部17を制御することにより、素数判定を実行する。   Subsequently, the prime number generation device 10 executes a full-scale prime number determination method including Fermat's small theorem, such as the Fermat method, for the first prime number candidate p (ST5). Specifically, the CPU 15 executes the prime number determination by controlling the arithmetic unit 17 according to the algorithm of the predetermined prime number determination method described above.

さてステップST5の素数判定の結果、第1素数候補pが素数ではない場合(NGの場合)には、素数生成装置10はステップST1に戻る。   As a result of the prime number determination in step ST5, when the first prime number candidate p is not a prime number (in the case of NG), the prime number generation apparatus 10 returns to step ST1.

ステップST5の素数判定の結果、第1素数候補pが素数である場合(OKの場合)には、素数生成装置10は、第2素数候補f(p)を計算する。しかる後、素数生成装置10は、この第2素数候補f(p)に対し、前述同様に、フェルマー法又はミラー−ラビン法などの、本格的な素数判定法を実行する(ST10’)。   As a result of the prime number determination in step ST5, when the first prime number candidate p is a prime number (in the case of OK), the prime number generation device 10 calculates the second prime number candidate f (p). Thereafter, the prime number generating apparatus 10 executes a full-fledged prime number determination method such as Fermat method or Miller-Rabin method on the second prime number candidate f (p) as described above (ST10 ').

ステップST10’の素数判定の結果、第2素数候補f(p)が素数ではない場合(NGの場合)には、素数生成装置10はステップST1へ戻る。   As a result of the prime number determination in step ST10 ', if the second prime number candidate f (p) is not a prime number (in the case of NG), the prime number generation apparatus 10 returns to step ST1.

ステップST10’の素数判定の結果、第2素数候補f(p)が素数である場合(OKの場合)には、素数生成装置10は、第2素数f(p)と、第1素数pとを入出力I/F14から出力する。   As a result of the prime number determination in step ST10 ′, when the second prime number candidate f (p) is a prime number (in the case of OK), the prime number generation device 10 generates the second prime number f (p), the first prime number p, Are output from the input / output I / F 14.

上述したように本実施形態によれば、第1の実施形態の効果に加え、第2素数の候補f(p)に関する試行割算を、剰余kの多項式f(k)に関する試行割算により行う構成により、従来の多倍長精度の試行割算とは異なり、ワードサイズの試行割算を実行できるので、第1及び第2素数p,f(p)をより一層高速に生成することができる。   As described above, according to the present embodiment, in addition to the effects of the first embodiment, the trial division for the second prime candidate f (p) is performed by the trial division for the polynomial f (k) of the remainder k. Unlike the conventional multiple precision trial division, the configuration allows execution of word size trial division, so that the first and second prime numbers p and f (p) can be generated even faster. .

なお、上記実施形態に記載した手法は、コンピュータに実行させることのできるプログラムとして、磁気ディスク(フロッピー(登録商標)ディスク、ハードディスクなど)、光ディスク(CD−ROM、DVDなど)、光磁気ディスク(MO)、半導体メモリなどの記憶媒体に格納して頒布することもできる。   Note that the method described in the above embodiment includes a magnetic disk (floppy (registered trademark) disk, hard disk, etc.), an optical disk (CD-ROM, DVD, etc.), a magneto-optical disk (MO) as programs that can be executed by a computer. ), And can be distributed in a storage medium such as a semiconductor memory.

また、この記憶媒体としては、プログラムを記憶でき、かつコンピュータが読み取り可能な記憶媒体であれば、その記憶形式は何れの形態であっても良い。   In addition, as long as the storage medium can store a program and can be read by a computer, the storage format may be any form.

また、記憶媒体からコンピュータにインストールされたプログラムの指示に基づきコンピュータ上で稼働しているOS(オペレーティングシステム)や、データベース管理ソフト、ネットワークソフト等のMW(ミドルウェア)等が上記実施形態を実現するための各処理の一部を実行しても良い。   In addition, an OS (operating system) running on a computer based on an instruction of a program installed in the computer from a storage medium, MW (middleware) such as database management software, network software, and the like realize the above-described embodiment. A part of each process may be executed.

さらに、本発明における記憶媒体は、コンピュータと独立した媒体に限らず、LANやインターネット等により伝送されたプログラムをダウンロードして記憶または一時記憶した記憶媒体も含まれる。   Further, the storage medium in the present invention is not limited to a medium independent of a computer, but also includes a storage medium in which a program transmitted via a LAN, the Internet, or the like is downloaded and stored or temporarily stored.

また、記憶媒体は1つに限らず、複数の媒体から上記実施形態における処理が実行される場合も本発明における記憶媒体に含まれ、媒体構成は何れの構成であっても良い。   Further, the number of storage media is not limited to one, and the case where the processing in the above embodiment is executed from a plurality of media is also included in the storage media in the present invention, and the media configuration may be any configuration.

尚、本発明におけるコンピュータは、記憶媒体に記憶されたプログラムに基づき、上記実施形態における各処理を実行するものであって、パソコン等の1つからなる装置、複数の装置がネットワーク接続されたシステム等の何れの構成であっても良い。   The computer according to the present invention executes each process in the above-described embodiment based on a program stored in a storage medium, and is a single device such as a personal computer or a system in which a plurality of devices are connected to a network. Any configuration may be used.

また、本発明におけるコンピュータとは、パソコンに限らず、情報処理機器に含まれる演算処理装置、マイコン等も含み、プログラムによって本発明の機能を実現することが可能な機器、装置を総称している。   In addition, the computer in the present invention is not limited to a personal computer, but includes an arithmetic processing device, a microcomputer, and the like included in an information processing device, and is a generic term for devices and devices that can realize the functions of the present invention by a program. .

なお、本願発明は、上記実施形態そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で構成要素を変形して具体化できる。また、上記実施形態に開示されている複数の構成要素の適宜な組合せにより種々の発明を形成できる。例えば、実施形態に示される全構成要素から幾つかの構成要素を削除してもよい。更に、異なる実施形態に亘る構成要素を適宜組合せてもよい。   Note that the present invention is not limited to the above-described embodiment as it is, and can be embodied by modifying the constituent elements without departing from the scope of the invention in the implementation stage. In addition, various inventions can be formed by appropriately combining a plurality of components disclosed in the embodiment. For example, some components may be deleted from all the components shown in the embodiment. Furthermore, constituent elements over different embodiments may be appropriately combined.

本発明の第1の実施形態に係る素数生成装置の構成を示す模式図である。It is a schematic diagram which shows the structure of the prime number generator which concerns on the 1st Embodiment of this invention. 同実施形態における除数テーブルの構成を説明するための模式図である。It is a schematic diagram for demonstrating the structure of the divisor table in the embodiment. 同実施形態における素数生成方法を説明するためのフローチャートである。It is a flowchart for demonstrating the prime number generation method in the embodiment. 同実施形態における素数生成方法を説明するためのフローチャートである。It is a flowchart for demonstrating the prime number generation method in the embodiment. 本発明の第2の実施形態における除数テーブルの構成を説明するための模式図である。It is a schematic diagram for demonstrating the structure of the divisor table in the 2nd Embodiment of this invention. 同実施形態における素数生成方法を説明するためのフローチャートである。It is a flowchart for demonstrating the prime number generation method in the embodiment. 同実施形態における素数生成方法を説明するためのフローチャートである。It is a flowchart for demonstrating the prime number generation method in the embodiment. 一般的な素数生成方法を説明するためのフローチャートである。It is a flowchart for demonstrating the general prime number generation method.

符号の説明Explanation of symbols

10…素数生成装置、11…プログラム記憶部、12…テーブル記憶部、13…不揮発性メモリ、14…入出力I/F、15…CPU、16…乱数生成部、17…演算部、T…除算テーブル。   DESCRIPTION OF SYMBOLS 10 ... Prime number generator, 11 ... Program storage part, 12 ... Table storage part, 13 ... Non-volatile memory, 14 ... Input-output I / F, 15 ... CPU, 16 ... Random number generation part, 17 ... Calculation part, T ... Division table.

Claims (6)

定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、ZはXを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成する素数生成装置であって、
予め除数識別情報毎に除数が記憶された除数記憶手段と、
前記第1素数の候補pとして乱数を生成する乱数生成手段と、
前記第1素数の候補pに基づいて、前記第2素数の候補f(p)を算出する第2素数候補算出手段と、
前記各素数の候補p,f(p)に対し、前記除数記憶手段内の除数識別情報毎の除数により個別に試行割算を実行する試行割算実行手段と、
前記除数記憶手段内の全ての除数による全ての試行割算の結果が剰余を持つとき、前記各素数の候補p,f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定手段と、
を備えたことを特徴とする素数生成装置。
For an integer coefficient polynomial f (X) ∈Z [X] where the constant term is not 0 (where X is an arbitrary integer, Z is a set whose elements are X), the first prime number p (∈Z) and A prime number generating device for generating a second prime number f (p) (εZ) that can be calculated from the first prime number p,
A divisor storage means in which a divisor is stored in advance for each divisor identification information;
Random number generating means for generating a random number as the first prime number candidate p;
Second prime number candidate calculating means for calculating the second prime number candidate f (p) based on the first prime number candidate p;
Trial division execution means for individually performing trial division for each prime number candidate p, f (p) by a divisor for each divisor identification information in the divisor storage means;
A prime number for executing a prime number determination method including Fermat's small theorem for each prime number candidate p, f (p) when the result of all trial divisions by all divisors in the divisor storage means has a remainder A determination means;
A prime number generating apparatus comprising:
定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、ZはXを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成する素数生成装置であって、
予め除数識別情報毎に除数が記憶されており、試行割算結果の剰余が前記除数識別情報に関連付けて記憶される除数記憶手段と、
前記第1素数の候補pとして乱数を生成する乱数生成手段と、
前記第1素数の候補pに対し、前記除数記憶手段内の除数識別情報毎の除数により個別に試行割算を実行する第1割算実行手段と、
前記第1割算実行手段による試行割算の結果が剰余kを持つとき、当該剰余kを前記除数記憶手段に書き込む剰余書込手段と、
前記剰余書込手段により書き込まれた剰余kに基づいて、前記多項式f(k)を計算する多項式計算手段と、
前記多項式f(k)に対し、前記除数記憶手段内の除数識別情報毎の除数により個別に試行割算を実行する第2割算実行手段と、
前記除数記憶手段内の全ての除数による全ての試行割算の結果が剰余を持つとき、前記第1素数の候補p及び前記第2素数の候補f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定手段と、
を備えたことを特徴とする素数生成装置。
For an integer coefficient polynomial f (X) ∈Z [X] where the constant term is not 0 (where X is an arbitrary integer, Z is a set whose elements are X), the first prime number p (∈Z) and A prime number generating device for generating a second prime number f (p) (εZ) that can be calculated from the first prime number p,
A divisor is stored in advance for each divisor identification information, and a divisor storage means for storing a remainder of the trial division result in association with the divisor identification information;
Random number generating means for generating a random number as the first prime number candidate p;
First division execution means for individually performing trial division on the first prime number candidate p by a divisor for each divisor identification information in the divisor storage means;
When the result of trial division by the first division execution means has a remainder k, a remainder writing means for writing the remainder k into the divisor storage means;
Polynomial calculation means for calculating the polynomial f (k) based on the remainder k written by the remainder writing means;
Second division execution means for individually performing trial division on the polynomial f (k) by a divisor for each divisor identification information in the divisor storage means;
When the result of all trial divisions by all divisors in the divisor storage means has a remainder, Fermat's little theorem is included for the first prime number candidate p and the second prime number candidate f (p). A prime number judging means for executing a prime number judging method;
A prime number generating apparatus comprising:
定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、ZはXを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成する素数生成装置のプログラムであって、
前記素数生成装置のコンピュータを、
予め除数識別情報毎に除数が記憶された除数記憶手段、
前記第1素数の候補pとして乱数を生成する乱数生成手段、
前記第1素数の候補pに基づいて、前記第2素数の候補f(p)を算出する第2素数候補算出手段、
前記各素数の候補p,f(p)に対し、前記除数記憶手段内の除数識別情報毎の除数により個別に試行割算を実行する試行割算実行手段、
前記除数記憶手段内の全ての除数による全ての試行割算の結果が剰余を持つとき、前記各素数の候補p,f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定手段、
として機能させるためのプログラム。
For an integer coefficient polynomial f (X) ∈Z [X] where the constant term is not 0 (where X is an arbitrary integer, Z is a set whose elements are X), the first prime number p (∈Z) and A program of a prime number generating device for generating a second prime number f (p) (εZ) that can be calculated from the first prime number p,
A computer of the prime number generating device;
A divisor storage means in which a divisor is stored in advance for each divisor identification information;
Random number generating means for generating a random number as the first prime candidate p,
Second prime number candidate calculating means for calculating the second prime number candidate f (p) based on the first prime number candidate p;
Trial division execution means for individually performing trial division for each prime number candidate p, f (p) by a divisor for each divisor identification information in the divisor storage means;
A prime number for executing a prime number determination method including Fermat's small theorem for each prime number candidate p, f (p) when the result of all trial divisions by all divisors in the divisor storage means has a remainder Determination means,
Program to function as.
定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、ZはXを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成する素数生成装置のプログラムであって、
前記素数生成装置のコンピュータを、
予め除数識別情報毎に除数が記憶されており、試行割算結果の剰余が前記除数識別情報に関連付けて記憶される除数記憶手段、
前記第1素数の候補pとして乱数を生成する乱数生成手段、
前記第1素数の候補pに対し、前記除数記憶手段内の除数識別情報毎の除数により個別に試行割算を実行する第1割算実行手段、
前記第1割算実行手段による試行割算の結果が剰余kを持つとき、当該剰余kを前記除数記憶手段に書き込む剰余書込手段、
前記剰余書込手段により書き込まれた剰余kに基づいて、前記多項式f(k)を計算する多項式計算手段、
前記多項式f(k)に対し、前記除数記憶手段内の除数により個別に試行割算を実行する第2割算実行手段、
前記除数記憶手段内の全ての除数による全ての試行割算の結果が剰余を持つとき、前記第1素数の候補p及び前記第2素数の候補f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定手段、
として機能させるためのプログラム。
For an integer coefficient polynomial f (X) ∈Z [X] where the constant term is not 0 (where X is an arbitrary integer, Z is a set whose elements are X), the first prime number p (∈Z) and A program of a prime number generating device for generating a second prime number f (p) (εZ) that can be calculated from the first prime number p,
A computer of the prime number generating device;
A divisor storage unit in which a divisor is stored in advance for each divisor identification information, and a remainder of the trial division result is stored in association with the divisor identification information;
Random number generating means for generating a random number as the first prime candidate p,
First division execution means for individually performing trial division on the first prime number candidate p by a divisor for each divisor identification information in the divisor storage means;
When the result of trial division by the first division execution means has a remainder k, a remainder writing means for writing the remainder k to the divisor storage means;
Polynomial calculating means for calculating the polynomial f (k) based on the remainder k written by the remainder writing means;
Second division execution means for individually performing trial division on the polynomial f (k) by a divisor in the divisor storage means;
When the result of all trial divisions by all divisors in the divisor storage means has a remainder, Fermat's little theorem is included for the first prime number candidate p and the second prime number candidate f (p). A prime number judging means for executing a prime number judging method;
Program to function as.
定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、ZはXを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成する素数生成装置が実行する素数生成方法であって、
予め除数識別情報毎に除数をメモリに記憶する除数記憶工程と、
前記第1素数の候補pとして乱数を生成する乱数生成工程と、
前記第1素数の候補pに基づいて、前記第2素数の候補f(p)を算出する第2素数候補算出工程と、
前記各素数の候補p,f(p)に対し、前記メモリ内の除数識別情報毎の除数により個別に試行割算を実行する試行割算実行工程と、
前記メモリ内の全ての除数による全ての試行割算の結果が剰余を持つとき、前記各素数の候補p,f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定工程と、
を備えたことを特徴とする素数生成方法。
For an integer coefficient polynomial f (X) ∈Z [X] where the constant term is not 0 (where X is an arbitrary integer, Z is a set whose elements are X), the first prime number p (∈Z) and A prime number generation method executed by a prime number generation device that generates a second prime number f (p) (εZ) that can be calculated from the first prime number p,
A divisor storage step for storing a divisor in memory for each divisor identification information in advance;
A random number generation step of generating a random number as the first prime candidate p;
A second prime number candidate calculating step of calculating the second prime number candidate f (p) based on the first prime number candidate p;
A trial division execution step of individually performing trial division on each prime candidate p, f (p) by a divisor for each divisor identification information in the memory;
A prime number determining step of executing a prime number determination method including Fermat's little theorem for each prime number candidate p, f (p) when the result of all trial divisions by all divisors in the memory has a remainder When,
A prime number generation method characterized by comprising:
定数項が0ではない、整数係数の多項式f(X)∈Z[X]に対し(但し、Xは任意の整数、ZはXを要素とする集合)、第1素数p(∈Z)と、この第1素数pから算出可能な第2素数f(p)(∈Z)とを生成する素数生成装置が実行する素数生成方法であって、
予め除数識別情報毎に除数をメモリに記憶する除数記憶工程と、
前記第1素数の候補pとして乱数を生成する乱数生成工程と、
前記第1素数の候補pに対し、前記メモリ内の除数識別情報毎の除数により個別に試行割算を実行する第1割算実行工程と、
前記第1割算実行工程による試行割算の結果が剰余kを持つとき、当該剰余kを前記除数識別情報に関連付けて前記メモリに書き込む剰余書込工程と、
前記メモリに書き込まれた剰余kに基づいて、前記多項式f(k)を計算する多項式計算工程と、
前記多項式f(k)に対し、前記メモリ内の除数識別情報毎の除数により個別に試行割算を実行する第2割算実行工程と、
前記メモリ内の全ての除数による全ての試行割算の結果が剰余を持つとき、前記第1素数の候補p及び前記第2素数の候補f(p)に対し、フェルマーの小定理を含む素数判定法を実行する素数判定工程と、
を備えたことを特徴とする素数生成方法。
For an integer coefficient polynomial f (X) ∈Z [X] where the constant term is not 0 (where X is an arbitrary integer, Z is a set whose elements are X), the first prime number p (∈Z) and A prime number generation method executed by a prime number generation device that generates a second prime number f (p) (εZ) that can be calculated from the first prime number p,
A divisor storage step for storing a divisor in memory for each divisor identification information in advance;
A random number generation step of generating a random number as the first prime candidate p;
A first division execution step of individually performing trial division on the first prime number candidate p by a divisor for each divisor identification information in the memory;
When the result of the trial division by the first division execution step has a remainder k, a remainder writing step of writing the remainder k in the memory in association with the divisor identification information;
A polynomial calculation step of calculating the polynomial f (k) based on the remainder k written in the memory;
A second division execution step of individually performing trial division on the polynomial f (k) by a divisor for each divisor identification information in the memory;
When the result of all trial divisions by all the divisors in the memory has a remainder, the prime number determination including Fermat's small theorem for the first prime number candidate p and the second prime number candidate f (p) A prime number determining step for executing the method;
A prime number generation method characterized by comprising:
JP2006036779A 2006-02-14 2006-02-14 Prime number generation device, program and method Withdrawn JP2007218997A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006036779A JP2007218997A (en) 2006-02-14 2006-02-14 Prime number generation device, program and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006036779A JP2007218997A (en) 2006-02-14 2006-02-14 Prime number generation device, program and method

Publications (1)

Publication Number Publication Date
JP2007218997A true JP2007218997A (en) 2007-08-30

Family

ID=38496408

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006036779A Withdrawn JP2007218997A (en) 2006-02-14 2006-02-14 Prime number generation device, program and method

Country Status (1)

Country Link
JP (1) JP2007218997A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007334038A (en) * 2006-06-15 2007-12-27 Toshiba Corp Prime number generation program
KR101731921B1 (en) 2017-02-20 2017-05-02 국방과학연구소 Hardware-wired apparatus and method of discriminating prime numbers
KR20180092848A (en) * 2017-02-09 2018-08-20 한양대학교 산학협력단 Method and apparatus for searching for optimal combination of prime number test method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007334038A (en) * 2006-06-15 2007-12-27 Toshiba Corp Prime number generation program
KR20180092848A (en) * 2017-02-09 2018-08-20 한양대학교 산학협력단 Method and apparatus for searching for optimal combination of prime number test method
KR101731921B1 (en) 2017-02-20 2017-05-02 국방과학연구소 Hardware-wired apparatus and method of discriminating prime numbers

Similar Documents

Publication Publication Date Title
RU2691874C2 (en) Method of protecting information in cloud computing using homomorphic encryption
JP5328186B2 (en) Data processing system and data processing method
JP4334582B2 (en) Secret sharing apparatus, method and program
JP5488596B2 (en) Signature device, signature verification device, anonymous authentication system, signature method, signature authentication method, and programs thereof
Harrison et al. Efficient acceleration of asymmetric cryptography on graphics hardware
EP3127271B1 (en) Obfuscated performance of a predetermined function
Farzam et al. Implementation of supersingular isogeny-based Diffie-Hellman and key encapsulation using an efficient scheduling
JP4351987B2 (en) Montgomery conversion device, arithmetic device, IC card, encryption device, decryption device, and program
TWI686722B (en) Exponent splitting for cryptographic operations
JP2007218997A (en) Prime number generation device, program and method
CN109818944B (en) Cloud data outsourcing and integrity verification method and device supporting preprocessing
CN107320959B (en) Game role identification information generation method, device, medium and electronic equipment
CN116318660A (en) Message expansion and compression method and related device
Shoufan et al. A novel cryptoprocessor architecture for chained Merkle signature scheme
Joux A Tutorial on High Performance Computing Applied to Cryptanalysis: (Invited Talk Abstract)
JP4836676B2 (en) Prime number generator
JP2021081591A (en) Safety evaluation device, safety evaluation method, and safety evaluation program
CN112906059A (en) Proxy signature and verification method, device, system and storage medium
JP4664514B2 (en) Prime number generating apparatus and program
JP4802228B2 (en) Key generation apparatus and program
JP5964759B2 (en) Calculation system
JP6881588B2 (en) Secret calculators, secret calculators, programs, and recording media
Elkabbany et al. Lightweight Computational Complexity Stepping Up the NTRU Post-Quantum Algorithm Using Parallel Computing. Symmetry 2024, 16, 12
JP2006235416A (en) Device for computing scalar multiplication in elliptic curve cryptosystem, and program for the same
Téllez et al. Supersingular Isogeny and Ring Learning With Errors-Based Diffie-Hellman Cryptosystems: A Performance and Security Comparison

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20090512