1
Hello, I have the following situation:
- I have to create a
hexdigest
of a concatenation of 2 numbers transformed into a string. - For this, I must use the library
hashlib
and the project must be in python.
Follow my code so far:
import time
import hashlib
num1 = 123456
num2 = time.time()
str1 = str(num1)
str2 = str(num2)
hash = hashlib.sha1(str1 + str2)
hexhash = hash.hexdigest()
print(hexhash)
The problem is that while trying to run the above code, it is returning the error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Unicode-objects must be encoded before hashing
What I need to do to create this hexdigest
using these variables?
hum.. I didn’t know the Encounter method... has 1 week I’m dealing with python, thank you very much!
– LeandroLuk