internal static ImmutableArray<byte> ComputeSha1(Stream stream)
        {
            if (stream != null)
            {
                stream.Seek(0, SeekOrigin.Begin);
                using (var hashProvider = new SHA1CryptoServiceProvider())
                {
                    return ImmutableArray.Create(hashProvider.ComputeHash(stream));
                }
            }

            return ImmutableArray<byte>.Empty;
        }
 internal static ImmutableArray<byte> ComputeSha1(byte[] bytes)
 {
     using (var hashProvider = new SHA1CryptoServiceProvider())
     {
         return ImmutableArray.Create(hashProvider.ComputeHash(bytes));
     }
 }
            private byte[] TryComputeFileHash(string filePath)
            {
                try
                {
                    using (var cryptoProvider = new SHA1CryptoServiceProvider())
                    using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete))
                    {
                        return cryptoProvider.ComputeHash(stream);
                    }
                }
                catch { }

                return null;
            }