samr7, please read the following. I have a honest proposal for pulling your code with more security and... speed!
First, I suppose you are familiar with openssl-API. I'm not (otherwise, I'd rewrite the code myself), but after some revision of your program I've found points of improvement. On the other hand, elliptic curve mathematics are familiar to me ;-) So, this is my proposal.
1) Get a good 256-bit random number. It will act as a seed. You can obtain it from three sources.
E1 = 32 bytes from random.org. Here it is a sample code that dumps the result in a file; I suppose you can adapt it:
wget "http://www.random.org/cgi-bin/randbyte?nbytes=32&format=file" -O - > E1
E2 = 32 random bytes from hotbis. Sample code:
wget "https://www.fourmilab.ch/cgi-bin/Hotbits?nbytes=32&fmt=%20bin" -O E2
E3 = 32 random bytes from local sources. For example, /dev/urandom, but you can use other not so quality sources.
Finally, obtain the seed number, "s":
s = SHA256(E1 | E2 | E3) mod p
where "p" is the prime order of the curve (I suppose you can take it, and perform this operation, from openssl-API)
2) Get the first public address
The public key is calculated with EC-product:
PubKey = s*Q
where "Q" is the fixed point in the curve. Now address is:
PubAdd = base58(RIPEMD160(SHA256(PubKey))+checksum)
or similar, isn't it?
3) Start the loop
If pattern matchs "PubAdd", then go end
PubKey <- PubKey + Q (EC-Add operation)
s <- (s + 1) mod p
PubAdd = base58(RIPEMD160(SHA256(R))+checksum)
P' = s*Q (EC-product)
if (P' == PubKey)
PrivKey = base58(s+checksum)
print PubAdd, PubKey, PrivKey
something went bad
So, the biggest improve is, that heavy EC-product is computed only twice!!! New test address is taken from single EC-add operation which is relatively cheap in compute resources.
But you must be sure that 256 initial seed is really random.
What's your opinion?