Home > Backend Development > PHP Problem > What does md5 convert the value to in php?

What does md5 convert the value to in php?

WBOY
Release: 2023-03-15 15:50:01
Original
2262 people have browsed it

In PHP, the md5() function can convert the value into a calculated MD5 hash. This function is used to calculate the MD5 hash of the string. If the function fails, the returned result is false. Syntax It is "md5 (string to be calculated, hexadecimal or binary output format)".

What does md5 convert the value to in php?

The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer.

What does md5 convert the value to in php

The md5() function calculates the MD5 hash of the string.

The md5() function uses RSA data security, including the MD5 message digest algorithm.

The syntax is as follows:

md5(string,raw)
Copy after login

The parameters are as follows:

string Required. Specifies the string to be calculated.

raw Optional. Specifies hexadecimal or binary output format:

  • ##TRUE - raw 16 character binary format

  • FALSE - default. The 32-character hexadecimal number

returns the result:

If successful, the calculated MD5 hash is returned, if failed, FALSE

# is returned ##Examples are as follows:

<?php
$str = "Shanghai";
echo "字符串:".$str."<br>";
echo "TRUE - 原始 16 字符二进制格式:".md5($str, TRUE)."<br>";
echo "FALSE - 32 字符十六进制格式:".md5($str)."<br>";
?>
Copy after login

Output results:


What does md5 convert the value to in php? Recommended learning: "

PHP Video Tutorial

"

The above is the detailed content of What does md5 convert the value to in php?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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