Home >Backend Development >PHP Tutorial >In PHP, what does hash function mean?

In PHP, what does hash function mean?

WBOY
WBOYforward
2023-09-03 08:49:071031browse

In PHP, what does hash function mean?

#A hash function is any function that can be used to map data of any size to data of a fixed size. The value returned by a hash function is called a hash value, hash code, digest, or simply hash.

Syntax

string hash( string $algo , string $data [, bool $raw_output = FALSE ] )

Parameters

algo

The name of the selected hash algorithm (such as "md5", "sha256", "haval160,4" etc.)

data

The message to be hashed.

raw_output

When set to TRUE, raw binary data is output. FALSE outputs lowercase hexadecimal.

Example

<?php
   echo hash(&#39;sha256&#39;, &#39;Weelcome Tutorials Point&#39;);
?>

Output

dacbedc476c664e457b165580dd5eb491bc027c914504066c51f56b1116d56e0

The above is the detailed content of In PHP, what does hash function mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete