Example Prime.each(100)do|prime|pprime#=>2,3,5,7,11,....,97end PrimeisEnumerable: Prime.first5#=>[2,3,5,7,11
classPrime::EratosthenesGenerator Parent:Prime::PseudoPrimeGenerator AnimplementationofPseudoPrimeGenerator
Singleton Internaluse.Animplementationoferatosthenes'sieve PublicClassMethods new()Showsource #Filelib/prime.rb
PublicClassMethods new(ubound=nil)Showsource #Filelib/prime.rb,line233definitialize(ubound=nil)@ubound
#Filelib/prime.rb,line400def[](index)whileindex>=@primes.length#Onlycheckforprimefactorsuptothesquarerootofthepotentialprimes
classPrime::TrialDivisionGenerator Parent:Prime::PseudoPrimeGenerator AnimplementationofPseudoPrimeGeneratorwhichusesaprimetablegeneratedbytrialdivision
gmp_prob_prime (PHP4>=4.0.4,PHP5,PHP7) gmp_prob_prime-检查数字是否“可能是最好的” 描述 intgmp_prob_prime(GMP$a[,int$
classPrime::Generator23 Parent:Prime::PseudoPrimeGenerator Generatesallintegerswhicharegreaterthan2andarenotdivisiblebyeither2or3
php$prime1 = gmp_nextprime(10); // next prime number greater than 10$prime2 = gmp_nextprime(-1000); /
两个最广泛标准化/支持的曲线是prime256v1(NISTP-256)和secp384r1(NISTP-384)。
类OpenSSL::BN 父类:ObjectIncluded模块:可比较 公共类方法 generate_prime(bits,[,safe[,add,rem]])→bn显示源代码 生成一个随机的素数位长度
PublicClassMethods each_prime(ubound){|prime|...}Showsource 遍历所有素数的给定块。 有关Prime更多详细信息,请参阅#each。
funcPrime(查看源代码) funcPrime(randio.Reader,bitsint)(p*big.Int,errerror) Prime返回给定大小的数字p,使得p以高概率为素数。
#'RSAPrivateKey'{version,%two-prime|multimodulus,%integer()publicExponent,%integer()privateExponent,%
> 上面的例子将输出: 315 ←gmp_prob_prime gmp_random_range→
> 上面的例子将输出: 2147483648 ←gmp_pow gmp_prob_prime→
crypto.createDiffieHellman(prime_length,generator) 创建一个Diffie-Hellman密钥交换(Diffie-Hellmankeyexchange)对象
或更高版本时,可以指定多条曲线(1.11.0),例如: ssl_ecdh_curveprime256v1:secp384r1; 特殊值auto(1.11.0)指示nginx在使用OpenSSL1.0.2或更高prime256v1
密钥交换 ec1=OpenSSL::PKey::EC.generate("prime256v1")ec2=OpenSSL::PKey::EC.generate("prime256v1")#ec1andec2haveownprivatekeyrespectivelyshared_key1
private_key = openssl_pkey_new(array( "private_key_type" => OPENSSL_KEYTYPE_EC, "curve_name" => 'prime256v1