in reply to Checksum Help Again
First of all , if you're doing this in C , the checksum variable will overflow due to it being a uint32 and you are adding up to it uint32s formed of bytes from the text and depending on the length of the text ... you will most likely have an overflow in checksum, which you should judge as a good/bad algorithm.
If you would've taken a look at the documentation of the unpack function you would have seen an example of exactly what you're trying to achieve , except for the fact that they are taking the checksum modulo 2^16 - 1
P.S. : The pack documentation is more useful since it explains the "%32W*"$checksum = do { local $/; # slurp! unpack("%32W*",<>) % 65535; };
|
|---|