Home  >  Article  >  Backend Development  >  php md5加密函数参考详解_PHP教程

php md5加密函数参考详解_PHP教程

WBOY
WBOYOriginal
2016-07-13 17:10:131265browse

很多php开发者都会使用这个md()加密函数,但其中的参考有些朋友未必知道了,今天我们来看看md5()函数的参数吧.

语法
md5(string,raw)

md5() 函数计算字符串的 MD5 散列


string 必需。规定要计算的字符串

charlist

可选。规定十六进制或二进制输出格式:
TRUE - 原始 16 字符二进制格式
FALSE - 默认。32 字符十六进制数
注释:该参数是 PHP 5.0 中添加的。
 

 代码如下 复制代码


$str ="123456";
echo 'md5 16位'.md5($str,true);

//输出乱码

//如果你想得到php5中md5( "abc ",   true)这样的返回值,那么可以:
function   bin_md5($val)   {
    return   pack( "H32 ",md5($val));
}

 

echo '
md5 32位'.md5($str);

//10adc3949ba59abbe56e057f20f883e
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/629695.htmlTechArticle很多php开发者都会使用这个md()加密函数,但其中的参考有些朋友未必知道了,今天我们来看看md5()函数的参数吧. 语法 md5(string,raw) md5() 函数...
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