PKHeX.PKX.ccitt16 C# (CSharp) Method

ccitt16() static private method

static private ccitt16 ( byte data ) : ushort
data byte
return ushort
        internal static ushort ccitt16(byte[] data)
        {
            ushort crc = 0xFFFF;
            foreach (byte t in data)
            {
                crc ^= (ushort)(t << 8);
                for (int j = 0; j < 8; j++)
                {
                    if ((crc & 0x8000) > 0)
                        crc = (ushort)((crc << 1) ^ 0x1021);
                    else
                        crc <<= 1;
                }
            }
            return crc;
        }
        internal static string verifyG6CHK(byte[] savefile, bool oras, int savegame, ref int[] ctr)