note 119195 added to function.md5
| From: | radon8472 at radon-software dot net | Date: | Mon, 18 Apr 2016 14:10:19 +0000 |
| Subject: | note 119195 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205262@lists.php.net to get a copy of this message | ||
<?php
function raw2hex($rawBinaryChars)
{
return = array_pop(unpack('H*', $rawBinaryChars));
}
?>
The complement of hey2raw.
You can use to convert from raw md5-format to human-readable format.
This can be usefull to check "Content-Md5" HTTP-Header.
<?php
$rawMd5 = base64_decode($_SERVER['HTTP_CONTENT_MD5']);
$post_data = file_get_contents("php://input");
if(raw2hex($rawMd5) == md5($post_data)) // Post-Data is okay
else // Post-Data is currupted
?>
----
Server IP: 72.52.91.14
Probable Submitter: 212.80.238.81
----
Manual Page -- http://php.net/manual/en/function.md5.php
Edit -- https://master.php.net/note/edit/119195
Del: integrated -- https://master.php.net/note/delete/119195/integrated
Del: useless -- https://master.php.net/note/delete/119195/useless
Del: bad code -- https://master.php.net/note/delete/119195/bad+code
Del: spam -- https://master.php.net/note/delete/119195/spam
Del: non-english -- https://master.php.net/note/delete/119195/non-english
Del: in docs -- https://master.php.net/note/delete/119195/in+docs
Del: other reasons-- https://master.php.net/note/delete/119195
Reject -- https://master.php.net/note/reject/119195
Search -- https://master.php.net/manage/user-notes.php