Can PHP MD5 encryption be cracked?

Source: Internet
Author: User
Tags md5 digest md5 encryption

We are in the development of PHP Web site using encryption technology is MD5, then the use of MD5 encryption algorithm can be cracked or MD5 encryption reversible ? Let's take a look at two commonly used PHP data encryption techniques.
PHP Data encryption Technology

The Md5 () and SHA1 () encryption algorithms are unidirectional, and there is no inverse function to get the original plaintext data

Algorithm calls:

String MD5 (string $str [, bool $raw _output = false])

String Sha1 (String $str [, bool $raw _output = false])

Parameters

Str

The original string.

Raw_output

If the optional raw_output is set to TRUE, then the MD5 Digest is returned in the original binary format of 16 bytes in length.

return value

MD5 () returns the hash value as a 32-character hexadecimal number.

SHA1 () returns the hash value as a 40-character hexadecimal number.

<?php
$p = "123456";
Echo MD5($p);
?>

It outputs the following results:

e10adc3949ba59abbe56e057f20f883e

But this use of the MD5 () function is very insecure, so that everyone can go to Baidu search MD5 decryption, will find the existence of the decryption site:

so it is not safe to use the MD5 () function directly to the above. Although the MD5 algorithm is irreversible , because it is unique to the result of the same character string calculation, some people may use a "dictionary attack" approach to compromise the MD5 encrypted system. This is a violent decryption, but very effective, because most of the system's user passwords are not very long, so our MD5 encoded into the final data can be cracked through some websites:

Obviously, the algorithm that was cracked and used directly with MD5 () is not complex enough, and then the code is modified as follows:

<?php
$p = "123456";
Echo MD5(MD5($p). MD5 ($p));
?>

Print out the results:

efd52a4f82c94f80f13671ebd7cd2a6d

To the site hack:

Obviously, his result is wrong, our password is 123456 instead of zero.

We are in a MD5 () function based on the multi-layer MD5 () algorithm can be encrypted, because he is one-way, perhaps we wonder why the site can be cracked, in fact, the site is a brute force, they are constantly save various codes and passwords and then to match the final get the password.

Specific MD5 crack method Please refer to: PHP MD5 decryption code sharing (with interface, pro-Test available)

Related articles:

Can PHP md5 be decrypted?

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

MD5 Encryption Tool

Related Article

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.