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