I want to find a way to obfuscate data with openssl, my data are mostly id, so small-ish number.
Right now I'm using this
$key = 'SecretKey';
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = mcrypt_generic($td, $string);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return urlencode(str_replace('=', '', strtr(base64_encode($encrypted_data), '+/', '-_')));
And it's working great.
But I want to go to the next level.
Now it's more like a reference table. Each time I encode the number 1, the same string is returned.
I know that with some encoding we can have the same number be encoder in a multiple way, but when decoded always return the same number.
What encoding/modification should I do in my script to acheive this result?
Thank you


Sign In
Create Account


Back to top









