public static void VerifyFileHash(string filePath, Hash hash)
 {
     byte[] buffer;
     string fileName = Path.GetFileName(filePath);
     try
     {
         buffer = GenerateDigestValue(filePath, hash.DigestMethod, hash.Transform);
     }
     catch (IOException exception)
     {
         throw new InvalidDeploymentException(ExceptionTypes.HashValidation, Resources.GetString("Ex_HashValidationException"), exception);
     }
     byte[] digestValue = hash.DigestValue;
     bool flag = false;
     if (buffer.Length == digestValue.Length)
     {
         int index = 0;
         while (index < digestValue.Length)
         {
             if (digestValue[index] != buffer[index])
             {
                 break;
             }
             index++;
         }
         if (index >= digestValue.Length)
         {
             flag = true;
         }
     }
     if (!flag)
     {
         Logger.AddInternalState("File," + fileName + ", has a different computed hash than specified in manifest. Computed hash is " + Encoding.UTF8.GetString(buffer) + ". Specified hash is " + Encoding.UTF8.GetString(digestValue));
         throw new InvalidDeploymentException(ExceptionTypes.HashValidation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DifferentHashes"), new object[] { fileName }));
     }
 }
 public void AddHash(byte[] digestValue, System.Deployment.Internal.Isolation.Manifest.CMS_HASH_DIGESTMETHOD digestMethod, System.Deployment.Internal.Isolation.Manifest.CMS_HASH_TRANSFORM transform)
 {
     Hash hash = new Hash(digestValue, digestMethod, transform);
     this._hashes.Add(hash);
 }
 public static bool IsVerifiableHash(Hash hash)
 {
     return (((Array.IndexOf<System.Deployment.Internal.Isolation.Manifest.CMS_HASH_TRANSFORM>(VerifiableTransformTypes, hash.Transform) >= 0) && (Array.IndexOf<System.Deployment.Internal.Isolation.Manifest.CMS_HASH_DIGESTMETHOD>(VerifiableDigestMethods, hash.DigestMethod) >= 0)) && ((hash.DigestValue != null) && (hash.DigestValue.Length > 0)));
 }