I am calling two functions on my char* s = "pratik":
Using zlib.h
#include <zlib.h>
int main()
{
char *s = "pratik";
printf("%x\n", crc32(0x80000000, s, strlen(s)));
return 0;
}
Output: 66fa3c99
Using linux/crc32.h
#include <linux/crc32.h>
int main()
{
char *s = "pratik";
printf("%x\n", crc32(0x80000000, s, strlen(s)));
return 0;
}
Output: d7389d3a
Why are the values of the checksums on the same strings different?
strlen(6)... are you sure?crc32inlinux/crc32.h. Can you try callingcrc32_beinstead?0x80000000by0x00000080maybe)? To ensure that the seed is not causing the problem, I suggest you set it to 0 and compare the twocrc32versions again.