Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

A Reversible Encryption Routine for PHP

By Tony Marston
2005-04-15


Using the Encryption Class

In order to use this class you must first include/require the file containing the class definition and then create an object or instance of the class.
require 'std.encryption.class.inc';

$crypt = new Encryption;
To encrypt a string you must supply the string and a key. The string length is optional. Note that before you write this to your database you should use the addslashes() command to deal with any special characters.
$encrypt_result = $crypt->encrypt($key, $password, $pswdlen);

$errors = $crypt->errors;
To decrypt a string you must supply the string and the key that was used to encrypt it.
$decrypt_result = $crypt->decrypt($key, $password);

$errors = $crypt->errors;


Tutorial Pages:
» A Reversible Encryption Routine for PHP
» Rotating each character a fixed number of positions
» Swapping between two different character strings
» Manipulating the index number between the two strings
» Customising the Encryption Algorithm
» Class Variables
» Class Constructor
» The ConvertKey function
» The ApplyFudgeFactor function
» The CheckRange Function
» The Decrypt function
» Using the Encryption Class
» Summary


 | Bookmark
Related Tutorials:
» Zend Framework Tutorial
» Port Scanning and Service Status Checking in PHP
» Web Database Access from Desktop Applications
» CubeCart 3.0 Installation and Configuration
» PHP Site Search Made Easy
» Installing and Configuring Drupal 6.1