RE: [PHP] Encrypt <--> Decrypt

From: Date: Mon, 23 Oct 2000 06:49:53 +0000
Subject: RE: [PHP] Encrypt <--> Decrypt
Groups: php.general 
Request: Send a blank email to php-general+get-21724@lists.php.net to get a copy of this message
Thanks! -----Original Message----- From: Lawrence.Sheed@dfait-maeci.gc.ca [mailto:Lawrence.Sheed@dfait-maeci.gc.ca] Sent: Monday, October 23, 2000 3:14 PM To: Maxim Maletsky; php-general@lists.php.net Subject: RE: [PHP] Encrypt <--> Decrypt Solution 1: Why not make a custom encrypt / decrypt function. rot13 is an old goodie (add 13 to all chars <128) eg (from top of head) function bad_encrypt ($s){ $len = strlen($string); for ($i =1 ; $i<$len ; $i++) { if (chr ($s[$i]) <128) $s[$i] = chr($s[$i]+13); } return ($s); } function bad_decrypt ($s) { $len = strlen($string); for ($i =1 ; $i<$len ; $i++) { if (chr ($s[$i])<141) $s[$i] = chr($s[$i]-13); } return ($s); } Use it encrypt when passing to a form, and decrypt when you need to store / output correct values. Obviously there are better ways to obfuscicate your data ;) solution 2: Use mcrypt look at http://www.php.net/manual/html/ref.mcrypt.html You can encrypt and decrypt as long as you know the key (or have alex muffets crack, and some time on your hands) -----Original Message----- From: Maxim Maletsky [mailto:maxim@japaninc.net] Sent: October 23, 2000 01:26 PM To: 'PHP General List. (E-mail)' Subject: [PHP] Encrypt <--> Decrypt Hello List, I never used encryptions before. What I want to do is to pass a variable via get form, I do not want it to be visually understandable. However when time comes (after few actions) it will be freely shown to the user. I though that I could encrypt it and (decrypt) it later. But I cannot find any way to decrypt anything, I found few discussions in forums saying that there's no way to do it but instead you can compare... I got it, but what if a string must be visually understandable and/or sometimes not.. ? Any idea how can I do it? Thanks guys. Maxim Maletsky - maxim@j-door.com <mailto:maxim@j-door.com> Webmaster, J-Door.com / J@pan Inc. LINC Media, Inc. TEL: 03-3499-2175 x 1271 FAX: 03-3499-3109 <http://www.j-door.com/> http://www.j-door.com <http://www.japaninc.net/> http://www.japaninc.net <http://www.lincmedia.co.jp/> http://www.lincmedia.co.jp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#21724) next »