Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Salting and MySQL

Name: qallaf89 2012-10-03 19:06

Can someone provide me with an example of how to use encryption using Blowfish (or ADES) and salting for a user password in PHP using MySQL ?

Also, i am new to crypto so any suggestion would be appreciated.

Name: Anonymous 2012-10-03 22:31

>>1
Oy vey...  You don't ,,encrypt'' passwords, for encryption is a reversible process, which means that the schmuck that gains access to the database is likely to also be able to gain access to the encryption key, thus making the whole scheme useless.

What's the point of the whole password cryptography schmryptography anyway?  The point is that most people disregard sane advice and use the same password (or very slight variations thereof) on multiple sites.  If a hacker somehow gains access to your password database, they must not be able to see the passwords.  The way this is accomplished is using a one-way function, i.e. a function such that given its output, it's computationally infeasible to find a corresponding input.  Cryptographic hash functions work that way.  Now you still have a problem; what if the attacker precomputes a bunch of rainbow tables, then uses those to crack your users' passwords?  No worries, just use a salt, which is a short (2-4 bytes) random string that is appended (or prepended, selon vos préférences) to the password prior to hashing it.  But how do you check whether your user entered the password correctly?  Just retrieve the ,,password-salt'' and ,,password-hash'' columns in the user database, hash the password with salt ,,password-salt'', then compare it against ,,password-hash''.  See?  Now your dumb goy users can safely indulge their bad password habits.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List