I’m not sure what this is called, which is why I’m having trouble searching for it.
What I’m looking to do is to take numbers and convert them to some alphanumeric base so that the number, say 5000, wouldn’t read as ‘5000’ but as ‘G4u’, or something like that. The idea is to save space and also not make it obvious how many records there are in a given system. I’m using php, so if there is something like this built into php even better, but even a name for this method would be helpful at this point.
Again, sorry for not being able to be more clear, I’m just not sure what this is called.
Funnily enough, I asked the exact opposite question yesterday.
The first thing that comes to mind is converting your decimal number into hexadecimal. 5000 would turn into
1388, 10000 into2710. Will save a few bytes here and there.You could also use a higher base that utilizes the full alphabet (0-Z instead of 0-F) or even the full 256 ASCII characters. As @Yacoby points out, you can use
base_convert()for that.As I said in the comment, keep in mind that this is not an efficient way to mask IDs. If you have a security problem when people can guess the next or previous ID to a record, this is very poor protection.