Forums

hashlib gives two different outputs

I am using pythonanywhere serves for my API and while creating login and register systems (with hashlib) i got a problem i can't find solve for. Both register or login function using h = hashlib.new('sha3_512') inside of the function which preverts h.update(data) bug, after goes hashed_pass = h.hexdigest(). Finnaly everything inserts in the user table or compares with existing user data. The main problem is when I register the user with password = ovoshch1 I got one output, then after doing same things for login function i got the other output. Sometimes output has around 15-20 more characters at the end (I checked for the invisible characters as well, and they didn't appear as something that can break this code), sometimes the hash fully differs from the saved in my db. I wonder what can make such strange things Thank you for the help

We can help you with PythonAnywhere, but for more general programming questions you need to ask on more general forums.

Okay, I will try. Thanks