I need to convert a HEX-type md5 string to the base64 version in Python.
For example, if I had MD5: 4297f44b13955235245b2497399d7a93
I need the code to produce Qpf0SxOVUjUkWySXOZ16kw==
This is identical to another SO asking for a C# implementation, but I need the Python code. This is similar to this SO asking to convert a single binary number to base64 in Python.
Depending on the version of Python you are running, the following will work:
base64.b64encode("4297f44b13955235245b2497399d7a93".decode("hex"))
base64.b64encode(bytes.fromhex("4297f44b13955235245b2497399d7a93"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With