MYSQL--MD5 Encryption

Source: Internet
Author: User

Requirements are as follows

The customer registers an app, fills in the phone number, needs to receive the verification code, then registers.

Customer actions

Fill in your mobile phone number and click Get Verification code.

App Action

Incoming three parameters to the background: mobile phone number, their own randomly generated verification code (how many people decide), verify the content (MD5 (mobile phone number & Verification code)).

Background operation

1. Receive three parameters

2. Generate a CHECKSTR with mobile phone number & verification code.

Verify the Send code String CHECKSTR = message.getphonenumber () + "&" + Message.geticode ();

3. MD5 encryption for CHECKSTR, MySQL function is used here

SELECT MD5 (CONCAT (13258317626, ' & ', 123456))

4. Compare with the front desk MD5 encrypted string to prevent others from malicious cyclic registration

5. This part of the complete code is as follows

Verify the Send code String CHECKSTR = message.getphonenumber () + "&" + Message.geticode ();        Call the database once for MD5 encryption String md5data = Smsinfomapper.getmd5data (CHECKSTR); Compared to the foreground MD5 encrypted string, the role is to prevent others from malicious cyclic registration if (!md5data.equals (Message.getsign ())) {Resultobject.setresu            Ltmsg (resultmsg.msg_checkcode_failed);        return resultobject; }



MYSQL--MD5 Encryption

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.