From 97384dfb6ce4e47b49feb6d5634dfc20e028d4b5 Mon Sep 17 00:00:00 2001 From: lenkis <elena.shebunyaeva@gmail.com> Date: Mon, 4 Jul 2016 19:20:59 +0300 Subject: [PATCH] Fixes #1593: Fix digest.crc32 description --- doc/sphinx/reference/digest.rst | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/sphinx/reference/digest.rst b/doc/sphinx/reference/digest.rst index 3f2b650f0d..2eaca2c962 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 -- GitLab