Since I found out that RSA-640 was solved, I’ve been thinking about altering my script for RSA-704. I made a number of changes:

- Focusing on generating binary numbers with exactly half the digits of RSA-704. Both RSA-640 and RSA-576’s factors had that property.
- Used join() to concatenate the binary number string elements instead of +=’s.
- Used Python’s native base-10 conversion instead of baseconvert.
- Decided to calculate the primes below 2000 and check these against the generated number, since that might save compute cycles versus trying every number against RSA-704. It seems like it makes things go faster.
- Improved the output.

Here it is: download text version

```
```### Like this:

Like Loading...

*Related*

## 5 comments

Comments feed for this article

April 7, 2006 at 2:36 pm

Spot ToxicPretty cool; I remember this from the last time you posted it.

I’ve got a major speedup for you, if you’re interested. The above code does about 40K tries per second on my 2GhZ; I was able to get it up to 1 million tries per second by substituting the following code: delete the following:

slist=[‘1’]

pos=1

while pos

and replace it with the following two lines:

n=getrandbits(digits);

n |= (1

Use the power of Python, and stop all those silly slow string manipulations! 🙂

April 7, 2006 at 7:37 pm

ahardenCool! I’ll probably post a 1.1 with that change (and any other cleaning up I can think of). I did try to research stuff that I could speed up from the RSA-640 script.

I also have a simpler variation that uses an implementation of Rabin-Miller algorithms I found on ASPN to try to generate large prime numbers, which I then try against RSA-704. I’ll post that soon.

April 7, 2006 at 8:35 pm

ahardenOh yeah, that’s a lot faster, though I didn’t understand what your second statement was for. I didn’t include it when substituting getrandbits() in for the string cat that I was doing. Guess I should have looked at all of random.py’s functions!

April 10, 2006 at 10:20 am

HonninscraveThe second statement was just to ensure that the random number was the right length, by making sure the first binary digit was a 1.

Otherwise, if I generate n random bits, and the first is zero, then I really have a number that is n-1 (or less) digits, because of the leading zero(s).

See, still have my matress, don’t I?

I’ll expect a 2% royalty when you win the prize. 🙂

April 10, 2006 at 4:34 pm

ahardenCool. Thanks for the explanation; that makes sense. Obviously, my original implementation’s initialization of slist as ‘1’ took care of that case. But your code runs faster. 😉