Crc16Ccitt Class |
Namespace: VirtualRadar.Interface
The Crc16Ccitt type exposes the following members.
Name | Description | |
---|---|---|
Crc16Ccitt |
Creates a new object.
|
Name | Description | |
---|---|---|
ComputeChecksum(Byte) |
Returns the CRC-16-CCITT checksum for the array of bytes passed across using the standard calculation.
| |
ComputeChecksum(Byte, Int32, Int32) |
Returns the CRC-16-CCITT checksum for the array of bytes passed across using the standard calculation.
| |
ComputeChecksumBytes(Byte, Boolean) |
Returns the CRC-16-CCITT checksum for the array of bytes passed across using the standard calculation.
| |
ComputeChecksumBytes(Byte, Int32, Int32, Boolean) |
Returns the CRC-16-CCITT checksum for the array of bytes passed across using the standard calculation.
| |
ComputeChecksumDrDobbs |
Returns the CRC-16-CCITT checksum for the array of bytes passed across using the Dr. Dobbs algorithm.
| |
ComputeChecksumDrDobbsBytes |
Returns the CRC-16-CCITT checksum for the array of bytes passed across using the Dr. Dobbs algorithm.
| |
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
InitialiseToAllOnes |
An initial CRC value of all-ones.
| |
InitialiseToZero |
An initial CRC value of zero.
|
Two algorithms were found that described themselves as CCITT-16 CRC calculators - the one that is used by Kinetic (and at least four other entities) and the one described in the Dr. Dobbs journal. The Dr. Dobbs one is included for the sake of completeness.
The Kinetic version was copied from the Sanity Free Coding blog - http://sanity-free.org/133/crc_16_ccitt_in_csharp.html. Note that the checksum that Kinetic use on SBS-3 packets is using an initial CRC value of zero. I modified the method that returns a byte array because Kinetic's CRC is sent big-endian and the original was returning it little-endian.
A second implementation of the standard algorithm was found here - http://www.ccsinfo.com/forum/viewtopic.php?t=24977. It purported to be faster than the lookup table version, which is probably true for implementations in hardware or languages that compile straight to assembly but was not found to be the case in testing under C#, it was marginally slower than Sanity Free Coding's implementation.
The Dr. Dobbs version was copied from the Dr. Dobbs journal site - http://www.drdobbs.com/implementing-the-ccitt-cyclical-redundan/199904926. The implementation here has been tested against the expected checksum in the examples listing on that page.