c# - SHA-1 Hash of uploaded xls file always different, With csv file hashing works -
i got following problem. upload csv , excel files via wcf service. hash calculation work csv files. xls files different value every upload.
hash calculation:
using (filestream file = new filestream(datei.fullname, filemode.open)) { var sha1 = new sha1cryptoserviceprovider(); byte[] retval = sha1.computehash(file); var sb = new stringbuilder(); foreach (var b in retval) sb.append(b.tostring("x2")); return sb.tostring(); }
does know problem might located? problem binary xls file format?
any appreciated.
marius
i suspect file actually different each time. that's easy enough check though - there various free tools around perform checksums/hashes. pick sha1 , compare own results, or use md5 tool etc.
try running both client side , server side - way you'll able verify file hasn't been corrupted in transit.
once you've worked out , when file has changed, you'll need decide it. example, if excel is adding timestamp, may want mask out when computing hash.
Comments
Post a Comment