I need to encrypt password using Python, from what I saw in PHP examples, they use a "module" that encrypts the password and that in theory does not to decrypt, to validate the password they encrypt the password that the user typed and compares with which it is encrypted in the database.
How to do this in Python? From what I managed to find on / tested, every time I put to encrypt the result and always different, so how do I compare? What do I need to learn?
Fictional example of what's happening to me:
First try:
msg = "1234"
encript(msg) >> adsadasfafsa
Second try:
msg = "1234"
encript(msg) >> weqwrewerwer
Concluding every time I encrypt the result is different, so I can not compare.