c# - Hash a file as its being recived -
end goal: users uploading large number of files in different sizes web site. , dont want duplicate files on disk. the solution have been using simple sh1 hash of file when uploaded. code this: public static string hashfile(string filename) { using (filestream stream = file.openread(filename)) { sha1managed sha = new sha1managed(); byte[] checksum = sha.computehash(stream); string sendchecksum = bitconverter.tostring(checksum).replace("-",string.empty); return sendchecksum; } } this "works" fine smaller files, big pain when file 30gb. hash file im reciving client. file client in "chunks" , size of chunk not static. code recives file. int chunk = context.request["chunk"] != null ? int.parse(context.request["chunk"]) : 0; int chunks = context.request["chunks"] != null ? int.parse(context.request["chunks"]) : 0; string filename = context.request["name...