加密安全
function encode($str,$key) { $res = base64_encode($str); $code = $res^$key; return $code; }
解密加密
function decode($str,$key) { return base64_decode($str^$key); }
完整代码示例:code
$str = '111021'; $key = 'APPYJJ-PHONE-LAZY'; function encode($str,$key) { $res = base64_encode($str); $code = $res^$key; return $code; } $str = encode($str,$key); print_r($str); echo "<hr>"; function decode($str,$key) { return base64_decode($str^$key); } print_r(decode($str,$key));
整个程序很简单~按照逻辑思惟来讲应该是很难被破解的,在别人不知道你秘钥的状况下;字符串
若是感受仍是不安全的话。那么我就在此抛砖引玉了;建议你们能够继续在加密解密过程当中运用移位运算io
//加密的时候; $a = $str >> 4; //解密的时候则相反 $a = $str << 4;
ok!~到此为止,博主继续工做了!~~base64