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
EDIT
Ok maybe some more code will articulate my problem more. After the hash is calculated in the python program some calculations are carried out i.e
hash = hashlib.md5(inputstring).digest()
for i in range(0,6):
value += ord(hash[i])
return value
Now can you see why two different Hash strings will be problematic? Some of the characters that appear when the python program is ran are repalced by a '?' in C#.