Best way to use PHP to encrypt and decrypt passwords? [duplicate]
You should not encrypt passwords, instead you should hash them using an algorithm like bcrypt. This answer explains how to properly implement password hashing in PHP. Still, here is how you would encrypt/decrypt: $key = ‘password to (en/de)crypt’; $string = ‘ string to be encrypted ‘; // note the spaces To Encrypt: $iv = mcrypt_create_iv( … Read more