aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-06-26 12:11:08 +0000
committerMichael Mann <mmann78@netscape.net>2013-06-26 12:11:08 +0000
commit6e1f213fcac6ca3361fd35eac0dd627b8bd0619b (patch)
treef86ed37a7c8392051181bfea7571225cf4c831a9 /wsutil
parent500d3993934d988fa5231333dd8c484513a81473 (diff)
openSAFETY: CRC Maintenance, new CRC, new expert interface implemented. Bug 8847 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8847)
From Roland Knall svn path=/trunk/; revision=50166
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/crc16.c41
-rw-r--r--wsutil/crc16.h9
2 files changed, 50 insertions, 0 deletions
diff --git a/wsutil/crc16.c b/wsutil/crc16.c
index f7a7a92b66..ea7a0c891d 100644
--- a/wsutil/crc16.c
+++ b/wsutil/crc16.c
@@ -185,6 +185,42 @@ static const guint crc16_precompiled_5935[256] =
0x65AA, 0x3C9F, 0xD7C0, 0x8EF5, 0x584B, 0x017E, 0xEA21, 0xB314
};
+/* This table was compiled using the polynom 0x755B */
+static const guint crc16_precompiled_755B[] =
+{
+ 0x0000, 0x755b, 0xeab6, 0x9fed, 0xa037, 0xd56c, 0x4a81, 0x3fda, /* 0x00 */
+ 0x3535, 0x406e, 0xdf83, 0xaad8, 0x9502, 0xe059, 0x7fb4, 0x0aef, /* 0x08 */
+ 0x6a6a, 0x1f31, 0x80dc, 0xf587, 0xca5d, 0xbf06, 0x20eb, 0x55b0, /* 0x10 */
+ 0x5f5f, 0x2a04, 0xb5e9, 0xc0b2, 0xff68, 0x8a33, 0x15de, 0x6085, /* 0x18 */
+ 0xd4d4, 0xa18f, 0x3e62, 0x4b39, 0x74e3, 0x01b8, 0x9e55, 0xeb0e, /* 0x20 */
+ 0xe1e1, 0x94ba, 0x0b57, 0x7e0c, 0x41d6, 0x348d, 0xab60, 0xde3b, /* 0x28 */
+ 0xbebe, 0xcbe5, 0x5408, 0x2153, 0x1e89, 0x6bd2, 0xf43f, 0x8164, /* 0x30 */
+ 0x8b8b, 0xfed0, 0x613d, 0x1466, 0x2bbc, 0x5ee7, 0xc10a, 0xb451, /* 0x38 */
+ 0xdcf3, 0xa9a8, 0x3645, 0x431e, 0x7cc4, 0x099f, 0x9672, 0xe329, /* 0x40 */
+ 0xe9c6, 0x9c9d, 0x0370, 0x762b, 0x49f1, 0x3caa, 0xa347, 0xd61c, /* 0x48 */
+ 0xb699, 0xc3c2, 0x5c2f, 0x2974, 0x16ae, 0x63f5, 0xfc18, 0x8943, /* 0x50 */
+ 0x83ac, 0xf6f7, 0x691a, 0x1c41, 0x239b, 0x56c0, 0xc92d, 0xbc76, /* 0x58 */
+ 0x0827, 0x7d7c, 0xe291, 0x97ca, 0xa810, 0xdd4b, 0x42a6, 0x37fd, /* 0x60 */
+ 0x3d12, 0x4849, 0xd7a4, 0xa2ff, 0x9d25, 0xe87e, 0x7793, 0x02c8, /* 0x68 */
+ 0x624d, 0x1716, 0x88fb, 0xfda0, 0xc27a, 0xb721, 0x28cc, 0x5d97, /* 0x70 */
+ 0x5778, 0x2223, 0xbdce, 0xc895, 0xf74f, 0x8214, 0x1df9, 0x68a2, /* 0x78 */
+ 0xccbd, 0xb9e6, 0x260b, 0x5350, 0x6c8a, 0x19d1, 0x863c, 0xf367, /* 0x80 */
+ 0xf988, 0x8cd3, 0x133e, 0x6665, 0x59bf, 0x2ce4, 0xb309, 0xc652, /* 0x88 */
+ 0xa6d7, 0xd38c, 0x4c61, 0x393a, 0x06e0, 0x73bb, 0xec56, 0x990d, /* 0x90 */
+ 0x93e2, 0xe6b9, 0x7954, 0x0c0f, 0x33d5, 0x468e, 0xd963, 0xac38, /* 0x98 */
+ 0x1869, 0x6d32, 0xf2df, 0x8784, 0xb85e, 0xcd05, 0x52e8, 0x27b3, /* 0xA0 */
+ 0x2d5c, 0x5807, 0xc7ea, 0xb2b1, 0x8d6b, 0xf830, 0x67dd, 0x1286, /* 0xA8 */
+ 0x7203, 0x0758, 0x98b5, 0xedee, 0xd234, 0xa76f, 0x3882, 0x4dd9, /* 0xB0 */
+ 0x4736, 0x326d, 0xad80, 0xd8db, 0xe701, 0x925a, 0x0db7, 0x78ec, /* 0xB8 */
+ 0x104e, 0x6515, 0xfaf8, 0x8fa3, 0xb079, 0xc522, 0x5acf, 0x2f94, /* 0xC0 */
+ 0x257b, 0x5020, 0xcfcd, 0xba96, 0x854c, 0xf017, 0x6ffa, 0x1aa1, /* 0xC8 */
+ 0x7a24, 0x0f7f, 0x9092, 0xe5c9, 0xda13, 0xaf48, 0x30a5, 0x45fe, /* 0xD0 */
+ 0x4f11, 0x3a4a, 0xa5a7, 0xd0fc, 0xef26, 0x9a7d, 0x0590, 0x70cb, /* 0xD8 */
+ 0xc49a, 0xb1c1, 0x2e2c, 0x5b77, 0x64ad, 0x11f6, 0x8e1b, 0xfb40, /* 0xE0 */
+ 0xf1af, 0x84f4, 0x1b19, 0x6e42, 0x5198, 0x24c3, 0xbb2e, 0xce75, /* 0xE8 */
+ 0xaef0, 0xdbab, 0x4446, 0x311d, 0x0ec7, 0x7b9c, 0xe471, 0x912a, /* 0xF0 */
+ 0x9bc5, 0xee9e, 0x7173, 0x0428, 0x3bf2, 0x4ea9, 0xd144, 0xa41f /* 0xF8 */
+};
static const guint16 crc16_ccitt_start = 0xFFFF;
static const guint16 crc16_ccitt_xorout = 0xFFFF;
@@ -244,3 +280,8 @@ guint16 crc16_0x5935(const guint8 *buf, guint32 len, guint16 seed)
return crc16_unreflected(buf, len, seed, crc16_precompiled_5935);
}
+guint16 crc16_0x755B(const guint8 *buf, guint32 len, guint16 seed)
+{
+ return crc16_unreflected(buf, len, seed, crc16_precompiled_755B);
+}
+
diff --git a/wsutil/crc16.h b/wsutil/crc16.h
index 3529a1af6c..351b049e9f 100644
--- a/wsutil/crc16.h
+++ b/wsutil/crc16.h
@@ -72,6 +72,15 @@ WS_DLL_PUBLIC guint16 crc16_ccitt_seed(const guint8 *buf, guint len, guint16 see
*/
WS_DLL_PUBLIC guint16 crc16_0x5935(const guint8 *buf, guint32 len, guint16 seed);
+/** Calculates a CRC16 checksum for the given buffer with the polynom
+ * 0x755B using a precompiled CRC table
+ * @param pBuffer a pointer to a buffer of the given length
+ * @param len the length of the given buffer
+ * @param seed The seed to use.
+ * @return the CRC16 checksum for the buffer
+ */
+WS_DLL_PUBLIC guint16 crc16_0x755B(const guint8 *buf, guint32 len, guint16 seed);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */