Ok, if you find yourself in the situation where you need to encrypt some data with php but the server that is hosting your website does not provide the mcrypt libraries or any other library for that matter, you can probably make good use of these two functions. It uses a very simple character substitution algorithm but as distinctive feature it allows the programmer to define the range of characters that will be used as replacements. The functions and a demo are available for download.
The encryption algorithm replaces the characters from the original text with two characters from the character pool based on a combination between the code of the original character and the code of coresponding character from the given key.
The function uses a default character pool containing all lowercase and uppercase letters and digits from 0 to 9. If needed you can change this character pool to any set of characters as long as there are at least 24 unique characters (example: 1Qe87rT6yUipA5sFg4HjklZXcVBnM2).
You can test the encryption using the form below (please note that by providing an invalid character pool the decryption process may not return the correct result).