using System; using System.Text; class MainClass { public static bool VerifyHexHash(byte[] hash, string oldHashString) { StringBuilder newHashString = new StringBuilder(hash.Length); foreach (byte b in hash) { newHashString.AppendFormat("{0:X2}", b); } return (oldHashString == newHashString.ToString()); } private static bool VerifyB64Hash(byte[] hash, string oldHashString) { string newHashString = Convert.ToBase64String(hash); return (oldHashString == newHashString); } private static bool VerifyByteHash(byte[] hash, byte[] oldHash) { if (hash == null || oldHash == null || hash.Length != oldHash.Length) return false; for (int count = 0; count < hash.Length; count++) { if (hash[count] != oldHash[count]) return false; } return true; } }