Hi, problem decoding cookies

From: Date: Sun, 25 Jun 2000 16:06:14 +0000
Subject: Hi, problem decoding cookies
Groups: php.general 
Request: Send a blank email to php-general+get-2995@lists.php.net to get a copy of this message
Hi, I have php ver3.0.16, compiled with mcrypt support and i'm having trouble decoding my cookies. I encode the cookie value by using: $key = "the key"; $mycookieval = "cookie contents"; setcookie("mycookie", mcrypt_ecb(MCRYPT_TripleDES, $key, $mycookieval, MCRYPT_ENCRYPT), time()+3600 ); altough when I try to decrypt it, it doesn't decrypt it properlly. $mynewcookie = mcrypt_ecb(MCRYPT_TripleDES, $key, $mycookie, MCRYPT_DECRYPT) echo $mynewcookie; // returns garbage I know the decrypt works because i've used it to encode stuff on the page, but when I try to encrypt the cookies it doesn't work. if anyone knows what I could be doing wrong could you please point me in the right way, this has been bugging me for awhile, considering I was using the cookie val in a db query and I kept wondering why the db query was returning nothing. thanks in advance Drew

« previous php.general (#2995) next »