note 102289 deleted from function.base64-encode by danbrown

From: Date: Mon, 07 Feb 2011 14:07:28 +0000
Subject: note 102289 deleted from function.base64-encode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176731@lists.php.net to get a copy of this message
Note Submitter: info at vuralacar dot de ---- Hi, Here is an example (encrypt & decrypt) source-code from me. I am using an additional codec_file to make it more secure, which contains a 128-Bit Key. URL file-access must be enabled in the server configuration file (PHP.INI) to make the external codec file usable. function getCodec() { $filename = "http://localhost/k.dec"; $filehandle = fopen($filename, "r"); $content = fread($filehandle, filesize($filename)); fclose($filehandle); return $content; } function decryptor($_data) { return trim(mcrypt_decrypt(MCRYPT_3DES, base64_decode(getCodec()), base64_decode($_data), MCRYPT_MODE_CBC, base64_decode("fHikHLFKEdXi=")),"\x00..\x1F"); } function encryptor($_data) { return (base64_encode(trim(mcrypt_encrypt(MCRYPT_3DES, base64_decode(getCodec()),$_data, MCRYPT_MODE_CBC, base64_decode("fHikHLFKEdXi="))))); } Vural Acar

« previous php.notes (#176731) next »