For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Saturday, October 05, 2013

openssl_encrypt and openssl_decrypt in PHP

openssl_encrypt and openssl_decrypt in PHP

openssl_encrypt and openssl_decrypt


/*$string = 'This is test';
$pass = '1234';
$method = 'aes128';
file_put_contents ('./file.txt', openssl_encrypt ($string, $method, $pass));*/


$method = 'aes-128-ecb';
$iv = openssl_random_pseudo_bytes(
openssl_cipher_iv_length($method));
$msg="this is the testing for encoding and decoding";

$en=openssl_encrypt($msg, $method, 'def', true, $iv);
echo $en;


$de=openssl_decrypt($en, $method, 'def', true, $iv);
echo $de;

Share:

0 comments:

Post a Comment

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights   You have a website and want to test it'...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive