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); }
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); }
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; }