Apparently the PHP function hash()
can be called with the algorithms crc32
and crc32b
? What is the difference between them?
Two different algorithms. CRC32b is an implementation of the consistency algorithm defined here, whereas CRC32 is the frame check sequence defined here. They're different things, though the differences are not often big.
One way to check this:
<?php
echo hash("crc32", __FILE__)."<br/>";
echo hash("crc32b", __FILE__); ?>
Due to their similarity, the starting hex values will be relatively similar.
As per answer by apm on php.net: "I have verified that the output of the "crc32" is the ITU I.363.5 algorithm (a.k.a. AAL5 CRC - popularised by BZIP2 but also used in ATM transmissions - the algorithm is the same as that in POSIX 1003.2-1992 in Cksum but that stuffs the size into the CRC at the end for extra measure). -- The crc32b is the 32-bit Frame Check Sequence of ITU V.42 (used in Ethernet and popularised by PKZip). The output from this CRC is popularised in Intel little endian format and would produce cbf43926 on the same file."
The full comment: http://www.php.net/manual/en/function.hash-file.php#104836
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With