A Reversible Encryption Routine for PHP
By Tony Marston2005-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
