【函数功能】
该函数计算指定字符串的 MD5 散列。
	【函数语法】
md5 ($str, $raw_output = null) 
	【参数说明】
$str:必需,要计算的字符串。
$raw_output:可选,十六进制或二进制输出格式:
TRUE - 原始 16 字符二进制格式
FALSE - 默认。32 字符十六进制数
	【演示程序】
<?php
        /**
         * md5 ($str, $raw_output = null) 
         * **/
        $str = "hello i am PHP!";
        echo md5($str);
        echo '<br>';
        $string = md5($str,true);
         echo $string;
         echo '<br>';
         //16位加密后的md5值有不可见的字符,所以我们采用下面的方法将他们的ASCII码值打印出来看一下
        while(strlen($string)>0){
            echo ord($string).'-';
            $string = substr($string, 1,strlen($string)-1);
        }
?>
	【输出结果】
c0ee61f9660a7bbb660e5d69dc7f1a4a
??a?f {?f]i?J
192-238-97-249-102-10-123-187-102-14-93-105-220-127-26-74-
	【特别注意】
1.函数使用 RSA 数据安全,包括 MD5 报文摘要算法。
2.若指定字符串为空则返回false。
3.采用16位格式时直接打印会有乱码。
4.PHP 版本:4+。
5.更新日志:在 PHP 5.0 中,$raw_output 参数变为可选的。
	【原版定义】
/**
 * Calculate the md5 hash of a string
 * @link http://www.php.net/manual/en/function.md5.php
 * @param str string <p>
 * The string.
 * </p>
 * @param raw_output bool[optional] <p>
 * If the optional raw_output is set to true,
 * then the md5 digest is instead returned in raw binary format with a
 * length of 16.
 * </p>
 * @return string the hash as a 32-character hexadecimal number.
 */
转载请注明出处:php1234.cn ,原文地址:http://www.php1234.cn/a/functions/2016/1101/112.html