0

If I have this cookie:

$my_cookie = "value";

And i would like to encode this value by secret key like this:

$encode_cookie = encoding($my_cookie, "key");
setcookie('my_cookie',$encode_cookie);

Then, I use way like this way to get the value of cookie:

$my_cookie = decoding($encode_cookie, "key");

So, Is there anyway to do that?

Mazin
  • 143
  • 1
  • 9

1 Answers1

1

You have to use a symmetric encryption to be able to encrypt and then decrypt with the same key.

Take a look at : http://php.net/mcrypt-encrypt

ôkio
  • 1,772
  • 1
  • 15
  • 16