Home >php教程 >php手册 >PHP5的新型混淆(Hash)方式

PHP5的新型混淆(Hash)方式

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:38:18961browse

  帮客之家(www.Bkjia.com)教程 从PHP5.1.2开始,PHP增加了新的hash引擎,该引擎提供了包括md5算法,sha1算法在内的多达35种的不同的hash算法。

  下面让我们实际测试一下效果(PHP5):

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

  运行上面的代码,会发现两个为"d41d8cd98f00b204e9800998ecf8427e"这样的一样的值。可见这个hash函数兼容md5算法。可以把上面代码中的两个"md5"都替换成"sha1",再次运行一下,就可以测试sha1算法的效果。

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