Home  >  Article  >  Backend Development  >  Can php md5 encryption be cracked?

Can php md5 encryption be cracked?

PHPz
PHPzOriginal
2017-03-15 10:36:276200browse

##The encryption technology we use in php website development is MD5, so using the MD5 encryption algorithm can Is it crackable or is md5 encryption reversible? Let’s first take a look at two commonly used PHP data encryption technologies. PHP data encryption technology

##Md5() and Sha1() encryption algorithms are One-way, there is no reverse function to get the original plaintext data

Algorithm call:

string md5 ( string $str [, bool $raw_output = false ] )

##string Sha1 ( string $str [, bool $raw_output = false ] )

Parameters

str

Raw string.

raw_output

##If the optional raw_output is set to TRUE, then the MD5 report The text summary will be returned in raw binary format with a length of 16 bytes.

Return value

##MD5() in the form of a 32-character hexadecimal number Returns the hash value.

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

##

##$p =
"123456"
;echo md5
($p); ?>
The output is as follows:

##e10adc3949ba59abbe56e057f20f883e

But it is very unsafe to use the md5() function in this way. In this case, you can search for md5 decryption on Baidu. You will find a decrypted website:

##

It can be seen that it is unsafe to use the md5() function directly as above. Although the md5 algorithm is irreversible, because the result it calculates for the same character string is unique, some people may use "dictionary attacks" to break md5 encryption system. Although this is a brute force decryption, it is very effective because the user passwords of most systems are not very long so the final data encoded by our md5 can be cracked through some websites:

Obviously, it has been cracked. It is not complicated enough to use the md5() algorithm directly, and then the code Modify as follows:


##$p = "123456";
##echo md5(md5($p ).md5($p));
?>

Printed result:

efd52a4f82c94f80f13671ebd7cd2a6d

# Go to the website to crack:

Obviously, his result is wrong, our password is 123456 and not zero.

We can encrypt through multi-layer md5() algorithm based on an md5() function, because it is one-way, maybe you are wondering why the website can be cracked, in fact the website The best is brute force cracking. They constantly save various codes and passwords and then match them to finally get the password.

For details

MD5 cracking method

Please refer to:php md5 decryption code sharing (attached interface, available for personal testing) Related articles:

Can php md5 be decrypted?

php md5 encryption and decryption algorithm and tools (with code)

MD5 encryption tool

The above is the detailed content of Can php md5 encryption be cracked?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn