Reputation:
I'm trying to obfuscate and ID (Ex: 1) with different value.
So if I obfuscate 1 it may give me different values as ADHU6767asD or hiuy76FY and when I will un-obfuscate it, it will give 1.
Any idea on how to do this?
Thanks!
** EDIT :
When I access to a page of my php application (page.php?id=1) where 1 load specific information from the database, I want to obfuscate this is, to an alphanumeric string.
Neither I want the obfuscated string to always have the same value (ex : 1 is ALWAYS ABC543) I'm also not interested to keep the obfuscated value into a database.
Upvotes: 0
Views: 652
Reputation: 618
There's a nice example by Ray Morgan of creating a tamper-proof user-id obfuscation scheme that does not require database storage of the id's encoded form :
Another approach would be to use symmetric (bi-directional) encryption (concat'ing id with a salt) with AES...
Upvotes: 2
Reputation: 6335
The obfuscation protocol could use filename and/or function name as a salt for the obfuscation that will happen. That way you would only see the same IDs in the same file or function and you can have a repeatable process. Otherwise you would have to have many different ways for keeping track of how you obfuscated each file or function.
Upvotes: 0