public static void Main()
string input = "004600060000010103002022520220916162608230065507085102TH9104";
var data = System.Text.ASCIIEncoding.ASCII.GetBytes(input);
var hex = Crc16.Crc16Ccitt(data).ToString("X2");
public static class Crc16
public static ushort Crc16Ccitt(byte[] bytes)
const ushort poly = 0x1021;
ushort[] table = new ushort[256];
ushort initialValue = 0xffff;
ushort crc = initialValue;
for (int i = 0; i < table.Length; ++i)
for (int j = 0; j < 8; ++j)
if (((temp ^ a) & 0x8000) != 0)
temp = (ushort)((temp << 1) ^ poly);
for (int i = 0; i < bytes.Length; ++i)
crc = (ushort)((crc << 8) ^ table[((crc >> 8) ^ (0xff & bytes[i]))]);