Search code examples
phpencryptionpasswordsmcrypt

Encrypting data with Mcrypt using a password instead of a key


Upon looking at Mcrypt_encrypt on the manual, I see that it requires a key. Is there another function or something that allows using a password instead? How would the code look then?


Solution

  • You can try openssl_encrypt() & openssl_decrypt()

    and check this answer for a very detailed example.

    Simplest two-way encryption using PHP