I have (3) md5sums that I need to combine into a single hash. The new hash should be 32-characters, but is case-sensitive and can be any letter or number. What’s the best way to do this in Python?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would start by combinind the md5 hashes into a single hash. You can use SHA256 since it will contain more bytes in the end:
Then you can use base64 to encode it using letters, numbers, and a few extra symbols:
If you want just 32 characters long, slice off the last bits:
This can contain
+and/in addition to letters and numbers like your OP suggests. If you want to replace them, you can use the second parameter to b64encode: