note 120040 added to function.hash-hmac
| From: | MichielThalen | Date: | Thu, 13 Oct 2016 15:54:40 +0000 |
| Subject: | note 120040 added to function.hash-hmac | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206881@lists.php.net to get a copy of this message | ||
As Michael uggests we should take care not to compare the hash using == (or ===). Since PHP
version 5.6 we can now use hash_equals().
So the example will be:
<?php
if (hash_equals($hashed_expected, $hashed_value) ) {
echo "hashes match!";
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 83.86.139.48
----
Manual Page -- http://php.net/manual/en/function.hash-hmac.php
Edit -- https://master.php.net/note/edit/120040
Del: integrated -- https://master.php.net/note/delete/120040/integrated
Del: useless -- https://master.php.net/note/delete/120040/useless
Del: bad code -- https://master.php.net/note/delete/120040/bad+code
Del: spam -- https://master.php.net/note/delete/120040/spam
Del: non-english -- https://master.php.net/note/delete/120040/non-english
Del: in docs -- https://master.php.net/note/delete/120040/in+docs
Del: other reasons-- https://master.php.net/note/delete/120040
Reject -- https://master.php.net/note/reject/120040
Search -- https://master.php.net/manage/user-notes.php