1
I am working on a script where in one of the steps I will have to use the function hashlib
to convert one string list to another via SHA256. However, I’m having some problems that I haven’t been able to solve yet.
One of them is in relation to the code below:
import hashlib
h = hashlib.sha256()
h.update("uma frase qualquer",encoding='utf-8')
print(h.hexdigest())
Initially, error appeared requesting encode
. Includes the encoding
in the update
. But now the error I can’t fix is:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-16-c4c9e8e0d84d> in <module>
2
3 h = hashlib.sha256()
----> 4 h.update("uma frase qualquer",encoding='utf-8')
5 print(h.hexdigest())
TypeError: update() takes no keyword arguments
Does anyone know how to solve these "takes" points in the keyword Arguments? And if someone has some tips how to convert lists of strings using the hashlib
(more specifically, SHA256), I accept also.