[Patches] Add crc32() method to binascii
Tim Peters
tim_one@email.msn.com
Sat, 12 Feb 2000 15:19:21 -0500
> This patch adds a new method to module binascii. It calculates
> a CRC-32 checksum. ...
Notes on this patch:
+ Format: The crc_32_tab initializer extends thru column 96; it shouldn't
go beyond column 80.
+ Semantics: "UL" should be appended to all unsigned long literals, to
prevent surprises on 64-bit machines (untagged literals are ints in C, and
0xFFF... is -1 on most machines, even the 64-bit ones). Note that this
includes all the literals in the crc_32_tab initializer.
+ Test: "If it's not tested, it's broken." A test of this function needs
to be added to the std test suite.
> This method is generally useful, and is
> required for ZIP file checksums. Use as follows:
>
> print binascii.crc32("hello world")
> # Or, in two pieces:
> crc = binascii.crc32("hello")
> crc = binascii.crc32(" world", crc)
> print crc
This example should be in the docs, not in checkin mail commentary. I
couldn't guess from the docs that this is supported usage (although I can
reverse-engineer it from the code).
pickily y'rs - tim