note 102289 deleted from function.base64-encode by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.