MD5 Hash

MD5 Hash
MD5 algorithm is mostly used to manage sensitive data such as storing, and comparing user account password. Any hashed data is currently impossible to reverse or decrypt to get the source. The only way to verify a correct password is by comparing the user provided (hashed using MD5) with the hashed password in the database.
Tools to hash or convert your text or string using MD5 algortihm.


Important : We do not log any information provided in the above field.

 

Sample application : User login [ PHP script ]

 

Below is a simple PHP script as a tutorial for user login or authentication process. It shows how to match the provided password with the MD5 hashed password stored in the database.

Step 1 of 2 : Create an input form [ filename : input.html ]

<form name="userLoginForm" method="post" action="login.php">
Username : <input name="username" id="username" type="text" value="">
<br>Password : <input name="password" id="password" type="password" value="">
<br><input id="submitBtn" name="submitBtn" type="submit" value="Login">
<input id="resetBtn" name="resetBtn" type="reset" value="Clear">
</form>

Step 2 of 2 : Create a process section [ filename : login.php ]

<?php
# Initialise the variables.
$post_username="";
$post_password="";

# Fetch the POSTed data.
if(isset($_POST["username"]))
$post_username=addslashes($_POST["username"]);
if(isset($_POST["password"]))
$post_password=addslashes($_POST["password"]);

# Let's say we use a hard-coded username and password.
$database_username="admin@k-ict.org"; # The username is normally stored as plain text in the database.
$database_password="c6e737462801196f1ec10d400140e1ca"; # The password MUST be stored as hashed or encrypted in the database.

/*
Below are the data in plain text, which MUST NOT be written anywhere in this code. Use this combination of username and password to only test this script;
Username : admin@k-ict.org
Password : This 1s 4 t0p Zecr4t p4sSw0rD
*/

# Hashed the POSTed data.
$post_password_hashed=md5($post_password);

# Attempt to match the the username (plain text) and password (MD5 hashed text).
if($post_username==$database_username && $post_password_hashed===$database_password)
echo "You have provided a correct username and password."; # Display the process result.
else
echo "Sorry, you have provided an incorrect username or password."; # Display the process error message.

# Add link to go back to the previous form.
?>
<br>
<input id="backBtn" name="backBtn" type="button" value="Back to login form" onclick="location='input.html';">
<input id="visitSponsorSiteBtn" name="visitSponsorSiteBtn" type="button" value="Visit K-ICT site" onclick="location='http://www.k-ict.org/';">

You may use database like MySQL, or PostgreSQL to efficiently store data. Most programmers use those applications.

What can we do for you?