Пример #1
0
 public static Tuple<List<uint>, List<byte[]>, List<long>> DigestOldFile(string path)
 {
     using (var file = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None))
     using (var stream = new BlockByBlockStreamReader(file, BlockSize))
     {
         var ret = new Tuple<List<uint>, List<byte[]>, List<long>>(new List<uint>(), new List<byte[]>(), new List<long>());
         var md5 = MD5.Create();
         byte[] block;
         for (long offset = 0; (block = stream.NextBlock()) != null; offset += block.Length)
         {
             var checksum = RollingChecksum(block);
             var hash = md5.ComputeHash(block);
             ret.Item1.Add(checksum);
             ret.Item2.Add(hash);
             ret.Item3.Add(offset);
         }
         return ret.Sort();
     }
 }