Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 PHP Code: Reversible Encryption in PHP Jump to:  
Category: >> PHP Code >> Reversible Encryption in PHP Bookmark and Share

<< lastnext >>

Snippet Name: Reversible Encryption in PHP

Description: Mcrypt is a PHP function that uses encryption algorithms. It can be used to encrypt and decrypt data.

Also see:
» Saving Remote Images With PHP
» More File Type Detection in PHP
» Send iCal Email Meeting Requests using...
» Checking Server Status with PHP
» Simple reversible encryption
» Call a PHP function when clicking on a...
» Send Unicode Response From PHP
» Reversible Encryption in PHP
» Use htpasswd file with PHPscripts
» PHP and Oracle: Connect to database
» Server Stats via PHP
» FTP via PHP
» Online PHP Tester
» Email attachments with PHP mail()
» Basic PHP Calendar
» Check syntax of multiple PHP files all...
» Create mySQL table with PHP
» Create thumbnails with PHP
» PHP to JavaScript Array
» Pass vars to/from PHP
» PHP - connect to an Oracle database
» PHP/Oracle 8 DB abstraction
» Oracle with PHP
» Oracle with PHP

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: February 19th, 2010

$string = "Mary had a little lamb.";
$key = "My Secret Key";
 
// Encryption Algorithm
$alg = MCRYPT_RIJNDAEL_256;
// Create the initialization vector for increased security.
$iv = mcrypt_create_iv(mcrypt_get_iv_size($alg, MCRYPT_MODE_ECB), MCRYPT_RAND);
 
// Output the original string
PRINT "The original string is: $string <p>";
 
// Encrypt $string
$encrypted_string = mcrypt_encrypt($alg, $key, $string, MCRYPT_MODE_CBC, $iv);
 
// Convert to hexadecimal and output to browser
 
PRINT "The encrypted string is: ".BIN2HEX($encrypted_string)."<p>";
$decrypted_string = mcrypt_decrypt($alg, $key, $encrypted_string, MCRYPT_MODE_CBC, $iv);
 
PRINT "The decrypted string is: $decrypted_string";
 


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 49 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?