note 86628 added to function.crc32
| From: | lenar at city dot ee | Date: | Mon, 27 Oct 2008 08:25:50 +0000 |
| Subject: | note 86628 added to function.crc32 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145791@lists.php.net to get a copy of this message | ||
Simplest/fastest crc16 (CRC-CCITT-16 0x1021) implementation I could find:
(and credit goes to http://www.ccsinfo.com/forum/viewtopic.php?t=24977)
<?php
function crc16($data)
{
$crc = 0xFFFF;
for ($i = 0; $i < strlen($data); $i++)
{
$x = (($crc >> 8) ^ ord($data[$i])) & 0xFF;
$x ^= $x >> 4;
$crc = (($crc << 8) ^ ($x << 12) ^ ($x << 5) ^ $x) & 0xFFFF;
}
return $crc;
}
----
Server IP: 212.47.220.13
Probable Submitter: 194.126.102.178
----
Manual Page -- http://www.php.net/manual/en/function.crc32.php
Edit -- https://master.php.net/note/edit/86628
Del: integrated -- https://master.php.net/note/delete/86628/integrated
Del: useless -- https://master.php.net/note/delete/86628/useless
Del: bad code -- https://master.php.net/note/delete/86628/bad+code
Del: spam -- https://master.php.net/note/delete/86628/spam
Del: non-english -- https://master.php.net/note/delete/86628/non-english
Del: in docs -- https://master.php.net/note/delete/86628/in+docs
Del: other reasons-- https://master.php.net/note/delete/86628
Reject -- https://master.php.net/note/reject/86628
Search -- https://master.php.net/manage/user-notes.php