note 28012 added to function.crc32
| From: | spectrumizer at cycos dot net | Date: | Sun, 29 Dec 2002 21:30:51 +0000 |
| Subject: | note 28012 added to function.crc32 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41428@lists.php.net to get a copy of this message | ||
Why do you post non-working and somehow bogus-looking code, Martin? It also didn't work for me
and it is not the Standard-CRC16-Algorithm ... anyway ... here is a tested and working
CRC16-Algorithm:
function crc16($string) {
$crc = 0xFFFF;
for ($x = 0; $x < strlen ($string); $x++) {
$crc = $crc ^ ord($string[$x]);
for ($y = 0; $y < 8; $y++) {
if (($crc & 0x0001) == 0x0001) {
$crc = (($crc >> 1) ^ 0xA001);
} else { $crc = $crc >> 1; }
}
}
return $crc;
}
Regards,
Mario
--
http://www.php.net/manual/en/function.crc32.php
http://master.php.net/manage/user-notes.php?action=edit+28012
http://master.php.net/manage/user-notes.php?action=delete+28012
http://master.php.net/manage/user-notes.php?action=reject+28012