Use MD5 to encrypt the user password in the database (II) _ MySQL

Source: Internet
Author: User
Use MD5 to encrypt user passwords in databases (2) use MD5 to identify legal users
Since the user password is stored in the database after MD5 encryption, we know that MD5 is a single encryption algorithm, so it is impossible to convert the encrypted information into plaintext, that is, there is no way to know. This leads to a problem. if you use an account or password to log on, how can you know whether the password provided by the user is accurate?
This has to mention the MD5 feature we mentioned earlier. we know that after encryption of any segment of plaintext data, the results will never change. that is to say, to verify that the user password is correct, you only need to use MD5 encryption for the password currently provided by the user, and then compare it with the password field saved in the database. The following code implements this function:
<% @ Import Namespace = "System. Security. Cryptography" %>
<% @ Import Namespace = "System. Text" %>
<% @ Import Namespace = "System. Data" %>
<% @ Import Namespace = "System. Data. SqlClient" %>

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.