mcrypt.* and mdecrypt.*
provide symmetric encryption and decryption using libmcrypt.
Both sets of filters support the same algorithms available to
mcrypt extension in the form of
mcrypt.ciphername where ciphername
is the name of the cipher as it would be passed to
mcrypt_module_open().
The following five filter parameters are also available:
Table M-1. mcrypt filter parameters
Parameter
Required?
Default
Sample Values
mode
Optional
cbc
cbc, cfb, ecb, nofb, ofb, stream
algorithms_dir
Optional
ini_get('mcrypt.algorithms_dir')
Location of algorithms modules
modes_dir
Optional
ini_get('mcrypt.modes_dir')
Location of modes modules
iv
Required
N/A
Typically 8, 16, or 32 bytes of binary data. Depends on cipher
key
Required
N/A
Typically 8, 16, or 32 bytes of binary data. Depends on cipher
Example M-10. Encrypting file output using 3DES
<?php $passphrase = 'My secret';
/* Turn a human readable passphrase * into a reproducable iv/key pair */ $iv = substr(md5('iv'.$passphrase, true), 0, 8); $key = substr(md5('pass1'.$passphrase, true) . md5('pass2'.$passphrase, true), 0, 24); $opts = array('iv'=>$iv, 'key'=>$key);
filters.encryption php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
Php filters.encryption syntax tutorial
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.