Revision db63c1ae trunk/Pithos.Network/Signature.cs
b/trunk/Pithos.Network/Signature.cs | ||
---|---|---|
198 | 198 |
//Calculate the hash of all blocks using a blockhash iterator |
199 | 199 |
using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, blockSize, true)) |
200 | 200 |
{ |
201 |
var md5 = new MD5BlockCalculator(); |
|
202 |
Action<long, byte[], int> postAction = md5.PostBlock; |
|
201 | 203 |
//Calculate the blocks asyncrhonously |
202 |
var hashes = BlockHashAlgorithms.CalculateBlockHashesInPlacePFor(stream, blockSize, algorithm, parallelism,progress).Result; |
|
204 |
var hashes = BlockHashAlgorithms.CalculateBlockHashesInPlacePFor(stream, blockSize, algorithm, parallelism,postAction, progress).Result;
|
|
203 | 205 |
|
204 | 206 |
//And then proceed with creating and returning a TreeHash |
205 | 207 |
var length = stream.Length; |
... | ... | |
213 | 215 |
}; |
214 | 216 |
|
215 | 217 |
string fileHash; |
218 |
|
|
219 |
var md5Hash=md5.GetHash().Result; |
|
220 |
/* |
|
216 | 221 |
var hasher = HashAlgorithm.Create("MD5"); |
217 | 222 |
stream.Position = 0; |
218 |
treeHash.MD5= hasher.ComputeHash(stream).ToHashString(); |
|
223 |
*/ |
|
224 |
treeHash.MD5= md5Hash; |
|
219 | 225 |
|
220 | 226 |
return treeHash; |
221 | 227 |
} |
Also available in: Unified diff