PHP MD5 16-bit and 32-bit implementation Code _php tutorial

Source: Internet
Author: User
Tags md5 encryption
Copy CodeThe code is as follows:
Echo substr (MD5 ("admin"), 8,16); 16-bit MD5 encryption
echo "";
echo MD5 ("admin"); 32-bit MD5 encryption
?>

The 16-bit MD5 encryption uses the SUBSTR function to intercept the characters to be implemented ....

Don't want to delve into it: Put your brain on the other key areas

Today made a PHP link MSSQL database, the table in the database field using MD5 16 encryption. But PHP in the default is 32-bit, resulting in the login program can not use MD5 encryption with the table field matching, in the online a search there are many people have this confusion, and later found a solution, is correct, on record down.

Use the SUBSTR function to intercept:

SUBSTR (MD5 ("admin"), 8,16); 16-bit MD5 encryption

MD5 ("admin"); 32-bit MD5 encryption

the script home test results are as follows:

We compare the results after several MD5 of ASP
Attached: If you encounter MD5 encrypted files, but do not know the password, please exchange this set of encrypted data in the database.

Admin---16-bit encryption---7a57a5a743894a0e
Admin---32-bit encryption---21232F297A57A5A743894A0E4A801FC3
Admin---40-bit encryption---7A57A5A743894A0E4A801FC343894A0E4A801FC3

SUBSTR (MD5 ("admin"), 8,16); 16-bit MD5 encryption is exactly 32 of the 16 characters starting with the 8th character. So you don't have to think about the uniqueness of the problem. is right in itself. Someone online says PHP5 support
Copy CodeThe code is as follows:
echo MD5 ("admin", true);//returns 16 bits, but this is only in PHP5.

The results of the test output is garbled, if you have any good code, you can share the next.

http://www.bkjia.com/PHPjc/318927.html www.bkjia.com true http://www.bkjia.com/PHPjc/318927.html techarticle Copy the code as follows: PHP echosubstr (MD5 ("admin"), 8,16),//16-bit MD5 encryption echo "HR"; ECHOMD5 ("admin");//32-bit MD5 encryption? The 16-bit MD5 encryption uses the SUBSTR function to intercept the characters to be implemented ...

  • 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.