15 static int oneshot = 0;
23 for (i = 0; i < 256; i++) {
25 for (j = 0; j < 8; j++) {
27 c = polynomial ^ (c >> 1);
37 crc = table[(crc ^ *
data) & 0xff] ^ (crc >> 8);
95 odd[0] = 0xedb88320UL;
143 0xc96c5795d7870f42ULL;
146 static int oneshot = 0;
154 for (i = 0; i < 256; i++) {
156 for (j = 0; j < 8; j++) {
158 c = polynomial ^ (c >> 1);
168 crc = table[(crc ^ *
data) & 0xff] ^ (crc >> 8);
226 odd[0] = 0xc96c5795d7870f42ULL;
276 #define DO1(buf,i) {adler += (rpmuint32_t) (buf)[i]; sum2 += adler;}
277 #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
278 #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
279 #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
280 #define DO16(buf) DO8(buf,0); DO8(buf,8);
286 if (a >= (BASE << 16)) a -= (BASE << 16); \
287 if (a >= (BASE << 15)) a -= (BASE << 15); \
288 if (a >= (BASE << 14)) a -= (BASE << 14); \
289 if (a >= (BASE << 13)) a -= (BASE << 13); \
290 if (a >= (BASE << 12)) a -= (BASE << 12); \
291 if (a >= (BASE << 11)) a -= (BASE << 11); \
292 if (a >= (BASE << 10)) a -= (BASE << 10); \
293 if (a >= (BASE << 9)) a -= (BASE << 9); \
294 if (a >= (BASE << 8)) a -= (BASE << 8); \
295 if (a >= (BASE << 7)) a -= (BASE << 7); \
296 if (a >= (BASE << 6)) a -= (BASE << 6); \
297 if (a >= (BASE << 5)) a -= (BASE << 5); \
298 if (a >= (BASE << 4)) a -= (BASE << 4); \
299 if (a >= (BASE << 3)) a -= (BASE << 3); \
300 if (a >= (BASE << 2)) a -= (BASE << 2); \
301 if (a >= (BASE << 1)) a -= (BASE << 1); \
302 if (a >= BASE) a -= BASE; \
306 if (a >= (BASE << 4)) a -= (BASE << 4); \
307 if (a >= (BASE << 3)) a -= (BASE << 3); \
308 if (a >= (BASE << 2)) a -= (BASE << 2); \
309 if (a >= (BASE << 1)) a -= (BASE << 1); \
310 if (a >= BASE) a -= BASE; \
313 # define MOD(a) a %= BASE
314 # define MOD4(a) a %= BASE
323 sum2 = (adler >> 16) & 0xffff;
334 return adler | (sum2 << 16);
350 return adler | (sum2 << 16);
354 while (len >=
NMAX) {
381 return adler | (sum2 << 16);
392 rem = (unsigned)(len2 %
BASE);
393 sum1 = adler1 & 0xffff;
396 sum1 += (adler2 & 0xffff) + BASE - 1;
397 sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
398 if (sum1 > BASE) sum1 -=
BASE;
399 if (sum1 > BASE) sum1 -=
BASE;
400 if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
401 if (sum2 > BASE) sum2 -=
BASE;
402 return sum1 | (sum2 << 16);
int sum64Digest(sum64Param *mp, rpmuint8_t *data)
const char const char size_t len
int sum32Reset(register sum32Param *mp)
static void gf2_matrix_square32(rpmuint32_t *square, rpmuint32_t *mat)
static rpmuint64_t gf2_matrix_times64(rpmuint64_t *mat, rpmuint64_t vec)
rpmuint32_t(* update)(rpmuint32_t crc, const rpmuint8_t *data, size_t size)
CRC32, CRC64 and ADLER32 checksums.
static void gf2_matrix_square64(rpmuint64_t *square, rpmuint64_t *mat)
rpmuint32_t __adler32(rpmuint32_t adler, const rpmuint8_t *buf, rpmuint32_t len)
rpmuint32_t __adler32_combine(rpmuint32_t adler1, rpmuint32_t adler2, size_t len2)
static int crc(FD_t fd, uint32_t *cval, uint32_t *clen)
int sum64Update(sum64Param *mp, const rpmuint8_t *data, size_t size)
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
const char const bson * data
unsigned long long rpmuint64_t
rpmuint64_t __crc64_combine(rpmuint64_t crc1, rpmuint64_t crc2, size_t len2)
int sum32Digest(sum32Param *mp, rpmuint8_t *data)
rpmuint32_t __crc32_combine(rpmuint32_t crc1, rpmuint32_t crc2, size_t len2)
const char const char size_t size
int sum32Update(sum32Param *mp, const rpmuint8_t *data, size_t size)
int sum64Reset(register sum64Param *mp)
static rpmuint32_t gf2_matrix_times32(rpmuint32_t *mat, rpmuint32_t vec)
rpmuint64_t __crc64(rpmuint64_t crc, const rpmuint8_t *data, size_t size)
rpmuint64_t(* update)(rpmuint64_t crc, const rpmuint8_t *data, size_t size)
rpmuint32_t __crc32(rpmuint32_t crc, const rpmuint8_t *data, size_t size)