Simplest two-way encryption using PHP

前端 未结 6 1645
半阙折子戏
半阙折子戏 2020-11-22 07:11

What is the simplest way of doing two way encryption in common PHP installs?

I need to be able to encrypt data with a string key, and use the same key to decrypt on

6条回答
  •  一个人的身影
    2020-11-22 07:27

    Use mcrypt_encrypt() and mcrypt_decrypt() with corresponding parameters. Really easy and straight forward, and you use a battle-tested encryption package.

    EDIT

    5 years and 4 months after this answer, the mcrypt extension is now in the process of deprecation and eventual removal from PHP.

提交回复
热议问题