Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3310e14

Browse files
committed
Issue #29004: Document binascii.crc_hqx() implements CRC-CCITT
1 parent 972e04e commit 3310e14

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

Doc/library/binascii.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ The :mod:`binascii` module defines the following functions:
115115

116116
.. function:: crc_hqx(data, value)
117117

118-
Compute the binhex4 crc value of *data*, starting with *value* as the
119-
initial crc, and return the result.
118+
Compute a 16-bit CRC value of *data*, starting with *value* as the
119+
initial CRC, and return the result. This uses the CRC-CCITT polynomial
120+
*x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as
121+
0x1021. This CRC is used in the binhex4 format.
120122

121123

122124
.. function:: crc32(data[, value])

Modules/binascii.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,12 @@ binascii.crc_hqx -> unsigned_int
915915
crc: unsigned_int(bitwise=True)
916916
/
917917
918-
Compute hqx CRC incrementally.
918+
Compute CRC-CCITT incrementally.
919919
[clinic start generated code]*/
920920

921921
static unsigned int
922922
binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc)
923-
/*[clinic end generated code: output=8ec2a78590d19170 input=add8c53712ccceda]*/
923+
/*[clinic end generated code: output=8ec2a78590d19170 input=f18240ff8c705b79]*/
924924
{
925925
unsigned char *bin_data;
926926
Py_ssize_t len;

Modules/clinic/binascii.c.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ PyDoc_STRVAR(binascii_crc_hqx__doc__,
246246
"crc_hqx($module, data, crc, /)\n"
247247
"--\n"
248248
"\n"
249-
"Compute hqx CRC incrementally.");
249+
"Compute CRC-CCITT incrementally.");
250250

251251
#define BINASCII_CRC_HQX_METHODDEF \
252252
{"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_VARARGS, binascii_crc_hqx__doc__},
@@ -516,4 +516,4 @@ binascii_b2a_qp(PyObject *module, PyObject *args, PyObject *kwargs)
516516

517517
return return_value;
518518
}
519-
/*[clinic end generated code: output=51173fc9718a5edc input=a9049054013a1b77]*/
519+
/*[clinic end generated code: output=6d70d5edd9373d92 input=a9049054013a1b77]*/

0 commit comments

Comments
 (0)