I am doing an advent of code problem and need to convert MD5 into hex, and I have no clue where to begin.
I tried multiple websites, but none helped, but there were some stack overflow questions that were just confusing.
What you need to do is to convert the secret
string into MD5 hash. For that, use the hashlib
library:
from hashlib import md5
secret = 'abcdef609043'
print(md5(secret.encode()).hexdigest())
Output:
000001dbbfa3a5c83a2d506429c7b00e
Brief explanation: You first need to get the bytes of the secret
string with the .encode
method, and then get the hexadecimal representation of the MD5 digest with .hexdigest()
.