|
posted 03/8/2008 by Chris
Encrypting a password using the md5 algorithm is so easy that you really have no excuse not to use it for saving passwords into your database...
$password = 'x9Fe2f4f'; //this is all you have to do to create a 32-character encrypted hash $encrypted_password = md5($password); //check a user's password that they input with the encrypted one if( md5($users_password) == $encrypted_password )
See, you're just plain lazy if you can't handle that. As an aside, here's some useful code to create a random 8- character password...
$chars = "abcdefghijkmnopqrstuvwxyz023456789"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 7) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } echo $pass;
COMMENTS (displaying 0 comments) POST (leave a comment) |
POPULAR BLOG TAGS
mailto
orwell
email
mit
php5tube
class
google
launch
regular expressions
debuggeddesigns
flash
quicksilver
published
code
1984
hobnox
germans
security
ableton
privacy
geek
defcon
whoami
cakephp
science
spam
routes
trice
drum machines
captcha
release
brain
skateboard
boston
snowboard
magazine
general
charlie
rot13
color
sports
usort
php
gmail
encryption
youtube
mbta
open source
bakery
as
|