Thanks for THAT information, I thought it was an arbitrary number, that would produce different hash results. WOW that would have had me going in a mental loop for a while.
The code that I posted will generate the stadard ITU 16-bit CRC for a block of "num" bytes starting at the address in "ptr". This routine assumes that the data is transmitted LSB first. If the data is transmitted MSB first a different routine would be needed, which would use a polynomial word of $8408 instead of $1021, which is the bit-reversed version of $8408. If you want to use this to generate a 16-bit hash code of a string you would do something like hash := ComputeCRC(@strbuf, strsize(@strbuf))
Comments
That was quick. Have you used this successfully?
I assume the ptr is to the data. And what is an example of a good "num" parameter?
Bruce
If at all possible, could you please provide an example of use on both ends? Never mind, I think I got it.
Bruce
If you look at the code, you'll see that the CRC calculation loop is repeated "num" times, so "num" must be the byte count.
Thanks for THAT information, I thought it was an arbitrary number, that would produce different hash results. WOW that would have had me going in a mental loop for a while.
Bruce
The code that I posted will generate the stadard ITU 16-bit CRC for a block of "num" bytes starting at the address in "ptr". This routine assumes that the data is transmitted LSB first. If the data is transmitted MSB first a different routine would be needed, which would use a polynomial word of $8408 instead of $1021, which is the bit-reversed version of $8408. If you want to use this to generate a 16-bit hash code of a string you would do something like hash := ComputeCRC(@strbuf, strsize(@strbuf))
Dave
Thanks for that information. I appreciate you sharing your snippet
Bruce