diff --git a/doc/sphinx/reference/digest.rst b/doc/sphinx/reference/digest.rst index 3f2b650f0d93f6231b2bfaea227a77fbf0e0e7d6..2eaca2c9626f53a471c7f756271bb56249e53633 100644 --- a/doc/sphinx/reference/digest.rst +++ b/doc/sphinx/reference/digest.rst @@ -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