So if banks use 128 bit public keys as and a 512 bit public key was crackable in less then 24 hours, then a 128 bit public key must be exponentially easier to crack so how come hackers never go after that?

All you can say about key length is the average amount of time it would take to crack a key of that length. The keyspace of a 128-bit key is 2^384 times smaller than that of a 512-bit key, so it's much easier to crack, on average.

However, every now and then you'll come across a 512-bit key that you crack -- rather accidentally -- within ten seconds.

There are no truly secure cryptosystems, aside from one-time pads, and computerized encryption serves only as a deterrent. Certainly, no one is going to spend their entire lifetime trying to get your credit card number, so existing cryptosystems are perfectly adequate for protecting your e-business traffic.

I originally had a much longer question, which explained what I was asking better but I edited it because I thought it might be confusing. But anyways my question was concerning the differences between private key (symmetric), and public key (asymmetric) encryption. Which I learned about when I was reading the the page from the link I gave.

Anyways the point is that asymmetric encryption works on a different principal than symmetric encryption.

Based on the this info: (http://www.andya.org.uk/jsplay/codeworks.html) I am not sure if saying that a 512 bit key is 2^384 times harder to crack than a 128 bit key would be correct when you are talking about public keys.

It may take billions of years to crack a private key encrypted document, but as my earlier quote said it is much easier to crack a public key encrypted document. According to the site I quoted it takes less than 24 hours to crack a 512 bit public key encrypted document. So a 128 bit public key should be way easier to crack, and that is what the internet uses.

There is no such thing as a private key or public key encrypted document.
The document is encrypted by an encryption algorithm, public key is a way of swapping the encryption keys used for by whatever algorithm you choose.

The 512bit 'key' is not just used to simply xor the message n times as described in that site, it was giving this as a very simple example of what key lengths mean.

The keyspace of a 512-bit key is 2^384 times larger than the keyspace of a 128-bit key.

The website you keep linking seems to be quite full of crap, actually. It reads like a student's term paper on the subject of cryptography, contains many obvious errors, and I would certainly not treat it as being in any way authoritative. He's trying to sell you on XORing, for God's sake. Find a real reference. Look up the sci.crypt FAQ, or buy Applied Cryptography.

"The internet" does not use 128-bit keys. Your browser and a TLS (SSL) server will negotiate the most secure method available between them. If your browser supports 512-bit keys, and your website supports 512-bit keys, then you'll be using 512-bit keys.

If your document is encrypted with a 512-bit random key (as in a symmetric key system) it is much harder to crack than a document encrypted with a 512-bit number that it is the multiplication of two primes (as in a public key system). Obviously there are far fewer such 512-bit numbers to search!

You are far too kind; I would say that the author of that page has never studied crypto at all, let alone enough to have written a term paper. On the mistakes, I agree -- it's riddled with them.

True, but isn't key exchange usually done at 1024 bits? Since it only happens once per communication, it's usually at a much higher encryption level than the message itself.

You're correct. Public-key cryptosystems are only used to exchange key data for an agreed-upon symmetric cryptosystem. The actual data going through a TLS (SSL) connection is actually being encrypted with a much more secure symmetric cryptosystem.

The weak link, of course, is the key exchange. If an attacker can break the public-key cryptosystem, he/she can recover the symmetric key and thus the rest of the data. However, the symmetric key data is random, so cracking the key exchange is made much more difficult.

Thanks for the info about sci.crypt FAQ, that looks like a good reference.

Anyways, it makes sense that they are secure since the only way to crack them is to factor them which is supposedly intractable and plus, using the weak link chain theory, it would be unreasonable for an attacker to try to crack a key to get some information when they could just plant a keylogger or something.

Btw do public keys get regenerated every time you make a transaction, or does each computer have 1 that they use, because it would seem more secure to regenerate them for each transaction?

Factoring is difficult, but not impossible. Most of the cryptography contests out there are factoring contests. If or when someone comes up with a new algorithm or a new computing theory (like quantum computation), all of these cryptosystems will be broken at once.

The very purpose of public key cryptography is the keys never change! You should be able to publish your public key in the New York Times and have people use it to contact you securely.

Just to elaborate....the sender would encrypt the message with the public key and the receiver would decrypt it with his/her private key. If the sender wanted the receiver to be able authenticate them and verify the integrity of the message they could encrypt a hash of the message with their private key and the receiver could decrypt it with the sender's public key, recompute the hash, and check it against the one that was received.