This answer does not actually use encryption, but since your question has also been labeled with encoding ...
With PHP 5, you can use bin2hex :
$s = base64_decode('eyJpZCI6IjM2In0='); echo bin2hex($s);
Conclusion:
7b226964223a223336227d
To decode:
$s = hex2bin($data);
Or:
$s = pack('H*', $data);
Btw, if the id parameter is sensitive, you might consider checking its protection as an alternative to full encryption.
Forgot to mention how you can make base64 secure url:
function base64_url_encode($input) { return strtr(base64_encode($input), '+/=', '-_,'); } function base64_url_decode($input) { return base64_decode(strtr($input, '-_,', '+/=')); }
Ja͢ck source share