public async Task SHA512_from_file_async() { var sha = SHA512Value.ComputeFileSHA512(ThisFile); var sha2 = await SHA512Value.ComputeFileSHA512Async(ThisFile); sha2.Should().Be(sha); using (var compressedPath = new TemporaryFile()) { using (var input = new FileStream(ThisFile, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.SequentialScan | FileOptions.Asynchronous)) using (var compressed = new FileStream(compressedPath.Path, FileMode.Truncate, FileAccess.Write, FileShare.None, 4096, FileOptions.SequentialScan | FileOptions.Asynchronous)) { var writer = GetCompressShellAsync(w => input.CopyToAsync(w)); await writer(compressed); } var shaCompressed = await SHA512Value.ComputeFileSHA512Async(compressedPath.Path); shaCompressed.Should().NotBe(sha); var localSha = await SHA512Value.ComputeFileSHA512Async(compressedPath.Path, r => new GZipStream(r, CompressionMode.Decompress, true)); localSha.Should().Be(sha); } }