public static ushort Checksum(this SuperBitmap bitmap) { ushort chksum = 0; try { bool success = false; do { //chksum = Checksum(bitmap, 0, 0, bitmap.Bitmap.Width, bitmap.Bitmap.Height); chksum = CRC16.ComputeChecksum((byte[])(new ImageConverter()).ConvertTo(bitmap.Bitmap, typeof(byte[]))); success = true; }while (!success); } catch (InvalidOperationException e) { } return(chksum); }
public static ushort Checksum(this Bitmap bitmap) { byte[] bytes = (byte[])(new ImageConverter()).ConvertTo(bitmap, typeof(byte[])); return(CRC16.ComputeChecksum(bytes)); }
public static ushort PayloadChecksum(this PacketDotNet.Packet packet) { return(CRC16.ComputeChecksum(packet.PayloadData)); }