I am creating a source code system that I give out online for providing adopted virtual pets. The system will belong primarily to children. Since I want it to be useful for novice programmers, there are several complexity limitations on my system: it cannot use libraries that usually do not ship with PHP, and cannot touch a database or write to another persistent storage.
When each pet is accepted, the visitor will randomly receive one of a series of slightly different variations of this pet. The changes initially look the same, but grow over time to become different pets. The visitor will be given a short HTML code that refers to the image of his pet. Since there is no permanent storage on the server, the link to the userβs image must contain all the information in order to determine what change they received for pets.
Currently, the URL contains only the pet ID and the identifier of the change that the user received. The problem is that by comparing the codes with each other, users can find out which one is in the same version. Because some variations are less common than others, users can easily spot rare variations before the difference is even visually apparent.
What I would like is an encryption system for details in the url. Something that hides the variation identifier so that each user gets a different URL with a high probability. I was thinking about using the variation identifier (3 or 4 bits) as the low bits or high bits of a large random number, but users will define a pattern in this. Ideally, the encryption system will be parameterized so that each installation of my system uses slightly different encryption.
The PHP mcrypt library is likely to have something useful in it, but it does not seem very common among hosters.
Is there a simple, parameterized, obfuscation / encryption that I can use here?
php encryption
thenickdude
source share