# HG changeset patch # Parent 40f1b06ec989de042da52ac7c409febc9de59770 Issue #NNNNN: Document binascii.crc_hqx() implements CRC-CCITT diff -r 40f1b06ec989 Doc/library/binascii.rst --- a/Doc/library/binascii.rst Sun Dec 18 01:37:12 2016 +0000 +++ b/Doc/library/binascii.rst Sun Dec 18 10:43:07 2016 +0000 @@ -116,8 +116,10 @@ .. function:: crc_hqx(data, value) - Compute the binhex4 crc value of *data*, starting with *value* as the - initial crc, and return the result. + Compute a 16-bit CRC value of *data*, starting with *value* as the + initial CRC, and return the result. This uses the CRC-CCITT polynomial + ``x**16 + x**12 + x**5 + 1``, often represented as 0x1021. + This CRC is used in the binhex4 format. .. function:: crc32(data[, value]) diff -r 40f1b06ec989 Modules/binascii.c --- a/Modules/binascii.c Sun Dec 18 01:37:12 2016 +0000 +++ b/Modules/binascii.c Sun Dec 18 10:43:07 2016 +0000 @@ -900,12 +900,12 @@ crc: unsigned_int(bitwise=True) / -Compute hqx CRC incrementally. +Compute CRC-CCITT incrementally. [clinic start generated code]*/ static unsigned int binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc) -/*[clinic end generated code: output=8ec2a78590d19170 input=add8c53712ccceda]*/ +/*[clinic end generated code: output=8ec2a78590d19170 input=f18240ff8c705b79]*/ { const unsigned char *bin_data; Py_ssize_t len; diff -r 40f1b06ec989 Modules/clinic/binascii.c.h --- a/Modules/clinic/binascii.c.h Sun Dec 18 01:37:12 2016 +0000 +++ b/Modules/clinic/binascii.c.h Sun Dec 18 10:43:07 2016 +0000 @@ -263,7 +263,7 @@ "crc_hqx($module, data, crc, /)\n" "--\n" "\n" -"Compute hqx CRC incrementally."); +"Compute CRC-CCITT incrementally."); #define BINASCII_CRC_HQX_METHODDEF \ {"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_VARARGS, binascii_crc_hqx__doc__}, @@ -550,4 +550,4 @@ return return_value; } -/*[clinic end generated code: output=1f8d6e48f75f6d1e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=458eb09731cb7877 input=a9049054013a1b77]*/