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


Class Constructor

This function is automatically called whenever an object is created from this class. I use this to set up the contents of the two strings which I call scramble1 and scramble2. Each of these strings contains exactly the same characters, but in a different order. In this case I am using all 95 printable characters from the ASCII character set. Note the following:

• As I am enclosing each string in single quotes to include a single quote inside the string I have to escape it with a leading '\'.
• The first character in each string MUST also be duplicated at the end of that string - this gets round a bijou problemette when the first character of the password is also the first character in $scramble1.

I also use the class constructor to define default values for adj and mod.



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