Do not encrypt/decrypt passwords, that is a significant security vulnerability. HASH passwords, using a strong hash algorithm such as PBKDF2, bcrypt, scrypts, or Argon.
When the user sets their password, hash it, and store the hash (and salt).
When the user logs in, re-hash their provided password, and compare it to the hash in the database.