0
I NEED HELP with PYTHON!
Need help! I am studying the hashlib library, but I found a certain problem ... when passing the update m.update (b'example ') I am not able to pass a variable inside, would you know how I could pass a variable inside the update? https://code.sololearn.com/cT55HCNpn8Ae/?ref=app
2 Answers
+ 11
Player Gileade Oficial , before you can use your variable content to update the hash, you need to convert it to byte mode:
import hashlib
b = 'abcdef'.encode() # or: b = input().encode() or: b.encode()
m = hashlib.md5()
m.update(b)
print(m.digest())
+ 3
Player Gileade Oficial you want this?
import hashlib
b = 'abcdef'
m = hashlib.md5()
m.update(b.encode())
print(m.hexdigest())
https://code.sololearn.com/cnk6V6YadFFa/?ref=app