Skip to content

Instantly share code, notes, and snippets.

View 0xA50C1A1's full-sized avatar
🏠
Working from home

Vladimir Gavrilov 0xA50C1A1

🏠
Working from home
  • SecurityCode
  • 01:57 (UTC +03:00)
View GitHub Profile
@tijnkooijmans
tijnkooijmans / crc16.c
Created April 17, 2014 12:53
CRC-16/CCITT-FALSE
uint16_t crc16(char* pData, int length)
{
uint8_t i;
uint16_t wCrc = 0xffff;
while (length--) {
wCrc ^= *(unsigned char *)pData++ << 8;
for (i=0; i < 8; i++)
wCrc = wCrc & 0x8000 ? (wCrc << 1) ^ 0x1021 : wCrc << 1;
}
return wCrc & 0xffff;
@andresv
andresv / ax25_crc16.c
Last active July 16, 2024 15:59
AX25 CRC16 implementation
uint16_t ax25crc16(unsigned char *data_p, uint16_t length) {
uint16_t crc = 0xFFFF;
uint32_t data;
uint16_t crc16_table[] = {
0x0000, 0x1081, 0x2102, 0x3183,
0x4204, 0x5285, 0x6306, 0x7387,
0x8408, 0x9489, 0xa50a, 0xb58b,
0xc60c, 0xd68d, 0xe70e, 0xf78f
};