'Fletcher 32-bit checksum test vectors
I've got some C# code (but the language is irrelevant) that generates a 32-bit Fletcher checksum on an array of 16-bit words. My issue is that I've implemented an optimized algorithm, and after an hour or more of searching the web, I can only find test vectors "abcde", "abcdef", and "abcdefgh" on wikipedia.
I'm hoping that someone has some vectors that they can provide to me to help me verify a correct implementation; OR someone can reproduce my test vectors with the following code and get the same answers that I got.
My checksum code seeds the summation values with 0xFFFF before the first summation, so if I need to change the seed value before testing against someone else's vectors, that's fine. Adding a seed value to the constructor is a trivial exercise.
I realize that there may be other applications or web pages that I can use to test as well, but I've not been able to find them.
My vector generation code:
byte[] d1 = new byte[1878];
byte[] d2 = new byte[60];
byte[] d3 = new byte[61];
byte[] d4 = new byte[900];
byte[] d5 = new byte[901];
for( int i = 0; i < d1.Length; ++i )
{
d1[i] = (byte)( 13 * i );
}
Array.Copy( d1, 0, d2, 0, 60 );
Array.Copy( d1, 0, d3, 0, 61 );
Array.Copy( d1, 100, d4, 0, 900 );
Array.Copy( d1, 100, d5, 0, 901 );
And the checksum calculated on my vectors:
Checksum of array data[0:60] = 0xE35DC23D
Checksum of array data[0:61] = 0xA5A7C249
Checksum of array data[100:1000] = 0xBDDF3B63
Checksum of array data[100:1001] = 0xFA0A3C2B
Checksum of array data[] = 0xCBD2B70C
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
