I'm trying to get a hash of a string:
hs = hashlib.sha256(get_some_string()).hexdigest()
...but I get an error:
TypeError: Unicode-objects must be encoded before hashing
Use utf-8
encoding:
hs = hashlib.sha256(get_some_string().encode('utf-8')).hexdigest()
To get more information read documentation.
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