Encrypting cookies in PHP

后端 未结 5 2132
梦谈多话
梦谈多话 2021-01-11 15:48

How can i encrypt and later decrypt a value of a cookie in PHP (how secure will the encryption be )

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-11 15:59

    There a variety of different ways to encrypt information in cookies and elsewhere. The strength of the encryption will vary by the method you choose to do the actual encryption. mycrypt is a good place to start. See this answer for an example of using mcrypt.

    I don't recommend putting anything sensitive in a cookie, even if it is going to be encrypted. Way too tempting for someone to crack. Try sticking to sessions if you can.

提交回复
热议问题