⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.germtest

📁 包含哈希,对称以及非对称的经典算法 包含经典事例
💻 GERMTEST
字号:
Test driver for Sophie Germain prime generation.Generating Sophie Germain primes is the most computationally expensivething the math library does at present.  Sophie Germain primes,(also known as "strong primes," although that term is used to meana variety of thints) are odd primes p such that q = (p-1)/2 is alsoprime.  It can take a *long* time to fine large (2000-bit andup) primes.The command line is a seed string which is used, along with acompiled-in list of prime sizes, to generate the initial search pointfor the prime.  The first (probable) prime after that point isprinted.germtest Hello, worldgermtest `cat /etc/motd`With the "Hello, world" seed, you will see the uncertainty in thegeneration time, as a 1024-bit prime is generated much faster than a768-bit prime.The random-number generator used internally is George Marsaglia'smultiply-with-carry "mother of all random number generators", whichhas an interesting relationship to Sophie Germain primes.The generator is based on the recurrence:(carry, x[i]) = carry + a1 * x[i-1] + a2 * x[i-2] + ... + ak * x[i-k].Where x[i] is the result modulo some base b (in germtest.c, b = 65536),and carry is the overflow, the sum divided by 65536.  The properties of the generator are controlled by the parameter m,where m = ak * b^k + ... + a2 * b^2 + a1 * b - 1.  (The "-1" termis the coefficient of x[i].)  For example, the generator used has(a1, ..., a8) = (1941, 1860, 1812, 1776, 1492, 1215, 1066, 12013)This corresponds tom = 0x2EED042A04BF05D406F0071407440794FFFFThe output of the generator is, in reverse order, the base-b digitsof r/m, for some 0 < r < m.  (Which r depends on the seed.)If m is a Sophie Germain prime, and b a power of 2, then the periodof the generator will be the prime (m-1)/2.  I.e. the periodof the generator is 1577399102372415483554202684831355506491391,1.577 * 10^42, or over 2^140.With a bit of hacking, this library could be used to search for suchprimes quickly, using a combination of the primeGenStrong code(which searches an arithmetic sequence for primes) and germainPrimeGen,which finds Sophie Germain primes.  Maybe in the next release...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -