Exemplo n.º 1
0
        public static byte[] Final(this IHashAlgorithm algorithm)
        {
            var digest = new byte[algorithm.DigestSize];
            int length = algorithm.Final(digest, 0);

            if (length != digest.Length)
            {
                throw new Exception();
            }
            return(digest);
        }
Exemplo n.º 2
0
 public static byte[] ComputeHash(this IHashAlgorithm algorithm, byte[] data, int offset, int length)
 {
     algorithm.Reset();
     algorithm.Update(data, offset, length);
     return(algorithm.Final());
 }