Python2 wotking but py3 not working
hashlib.sha256(re.sub('[^a-zA-Z0-9]', "", each_user["Merchandiser"]).lower()[
:4].capitalize() + "@123").hexdigest()
Python2 wotking but py3 not working
hashlib.sha256(re.sub('[^a-zA-Z0-9]', "", each_user["Merchandiser"]).lower()[
:4].capitalize() + "@123").hexdigest()
You need to encode the string before you call hexdigest.
Try the following:
import hashlib
hashlib.sha256(
(
re.sub('[^a-zA-Z0-9]', "", each_user["Merchandiser"]
).lower()[:4].capitalize() + "@123"
).encode("utf-8")
).hexdigest()
what type is 'each_user' here?
I think your need to encode sha256 argument
hashlib.sha256((re.sub('[^a-zA-Z0-9]', "", each_user["Merchandiser"]).lower()[:4].capitalize() + "@123").encode())
if
each_user["Merchandiser"]
is a str