加密安全
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