1 /* Copyright (c) 2012 Apple Inc. All Rights Reserved. */
3 #ifndef _SECURITY_AUTH_CRC_H_
4 #define _SECURITY_AUTH_CRC_H_
6 #if defined(__cplusplus)
10 extern const uint64_t _crc_table64
[256];
11 extern const uint64_t xorout
;
20 crc64_final(uint64_t crc
)
25 AUTH_INLINE AUTH_NONNULL_ALL
uint64_t
26 crc64_update(uint64_t crc
, const void *buf
, uint64_t len
)
28 const unsigned char * ptr
= (const unsigned char *) buf
;
31 crc
= _crc_table64
[((crc
>> 56) ^ *(ptr
++)) & 0xff] ^ (crc
<< 8);
38 crc64(const void *buf
, uint64_t len
)
40 uint64_t crc
= crc64_init();
42 crc
= crc64_update(crc
, buf
, len
);
44 crc
= crc64_final(crc
);
49 #if defined(__cplusplus)
53 #endif /* !_SECURITY_AUTH_CRC_H_ */