A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/332974.html below:

CRC16

CRC16Raymond L. Buvel levub137 at wi.rr.com
Fri Sep 23 19:02:33 EDT 2005
Tuvas wrote:
> Anyone know a module that does CRC16 for Python? I have an aplication
> that I need to run it, and am not having alot of sucess. I have a
> program in C that uses a CRC16 according to CCITT standards, but need
> to get a program that tests it with python as well. Thanks!
> 

Try this one

http://crcmod.sourceforge.net/

It will do what you want as long as you know what polynomial to use and
what type of algorithm.  I think you want the CCITT polynomial with a
bit-reverse algorithm.  If that is the case, the following will generate
the Python function you want (assumes you want to seed the CRC
calculation with the starting value of 0xffff).

import crcmod
crc16 = crcmod.mkCrcFun(0x11021, 0xffff, True)

Now compute the crc of a data string as

crc = crc16(data)

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4