PHP MD5 encryption and decryption algorithms and tools (with code)

Source: Internet
Author: User
Tags decrypt php web development
The examples in this paper describe PHP MD5 implementation of the encryption and decryption method,The MD5 algorithm is commonly used for encrypting data, such as a user login password for a website. The students who are interested in MD5 can refer to it.

I. What is MD5?
Message Digest algorithm MD5 (Chinese named message Digest Algorithm version fifth) is a hash function widely used in the field of computer security to provide integrity protection for messages. At present, the user's password in PHP Web development is encrypted with MD5.

two. MD5 's cryptographic algorithm code

Encryption <body style= "Color:green;font-size:28px;background:black;font-family:verdana, Sans-serif;" ><?php error_reporting (0);? ><form name= "C" action= "<?php echo $_server[' php_self '];? > "method=" Get ">input your text:<input type=" text "Name=" C "/><button type=" Submit "value=" submit "style = "Color:green;font-size:28px;background:black;" >creat!</button></form></body><?php//hash encode:if ($c =$_get[' C ']) echo ' Roger! Your MD5 Code is:<br> '. MD5 ($c). ' (32bit) <br> '. substr (MD5 ($c), 8,16). ' (16bit) ';//intercept 8 to 24 is a 16-bit hash, easy to store?>

three. Can md5 be decrypted or cracked?

MD5 encryption algorithm is an irreversible encryption algorithm, in theory, can not decrypt the cracked. MD5 Encryption principle is hash algorithm, hash algorithm is also called hashing algorithm. The computer science data structure has the hash table this knowledge point. for example, 10 divided by 3 is one, 4 divided by 3 is also one, but the remainder of one does not know which is the number. So MD5 can't decrypt it. Even the people who design this encryption algorithm don't know. But how is your password verified? This is because the same password is encrypted and must be the same. You can only know if your password is correct if you enter it for encryption. in other words, your password is only known to you. It is also why the buckle password can only be reset, can not be retrieved the reason. (Reference: PHP MD5 encryption can be cracked?) )
but if the single MD5 simple password or can be brute-force , they are through the constant saving of various codes and passwords and then the match will eventually get the password. But the complex password is still a bit difficult. (PHP MD5 decryption code sharing (with interface, pro-Test available))

four. Reset Password method via MD5

because MD5 encryption algorithm is irreversible encryption algorithm, so when you forget the password, you can take a reset password, you can also use the overwrite password. For example, the Web site password, you forget, you can use the PHP Chinese network MD5 Online encryption tool to enter the password to encrypt, and then generate MD5 cipher string, the ciphertext string to overwrite the original database user table existing MD5 ciphertext can be.

The above describes the PHP MD5 implementation of the encryption method, including the MD5 decryption of the relevant content, I hope to topic.alibabacloud.com friends to help.

Related articles:
Can PHP md5 be decrypted?

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