Skip to content
Snippets Groups Projects
Commit 97384dfb authored by lenkis's avatar lenkis
Browse files

Fixes #1593: Fix digest.crc32 description

parent 4efffe45
No related branches found
No related tags found
No related merge requests found
......@@ -79,16 +79,28 @@ Returns array of random bytes with length = integer.
Returns 32-bit checksum made with CRC32.
The crc32 and crc32_update functions use the `CRC-32C (Castagnoli)`_ polynomial
value: 0x11EDC6F41 / 4812730177. If it is necessary to be
value: 0x1EDC6F41 / 4812730177. If it is necessary to be
compatible with other checksum functions in other
programming languages, ensure that the other functions use
the same polynomial value. |br| For example, in Python,
install the crcmod package and say:
the same polynomial value.
For example, in Python, install the ``crcmod`` package and say:
>>> import crcmod
>>> fun = crcmod.mkCrcFun('4812730177')
>>> fun('string')
3304160206L
In Perl, install the ``Digest::CRC`` module and run the following code:
.. code-block:: perl
use Digest::CRC;
$d = Digest::CRC->new(width => 32, poly => 0x1EDC6F41, init => 0xFFFFFFFF, refin => 1, refout => 1);
$d->add('string');
print $d->digest;
(the expected output is 3304160206).
.. _CRC-32C (Castagnoli): https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Standards_and_common_use
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment