Moto Defy me525 php MD5 function using instance code

Source: Internet
Author: User
In general, a member to provide registration of the site must collect the user's password, how to save the user password is a problem. We certainly cannot store passwords in plaintext in the database, because in this way, the average administrator can see the user's password, which is obviously a very dangerous thing for the user.
How to solve this problem, we can take such a strategy.
First introduce the use of the MD5 function in PHP:

Copy the Code code as follows:


$PSWD 1=md5 ("cenusdesign");
echo $PSWD 1; The result of the operation is: FC60EC37D1C08D5B0FB67A8CD934D5BA
$PSWD 2=md5 ("cenusdesign");
echo $PSWD 2; The result of the operation is: 067577d9fc109c80538c81d6f02bd293
?>


Obviously, after MD5 encryption, the original "Cenusdesign" is transformed into a set of 32-bit strings, and even if the case of a letter changes, this set of strings will change dramatically.
Cenus Design recommends that when the user registers, the password is converted first through MD5, and then the encrypted database is converted. When the user logs on, the password is MD5 converted, and then compared with the set of MD5 encrypted strings in the database. This makes it possible to do a password-specific operation without knowing the user's exact password.
Author: Sunec
Original download: Cenus Blog
All rights reserved. The author and original source and this statement must be indicated in the form of a link in the reprint.

The above describes the Moto defy me525 php MD5 function Use instance code, including the Moto defy me525 aspect of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.