What c# equivalent encoding does Python's hash.digest() use ?

Posted by The_AlienCoder on Stack Overflow See other posts from Stack Overflow or by The_AlienCoder
Published on 2010-06-03T20:23:18Z Indexed on 2010/06/03 20:34 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

I am trying to port a python program to c#. Here is the line that's supposed to be a walkthrough but is currently tormenting me:

hash = hashlib.md5(inputstring).digest()

After generating a similar MD5 hash in c# It is absolutely vital that I create a similar hash string as the original python program or my whole application will fail.

My confusion lies in which encoding to use when converting to string in c# i.e

?Encoding enc = new ?Encoding();
string Hash =enc.GetString(HashBytes); //HashBytes is my generated hash

Because I am unable to create two similar hashes when using Encoding.Default i.e

string Hash = Encoding.Default.GetString(HashBytes);

So I'm thinking knowing the deafult hash.digest() encoding for python would help

© Stack Overflow or respective owner

Related posts about c#

Related posts about python