Faqts : Computers : Programming : Languages : PHP : Not Quite PHP : Browsers

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 18 people (61%) answered Yes
Recently 5 of 7 people (71%) answered Yes

Entry

setcookie(), mcrypt(), and string truncation.

Feb 29th, 2000 11:23
Matt Gregory, Caroline Wise,


If your cookie strings wind up getting truncated on the client side you 
might be sending too much information.  If you have a 5k encryption key 
on 1k of data being sent to a cookie, then the resulting string will be 
5k in length.  The default Netscape cookie size is 4k/cookie, which 
means that a 5k string will be truncated to 4k.  This will completely 
garble your data when you de-crypt it.  To avoid this problem make sure 
that you never send more than 4k of data in any one string the client.  
If need be use multiple cookies.