1 // SPDX-License-Identifier: GPL-2.0-only
2 /* crc32hash.c - derived from linux/lib/crc32.c, GNU GPL v2 */
4 $ ./crc32hash "Dual Speed"
12 static unsigned int crc32(unsigned char const *p
, unsigned int len
)
18 for (i
= 0; i
< 8; i
++)
19 crc
= (crc
>> 1) ^ ((crc
& 1) ? 0xedb88320 : 0);
24 int main(int argc
, char **argv
) {
27 printf("no string passed as argument\n");
30 result
= crc32((unsigned char const *)argv
[1], strlen(argv
[1]));
31 printf("0x%x\n", result
);