| 12 | const int MOD_ADLER = 65521; |
| 13 | |
| 14 | uint64_t adler32(unsigned char *data, int32_t len) /* where data is the location of the data in physical memory and |
| 15 | len is the length of the data in bytes */ |
| 16 | { |
| 17 | uint64_t a = 1, b = 0; |
| 18 | int32_t index; |
| 19 | |
| 20 | /* Process each byte of the data in order */ |
| 21 | for (index = 0; index < len; ++index) |
| 22 | { |
| 23 | a = (a + data[index]) % MOD_ADLER; |
| 24 | b = (b + a) % MOD_ADLER; |
| 25 | } |
| 26 | |
| 27 | return (b << 16) | a; |
| 28 | } |
| 29 | |
| 30 | int main(int argc, char* argv[]) { |
| 31 | long bufsize; |