Home  >  Article  >  Backend Development  >  PHP5’s new obfuscation (Hash) method_PHP tutorial

PHP5’s new obfuscation (Hash) method_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 14:55:33921browse

Bangkejia (www.Bkjia.com) tutorial starts from PHP5.1.2. PHP has added a new hash engine, which provides up to 35 types of hash algorithms including md5 algorithm and sha1 algorithm. Different hash algorithms.

Let’s actually test the effect (PHP5):

以下为引用的内容:
$string='password';
echo md5($string);//原来的md5函数
echo '
';
echo hash('md5',$string);//新的hash函数,第一个参数指定算法名称
?>

Running the above code, you will find two identical values ​​​​such as "d41d8cd98f00b204e9800998ecf8427e". It can be seen that this hash function is compatible with the md5 algorithm. You can replace both "md5" in the above code with "sha1" and run it again to test the effect of the sha1 algorithm.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364356.htmlTechArticleLieHuo.Net tutorial Starting from PHP5.1.2, PHP has added a new hash engine. This engine Provides up to 35 different hash algorithms including md5 algorithm and sha1 algorithm. Let's...
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