Home > Article > Backend Development > PHP5’s new obfuscation (Hash) method_PHP tutorial
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.