Home  >  Q&A  >  body text

PHP encryption and decryption algorithm function, mcrypt_encrypt is no longer recommended

The official website has a warning: This function has been DEPRECATED as of PHP 7.1.0. Relying on this function is highly discouraged.

So what function is used for encryption and decryption?

黄舟黄舟2734 days ago721

reply all(4)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-16 13:18:22

    openssl_encrypt
    openssl_decrypt

    >>> openssl_encrypt("1", "aes-256-cbc", "12312321", 0, "1234123443212345");
    => "x6Zfu2cbtbMDfkt2s/GE2A=="
    >>> openssl_decrypt("x6Zfu2cbtbMDfkt2s/GE2A==", "aes-256-cbc", "12312321", 0, "1234123443212345");
    => "1"

    Also see How do you Encrypt and Decrypt a PHP String?

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-16 13:18:22

    password_hash
    password_verify

    reply
    0
  • 某草草

    某草草2017-05-16 13:18:22

    What about hash encryption?

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 13:18:22

    Asymmetric encryption, RSA.

    reply
    0
  • Cancelreply