- hex2bin: documentation ( source)
- bin2hex: documentation ( source)
- base64_decode: documentation ( source)
- base64_encode: documentation ( source)
- strrev: documentation ( source)
<?php
$encodedSecret = "3d3d516343746d4d6d6c315669563362";
function encodeSecret($secret) {
return bin2hex(strrev(base64_encode($secret)));
}
function decodeSecret($secret) {
return hex2bin(strrev(base64_decode($secret)));
}
$secret = "hello";
echo decodeSecret(encodeSecret($secret));
?>