CRC 16bit function

Dave Angel davea at ieee.org
Thu Jan 20 22:10:00 EST 2011


On 01/-10/-28163 02:59 PM, geremy condra wrote:
> On Thu, Jan 20, 2011 at 4:03 PM, SANKAR .<shankarphy at gmail.com>  wrote:
>> Hi There,
>>
>> I am looking for buitin function to calculate  16 bit checksum values of the
>> lines in text file using python.
>> I could find one for 32 bit but not for 16 bit. Can some one help me?
>
> Google's your friend.
>
> http://efreedom.com/Question/1-1767910/Checksum-Udp-Calculation-Python
>
> Geremy Condra
>

There are at least 3 commonly used checksum algorithms that give 16bit 
results.  Two of them are CRC's, with different polynomials.  And the 
third is the one's complement that Geremy posted the link to, used in 
tcp/ip traffic.

Try http://bytes.com/topic/python/answers/27677-crc-16-a
   or
http://bytes.com/topic/python/insights/887357-python-check-crc-frame-crc-16-ccitt

The latter is likely to be extremely slow.

DaveA



More information about the Python-list mailing list