Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
crc16.h
1 /* crc16.h
2  * Declaration of CRC-16 routines and table
3  *
4  * 2004 Richard van der Hoff <richardv@mxtelecom.com>
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12 
13 #ifndef __CRC16_H__
14 #define __CRC16_H__
15 
16 #include "ws_symbol_export.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
21 
22 /* Calculate the CCITT/ITU/CRC-16 16-bit CRC
23 
24  (parameters for this CRC are:
25  Polynomial: x^16 + x^12 + x^5 + 1 (0x1021);
26  Start value 0xFFFF;
27  XOR result with 0xFFFF;
28  First bit is LSB)
29 */
30 
35 WS_DLL_PUBLIC guint16 crc16_ccitt(const guint8 *buf, guint len);
36 
41 WS_DLL_PUBLIC guint16 crc16_x25_ccitt_seed(const guint8 *buf, guint len, guint16 seed);
42 
50 WS_DLL_PUBLIC guint16 crc16_ccitt_seed(const guint8 *buf, guint len, guint16 seed);
51 
56 WS_DLL_PUBLIC guint16 crc16_iso14443a(const guint8 *buf, guint len);
57 
65 WS_DLL_PUBLIC guint16 crc16_0x5935(const guint8 *buf, guint32 len, guint16 seed);
66 
74 WS_DLL_PUBLIC guint16 crc16_0x755B(const guint8 *buf, guint32 len, guint16 seed);
75 
83 WS_DLL_PUBLIC guint16 crc16_0x9949_seed(const guint8 *buf, guint len, guint16 seed);
84 
92 WS_DLL_PUBLIC guint16 crc16_0x3D65_seed(const guint8 *buf, guint len, guint16 seed);
93 
101 WS_DLL_PUBLIC guint16 crc16_0x080F_seed(const guint8 *buf, guint len, guint16 seed);
102 
103 #ifdef __cplusplus
104 }
105 #endif /* __cplusplus */
106 
107 #endif /* crc16.h */