note 72569 added to function.crc32

From: Date: Wed, 24 Jan 2007 18:09:23 +0000
Subject: note 72569 added to function.crc32
Groups: php.notes 
Request: Send a blank email to php-notes+get-122148@lists.php.net to get a copy of this message
Mathematical coincidence, and too sparse a test data set. The routines I provided below do NOT work. This one appears to, and is based on examination of the source for the PHP crc32() routine. <?php function packetize($string) { return $string . pack("V", ~crc32($string)); } function verify($packet) { if (~crc32($packet) == 0) return substr($packet, 0, -4); return false; } ?> Similarly, the following appear to be both numerically and formally correct. <?php echo crc32("\x01\x02\x03\x04")."\n"; echo ~mycrc32(0x04030201, 32, 0xEDB88320, 0xffffffff)."\n"; echo ~mycrc32(0x04, 8, 0xEDB88320, mycrc32(0x03, 8, 0xEDB88320, mycrc32(0x02, 8, 0xEDB88320, mycrc32(0x01, 8, 0xEDB88320, 0xffffffff))))."\n"; ?> ---- Server IP: 64.71.164.2 Probable Submitter: 24.9.89.42 ---- Manual Page -- http://www.php.net/manual/en/function.crc32.php Edit -- https://master.php.net/note/edit/72569 Del: integrated -- https://master.php.net/note/delete/72569/integrated Del: useless -- https://master.php.net/note/delete/72569/useless Del: bad code -- https://master.php.net/note/delete/72569/bad+code Del: spam -- https://master.php.net/note/delete/72569/spam Del: non-english -- https://master.php.net/note/delete/72569/non-english Del: in docs -- https://master.php.net/note/delete/72569/in+docs Del: other reasons-- https://master.php.net/note/delete/72569 Reject -- https://master.php.net/note/reject/72569 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122148) next »