| NAME: |
|
MD5 Hashing |
| AUTHOR: |
|
punkstar |
| DATE: |
|
27th Nov, 2005 - 11:30:02 AM |
| DESCRIPTION: |
|
Protect your user's information |
Need some help with that coding?
Security is a huge issue on the internet, and you will notice this more and more as you start to code proper websites where protecting your information is as valuable as making a website colourful and attractive to the users.
When you start a membership system, one thing you are going to need to take from your users is a password. Your users will not like the fact that you are storing their password in a "clear text" form. It would be a lot better if you could use a one-way encryption method right?
Md5 is a very easy and quick way to add a load of security to your website. You must remember that md5 is NOT PERFECT.
| PHP Code |
<?php
$text = "This is the text that I want to encrypt";
$encrypted_text = md5($text);
echo "The md5 hash of: $text <br /> is $encrypted_text";
?>
|
The GREAT thing about md5 is that you can't actually decrypt it. The only way you will ever know what went into making the hash is to brute force it, and that can take hours. The fact of the matter is that if someone wants to know whats in the hash bad enough, they will brute force it for days/hours until they get it.
Okay, its encrypted.. but how do i check if passwords are correct now that I can never get the clear text back!?
Easy, encrypt the text that you want to check, then if that hash matches the hash that you have stored, the password is correct.
Md5 is a great way to add some security to your user's information.
|