[Python-checkins] cpython (merge 3.5 -> 3.6): Issue #29004: Merge crc_hqx() doc from 3.5

martin.panter python-checkins at python.org
Sat Dec 24 03:18:22 EST 2016


https://hg.python.org/cpython/rev/52db2072e88b
changeset:   105802:52db2072e88b
branch:      3.6
parent:      105801:d70fcf1866ad
parent:      105800:a33472f8a2c6
user:        Martin Panter <vadmium+py at gmail.com>
date:        Sat Dec 24 07:44:03 2016 +0000
summary:
  Issue #29004: Merge crc_hqx() doc from 3.5

files:
  Doc/library/binascii.rst    |  6 ++++--
  Modules/binascii.c          |  4 ++--
  Modules/clinic/binascii.c.h |  4 ++--
  3 files changed, 8 insertions(+), 6 deletions(-)


diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst
--- a/Doc/library/binascii.rst
+++ b/Doc/library/binascii.rst
@@ -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*: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
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -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 --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -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]*/

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list