| Server IP : 172.67.216.113 / Your IP : 104.23.243.32 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/simded.com/horo2/seamsi/ |
Upload File : |
<?php
error_reporting(E_ALL);
function hash_adler32_wrapper($data) {
$digHexStr = hash("adler32", $data);
// If version is better than 5.2.11 no further action necessary
if (version_compare(PHP_VERSION, '5.2.11', '>=')) {
return $digHexStr;
}
// Workaround #48284 by swapping byte order
$boFixed = array();
$boFixed[0] = $digHexStr[6];
$boFixed[1] = $digHexStr[7];
$boFixed[2] = $digHexStr[4];
$boFixed[3] = $digHexStr[5];
$boFixed[4] = $digHexStr[2];
$boFixed[5] = $digHexStr[3];
$boFixed[6] = $digHexStr[0];
$boFixed[7] = $digHexStr[1];
return implode("", $boFixed);
}
// Test fixture, plus expected output generated using the adler32 from zlib
$data_in = "abc";
$expected_out = 0x024d0127;
// PHP's hash function returns a hex hash value as a string so hexdec used to
// convert to number
$hash_out = hexdec(hash("adler32", $data_in));
// Get value via the wrapper function
$wrapper_out = hexdec(hash_adler32_wrapper($data_in));
printf("data_in: %s\n", $data_in);
printf("expected_out: 0x%08x\n", $expected_out);
printf("builtin hash out: 0x%08x, %s\n", $hash_out,
($hash_out == $expected_out)? "OK" : "NOT OK");
printf("wrapper func out: 0x%08x, %s\n", $wrapper_out,
($wrapper_out == $expected_out)? "OK" : "NOT OK");
?>
<?php
$dataStr = "abc";
$crcStr = hash('adler32', $dataStr);
?>