note 52384 deleted from ref.mcrypt by danbrown

From: Date: Mon, 13 Dec 2010 16:25:18 +0000
Subject: note 52384 deleted from ref.mcrypt by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174862@lists.php.net to get a copy of this message
Note Submitter: thilo-at-hardtware.de ---- I have modified the xor-encryption of Anonymous. It is now returning and eating base64-encoded strings. That's much better for saving and transporting (e.g. saving in a database) the encrypted string. <?php function encrypt($string, $key) { $result = ''; for($i=0; $i<strlen($string); $i++) { $char = substr($string, $i, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)+ord($keychar)); $result.=$char; } return base64_encode($result); } function decrypt($string, $key) { $result = ''; $string = base64_decode($string); for($i=0; $i<strlen($string); $i++) { $char = substr($string, $i, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)-ord($keychar)); $result.=$char; } return $result; } ?>

« previous php.notes (#174862) next »