PHP md5 encryption function reference detailed explanation_PHP tutorial

WBOY
Release: 2016-07-13 17:10:13
Original
1389 people have browsed it

Many PHP developers will use this md() encryption function, but some friends may not know the reference. Today we will take a look at the parameters of the md5() function.

Grammar
md5(string,raw)

md5() function calculates the MD5 hash of a string


string required. Specifies the string to be calculated

charlist

Optional. Specify hexadecimal or binary output format:
TRUE - raw 16 character binary format
FALSE - Default. 32 character hexadecimal number
Note: This parameter was added in PHP 5.0.

The code is as follows
 代码如下 复制代码

$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
?>

Copy code
$str ="123456";

echo 'md5 16-bit'.md5($str,true);

//If you want to get the return value of md5("abc", true) in php5, then you can: function bin_md5($val) { Return pack( "H32 ",md5($val)); } echo '
md5 32-bit'.md5($str); //10adc3949ba59abbe56e057f20f883e ?>
http://www.bkjia.com/PHPjc/629695.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629695.htmlTechArticleMany PHP developers will use this md() encryption function, but some friends may not know the reference. Today Let's take a look at the parameters of the md5() function. Syntax md5(string,raw) md5() function...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template