cryptography - CryptHashData equivalent for C#? -
i trying translate existing c++ code c#. have code calls crypthashdata
3 times on same hcrypthash
. documentation says "this function , crypthashsessionkey
can called multiple times compute hash of long or discontinuous data streams."
which want achieve in c#. unfortunately, md5.computehash()
doesn't appear have way build on existing hash.
am missing something, there c# api achieve this?
instantiate instance of hash class , use transformblock
, transformfinalblock
:
byte[] part1 = //... byte[] part2 = //... byte[] part3 = //... var hash = new md5cryptoserviceprovider(); hash.transformblock(part1, 0, part1.length, null, 0); hash.transformblock(part2, 0, part2.length, null, 0); hash.transformfinalblock(part3, 0, part3.length); byte[] res = hash.hash;
Comments
Post a Comment