Warning to novices in php this is a pretty advanced script and should be used by a person who is very knowledge in php if you insist on useing it on a novice stage it's at your own risk.
This scrypt checks a user inputed password and then encrypts it and checks the db's version of the md5 enc to see it is correct
PHP Code:
//str is the inputed password the user gave
Function Encpass($str)
{
//this now encrypts the inputed password
md5($str);
//this checks the encrypted version of the inputed password
//to the databases stored version to see if it's correct
//change usrpass to whatever variable you use for the retrieved pass from db your checking
if (md5($str) == $usrpass)
{
//in your script check, if Cvalue equals 2 and it's a correct pass
$Cvalue = "2";
}
else
{
//but if its a 1 it's incorrect password
$Cvalue = "1";
}
}
//you should next check Cvalue to make sure it equals 2
//if you use this and like it a link to my website is appreciated but not required
// my website is http://onfiretechnologies.com and it's an arcade of flash games
// and has lots of cheat codes so use what ever relateing text you wish
this next part is for user registration
PHP Code:
//this part is for user registration to encrypt password in md5
//stpass is the inputed password to encrypt
Function CMd5Pass($stpass)
{
//npass is the new encrypted version of the orignal inputed pass
$Npass = md5($stpass)
}
//now to enter it in db. save the Npass variable to the db for password
//if you use this and like it a link to my website is appreciated but not required
// my website is http://onfiretechnologies.com and it's an arcade of flash games
// and has lots of cheat codes so use what ever relateing text you wish
i highly suggest you don't use this code for MD5 encryption, extremely easy to crack (approx 1 - 3 seconds). In fact, you can crack it online at http://www.md5database.net/ :P to make it more secure you use a salt.
You do not get that there are billions of combinations, and md5database is very incomplete, there is a small chance that it has a standard dictionary word, but a mixed case, mixed character, and completely random string it will not decode.
md5database does not crack the MD5 keys, it has a database of keys people have entered...it only retrieves the already cracked info. If i enter "1234" into it to be encoded, that then gets added to their database. For example, i entered "88a712d55763cc29bb2986bba2493408" ("fgsg4352gv") into the decoder and it found nothing, but if i enter "fgsg4352gv" into the encoder it will then be added to the database.
To crack a md5 line takes quite a while...i created a script to do it and it took the script all day to crack a 5 char string.
The best way to protect yourself is double md5, salt or SH1 (but even SH1 can be cracked).
I've put together an encryption tool below, feel free to use it on your localhost to test out passwords and stuff
//Alternativly use a "salt" string (random 3 characters for each user in the database that is added to the begining or end of the encryption. Example below:
$salt="&~/"; //Normaly this comes from the DB but im just doing an example here.
$password5=md5($password.$salt);
//Now i'll echo it all out into a nice little document :)
echo"<strong>RMWebs.net MD5 Tool</strong><br />You Entered The Following Information:<br /><strong>Username:</strong> ".$username."<br /><strong>Password:</strong> ".$password."<br /><br />
Here is the result of different methods of encryption:<br /><br />
I dont particularly like MD5, mainly because of md5 databases. I do however, have to use it because phpbb2 uses MD5 and I cant be bothered to rehash all the passwords, lol.
This is my preferred method when hashing passwords:
MD5 cannot be decrypted. The site you mentioned just has a list of some MD5 values with the respective data, on which it performs a lookup, this can be achieved with each hash method.