summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-12-24 07:36:44 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-12-24 07:36:44 (GMT)
commit3310e146cc54e7b4e76641c57272ba6c12367876 (patch)
tree767f4f38eaf518e9cf4adf7e085f8b44d55996b6
parent972e04ec4666746dc8a441449aa5b63f89af5b98 (diff)
downloadcpython-3310e146cc54e7b4e76641c57272ba6c12367876.zip
cpython-3310e146cc54e7b4e76641c57272ba6c12367876.tar.gz
cpython-3310e146cc54e7b4e76641c57272ba6c12367876.tar.bz2
Issue #29004: Document binascii.crc_hqx() implements CRC-CCITT
-rw-r--r--Doc/library/binascii.rst6
-rw-r--r--Modules/binascii.c4
-rw-r--r--Modules/clinic/binascii.c.h4
3 files changed, 8 insertions, 6 deletions
diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst
index 878d8db..49da59a 100644
--- a/Doc/library/binascii.rst
+++ b/Doc/library/binascii.rst
@@ -115,8 +115,10 @@ The :mod:`binascii` module defines the following functions:
.. 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*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as
+ 0x1021. This CRC is used in the binhex4 format.
.. function:: crc32(data[, value])
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 1a40b41..125c1cb 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -915,12 +915,12 @@ binascii.crc_hqx -> unsigned_int
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]*/
{
unsigned char *bin_data;
Py_ssize_t len;
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index e20cac2..6ace4d5 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -246,7 +246,7 @@ PyDoc_STRVAR(binascii_crc_hqx__doc__,
"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__},
@@ -516,4 +516,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=51173fc9718a5edc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6d70d5edd9373d92 input=a9049054013a1b77]*/