Encrypt Password With MD5 in PHP

MD5 is a cryptographic hash function widely used with 128-bit hash value. In Internet standard (RFC 1321), MD5 has been utilized in a variety of security applications, and MD5 are also commonly used for testing the integrity of a file.

MD5 was designed by Ronald Rivest in 1991 to replace earlier hash function, MD4. In 1996, a disability is found in its design, though not a fatal weakness, cryptography users began to advocate using other algorithms, like SHA-1 (latest claim states that the SHA-1 is also disabled). In 2004, more defects are found to cause serious use of the algorithm in goal for the security becomes more questionable.


That glimpse of MD5 that I pick out a small portion of wikipedia. Recently emerging piercing site with a domain of government both national and regional scale. Of course, still fresh in our memory, the last few weeks KOMINFO sites were targeted cyber crime, the more horrendous again, the Cracker leave a message, that KOMINFO site user and password in the form of plaintext, not in encrypted at all.

in a facebook group, some friends asked me about how to encrypt passwords in a web, but the explanation I gave seems less able to understand, either because of my stupid or because they can't understood with my explaination, but I think because of my stupidity can not explain. Get to see an example in PHP syntaxt.

    include ("koneksi.php");
    $username=$_POST['username'
    $password=md5($_POST['password']);
    $jenis=$_POST['level'];
    $query=mysql_query("insert into admin (user,passwd,level) values ('$username','$password','$level')");

When passwords are fed through the php script above, then stored into the database is already in the encrypted passwords, but if you want to encrypt the username is also on, then you just add it as an example of md5 passwords.

Now the question is, whether you login later, a text password that is entered can be recognized as an md5 as well?. Problems like this first I found, but if we think the style of encoder, we will not see a problem, because its logic remains the same.

    When storing passwords with md5, and then when the log should also be md5

how is that we recognize in our login form in the text with md5, the following example syntax

    $user=$_POST['username'];
    $pass=md5($_POST['password']);
    $hasil=mysql_query("select * from admin where user='$username' and passwd='$password'");

that all quick tips, may be useful for beginners like me,,,,,
  

0 comments:

Post a Comment