![]() |
|
|
#122 | |
|
May 2010
Prime hunting commission.
24×3×5×7 Posts |
Quote:
It's as easy as adding the nextprime function to the random function, so it only generates prime numbers. Examples: 148503599607675376327643096073847383532506324974398790977303580131975018496624075455825241101722900334753749994785762348854940183930011820566563438507 and 457585737543888599372885355510412842773181811746998283312123375548268116173690774280889442060057690415388596166818087804386186378332943916905105585384387. Last fiddled with by 3.14159 on 2010-07-19 at 20:22 |
|
|
|
|
|
|
#123 |
|
Undefined
"The unspeakable one"
Jun 2006
My evil lair
2·11·283 Posts |
|
|
|
|
|
|
#124 | |
|
Aug 2006
3·1,993 Posts |
Edit: retina beat me to it. My point about breaking RNGs is the same as retina's point about prediction.
Quote:
I have a very basic Pari function rp(b) that generates random b-bit primes. At the moment it's implemented using nextprime(), but this is actually not the best method; preferable (for b > 2) is to generate random odd numbers in the range and test for (pseudo)primality, selecting a new random number if the number is composite. This avoids certain biases in the selection. Last fiddled with by CRGreathouse on 2010-07-19 at 20:31 |
|
|
|
|
|
|
#125 | |||
|
May 2010
Prime hunting commission.
110100100002 Posts |
Quote:
Quote:
And, the risk of an attacker actually succeeding is minimal, as most people are idiots when it comes to computers. (Unfortunately, that set of people includes me.) Quote:
Last fiddled with by 3.14159 on 2010-07-19 at 21:09 |
|||
|
|
|
|
|
#126 | |
|
Aug 2006
175B16 Posts |
Quote:
http://www.computerworld.com/s/artic...ows_encryption http://www.ibm.com/developerworks/li.../index.html#h4 http://www.ngssoftware.com/research/...Randomness.pdf For a general overview, see http://en.wikipedia.org/wiki/Cryptog...mber_generator |
|
|
|
|
|
|
#127 |
|
Aug 2006
3×1,993 Posts |
No. Consider the interval 101 to 200. The method I outlined generates each prime in that range with probability 1/21 = 4.7...%. By contrast, your method gives 2% probability to 101 and 14% probability to 113.
|
|
|
|
|
|
#128 | |
|
May 2010
Prime hunting commission.
24·3·5·7 Posts |
Quote:
Last fiddled with by 3.14159 on 2010-07-19 at 22:08 |
|
|
|
|
|
|
#129 |
|
Aug 2006
3×1,993 Posts |
|
|
|
|
|
|
#130 |
|
May 2010
Prime hunting commission.
110100100002 Posts |
@CRG: You stated that any regular random integer generator is vulnerable to someone knowing how it works and is able to know what it will generate ahead of time.
Some sites claim randomness from other sources: Random.org claims atmospheric noise as the source of its random integer generator. I decided to perform a few tests. Now; here are the output numbers from random.org vs. those from PARI's random(n) function. From random.org: (Range 1k to 2k) 1854 1003 1826 1083 1789 1050 1977 1480 1549 1137 1357 1745 1701 1680 1584 PARI's random(n): 1154 1775 1617 1654 1096 1423 1174 1231 1832 1295 1145 1338 1269 1442 1981 1576 There wasn't much of a difference there, but after a few more tests, I saw that PARI's generator was biased to the numbers closer to 2k. There were rarely any numbers beginning in "10", "11", or "12" Last fiddled with by 3.14159 on 2010-07-19 at 22:40 |
|
|
|
|
|
#131 | ||
|
Aug 2006
3×1,993 Posts |
Quote:
Quote:
Code:
sum(n=1,1e6,1000+random(1000)<1300) %1 = 300219 There shouldn't be any massive defects of that sort. However there are smaller defects that could allow an attacker to reconstruct the internal state of the PRNG and therefore guess future outcomes. |
||
|
|
|
|
|
#132 |
|
Aug 2006
3×1,993 Posts |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wheel Factorization | a1call | Factoring | 11 | 2017-06-19 14:04 |
| Efficient Test | paulunderwood | Computer Science & Computational Number Theory | 5 | 2017-06-09 14:02 |
| LL tests more credit-efficient than P-1? | ixfd64 | Software | 3 | 2011-02-20 16:24 |
| A Wheel | storm5510 | Puzzles | 7 | 2010-06-25 10:29 |
| Most efficient way to LL | hj47 | Software | 11 | 2009-01-29 00:45 |