예제 #1
0
        public void SetChecksum(ref byte[] packet)
        {
            RPH rph = RPH.Deserialize(packet);
            var md5 = MD5.Create();

            rph._checksum = BitConverter.ToInt32(md5.ComputeHash(packet), 0);
            byte[] newHead = rph.Serialize();
            Array.Copy(newHead, packet, newHead.Length);
        }
예제 #2
0
        public bool IsCorrupt(RPH rph)
        {
            int checksum = rph._checksum;

            rph._checksum = 0;
            byte[] packet       = rph.Serialize();
            var    md5          = MD5.Create();
            int    calcChecksum = BitConverter.ToInt32(md5.ComputeHash(packet), 0);

            return(checksum != calcChecksum);
        }
예제 #3
0
 public bool IsCorrupt(RPH rph)
 {
     int checksum = rph._checksum;
     rph._checksum = 0;
     byte[] packet = rph.Serialize();
     var md5 = MD5.Create();
     int calcChecksum = BitConverter.ToInt32(md5.ComputeHash(packet), 0);
     return checksum != calcChecksum;
 }