Add crc32 function
This commit is contained in:
parent
88becd6097
commit
43ac716bf2
3 changed files with 65 additions and 0 deletions
12
libmineziper/src/libmineziper_crypto.c
Normal file
12
libmineziper/src/libmineziper_crypto.c
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include "libmineziper_crypto.h"
|
||||
|
||||
unsigned int xcrc32(const unsigned char *buf, int len, unsigned int init)
|
||||
{
|
||||
unsigned int crc = init;
|
||||
while (len--)
|
||||
{
|
||||
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ *buf) & 255];
|
||||
buf++;
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue