Fixes to hashing
[pithos-ms-client] / trunk / Pithos.Network / Signature.cs
index 634fea5..389dd79 100644 (file)
@@ -79,7 +79,7 @@ namespace Pithos.Network
 
             string hash;
             using (var hasher = MD5.Create())
-            using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, true))
+            using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 65536, true))
             {
                 var hashBytes = hasher.ComputeHash(stream);
                 hash = hashBytes.ToHashString();
@@ -204,9 +204,14 @@ namespace Pithos.Network
                 {
                     Bytes = length,
                     BlockSize = blockSize,
-                    Hashes = list
+                    Hashes = list,
                 };
 
+                string fileHash;
+                var hasher = HashAlgorithm.Create("MD5");
+                stream.Position = 0;
+                treeHash.MD5= hasher.ComputeHash(stream).ToHashString();
+
                 return treeHash;
             }
         }