Exemplo n.º 1
0
        public static string Hash(this IFileInfo fileInfo, IHashAlgorithm hashAlgorithm = null)
        {
            if (hashAlgorithm == null)
            {
                hashAlgorithm = Hashing.Default;
            }

            using (hashAlgorithm)
            {
                using (var stream = fileInfo.OpenRead())
                {
                    var hash = hashAlgorithm.ComputeHex(stream);

                    return(hash);
                }
            }
        }
Exemplo n.º 2
0
		public static string Hash(this IFileInfo fileInfo, IHashAlgorithm hashAlgorithm = null)
		{
			if (hashAlgorithm == null)
			{
				hashAlgorithm = Hashing.Default;
			}

			using (hashAlgorithm)
			{
				using (var stream = fileInfo.OpenRead())
				{
					var hash = hashAlgorithm.ComputeHex(stream);

					return hash;
				}
			}
		}