示例#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);
                }
            }
        }
示例#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;
				}
			}
		}