Esempio n. 1
0
        /// <summary>
        /// Reads the stream and returns a Checksum calculated with the requested HashType
        /// </summary>
        /// <param name="hashType">The Algorithm used to calculate the checksum.</param>
        /// <returns>A lowercase string representing the checksum.</returns>
        public static string GenerateHash(this Stream stream, HashTypes hashType)
        {
            var hasher = hashType.GetHasher();

            hasher.ComputeHash(stream);
            return(hasher.Hash.ToLowerString());
        }
Esempio n. 2
0
        public void TestGetHasher(HashTypes hashType, Type type)
        {
            var hasher = hashType.GetHasher();

            hasher.Should().BeOfType(type);
        }