Print the result of sha1() and compare hash value with string in PHP

Description

The following code shows how to print the result of sha1() and compare hash value with string.

Example


//  w w w .j a va2s.  c  o  m
<?php
    $str = "Hello";
    echo sha1($str);

    if (sha1($str) == "f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0"){
       echo "<br>Hello world!";
       exit;
    }
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Development »




Environment
Error
Hash
Include
Locale
Math
Network
Output
Reflection
PHP Regular Expressions