mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-13 07:57:35 +00:00
15 lines
328 B
C
15 lines
328 B
C
/* radare - LGPL - Copyright 2013-2016 pancake */
|
|
|
|
#include <r_hash.h>
|
|
|
|
R_API ut32 r_hash_adler32(const ut8 *data, int len) {
|
|
static const int MOD_ADLER = 65521;
|
|
ut32 a = 1, b = 0;
|
|
int index;
|
|
for (index = 0; index < len; index++) {
|
|
a = (a + data[index]) % MOD_ADLER;
|
|
b = (b + a) % MOD_ADLER;
|
|
}
|
|
return (b << 16) | a;
|
|
}
|