Re: encryption decryption without mcrypt?

From: Date: Thu, 24 Aug 2000 19:56:16 +0000
Subject: Re: encryption decryption without mcrypt?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-13509@lists.php.net to get a copy of this message
You could use something like this. I didn't write it so don't ask me any questions on it. // These functions are used to encrypt the passowrd before it is // stored in a cookie. function OneTimePadEncrypt ($string, $pad) { for ($i = 0; $i < strlen ($string); $i++) { $encrypted .= chr (ord($string[$i]) ^ ord($pad[$i])); } return base64_encode($encrypted); } function OneTimePadDecrypt ($string, $pad) { $encrypted = base64_decode ($string); for ($i = 0; $i < strlen ($encrypted); $i++) { $decrypted .= chr (ord($encrypted[$i]) ^ ord($pad[$i])); } return $decrypted; } function OneTimePadCreate ($length=100) { srand ((double) microtime() * 1000000); for ($i = 0; $i < $length; $i++) { $pad .= chr(rand(0,255)); } return $pad; } $onetimepad = OneTimePadCreate(strlen($secretkey)); $key = OneTimePadEncrypt($secretkey, $onetimepad); session_register("onetimepad"); -- Lewis Bergman Texas Communications 4309 Maple St. Abilene, TX 79602 915-695-6962

« previous php.general (#13509) next »