in reply to MD5 - what's the alternative

Personally, I use MD5 to generate one-use authentication tokens. On the next request, I verify the token presented is one I'm expecting, delete it from the serverside database, and generate a new one-use token to be sent back with the response. I also check for collisions (but haven't had one in two weeks of banging on it), just for completeness.

Personally, I think this is about as secure as it could be, given the nature of the Net, even using MD5. The token is only viable for a certain period of time if it's unused, after which it's scrubbed from the tables. If it is used, the token lives for a much shorter period of time.

As for password authentication ... I'd probably use SHA-512 for that. The expense in the larger hash is offset by the fact that it only happens once/session. I generate tokens every page request, so it has to be cheaper, CPU-wise.

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested