Hashing multiple byte[]'s together into a single hash with C#?

前端 未结 6 1088
生来不讨喜
生来不讨喜 2020-12-16 17:54

I have three fields: string Title, byte[] Body, and byte[] Data, from which I want to calculate a single hash as a check to be sure th

6条回答
  •  不知归路
    2020-12-16 18:14

    you can create a Hash over the Hash values.

    MD5 md5 =  System.Security.Cryptography.MD5.Create();
    byte[] totalHash= md5.ComputeHash(md5.ComputeHash(part1).Concat(md5t.computeHash(part2)));
    

    doesnt create a copy of the byte array but hashes a concatenation of the hashes.

提交回复
热议问题