|
|
|
|
|
|
| |
| <?php
// Script created by Nur-E-Alam Khan
// Email: porosh@msn.com (Dhaka, Bangladesh)
// Requirment : You need mcrypt module installed and enabled in your server.
function porosh_encrypt($data_input){
$key = "key1";
$td = mcrypt_module_open('cast-256', '', 'ecb', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = mcrypt_generic($td, $data_input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
$encoded_64=base64_encode($encrypted_data);
return $encoded_64;
}
function porosh_decrypt($encoded_64){
$decoded_64=base64_decode($encoded_64);
$key = "key1";// same as you used to encrypt
$td = mcrypt_module_open('cast-256', '', 'ecb', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$decrypted_data = mdecrypt_generic($td, $decoded_64);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return $decrypted_data;
}
// use:
//$value = porosh_encrypt($data_input);/// For encrypt
//$value = porosh_decrypt($encoded_64);// For Decrypt
// just include those functions with your script
//$input_data is a variable which can be use for the data you need to encrypt.
//$encoded_64 is also a variable which will be used to store the data after
//it's encrypted and then encoded with the base64_encode() function.
?> | | |
|
| A PHP function to encrypt and decrypt a number or string or a combination of the two. Categories : PHP, Encryption, Security | | | base64 with encryption - encode and decode sessions Categories : PHP, PHP Classes, Encryption, Sessions | | | Scramble Eggs - php class to scramble/encode Categories : PHP, PHP Classes, Security, Encryption | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | PHP Function to Encrypt/Decrypt a string without a known key. The string itself has his own different key for every character. Categories : PHP, Algorithms, Security, Authentication, Encryption | | | MD5 based block cypher in 128 bit CFB Categories : PHP, Encryption, MD5 | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | Check if a file exists on a remote FTP server with PHP Categories : PHP, FTP, Regexps | | | Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate. Categories : Authentication, PHP | | | file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | PHP Paypal IPN Integration Class v1.0.0 Categories : PHP, PHP Classes, Payment Gateways | | | Function to remember password Categories : PHP, Authentication, Personalization and Membership | | | Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality. Categories : PHP, GD image library, Graphics | | | readline -- Reads a line Categories : PHP, PHP Functions, Readline | | | a function that builds an HTML select list from any mysql table. Categories : PHP, MySQL, HTML and PHP | |
|
|
|