脚本宝典收集整理的这篇文章主要介绍了PHP加密 – 并解密base64编码,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
现在Godaddy删除了选项base64_encode并解码.这样我们就无法向用户发送短信.因此,我们将手机号码恢复到本地运行的正常状态.
我的问题是哪种是使用密钥加密和解密字符串的最简单,最安全的方法.
就像是
Normal string : 9876543210 -> After encrypt wITh a key -> AASASOOPFPOEROP45664654456 Encrypted string : AASASOOPFPOEROP45664654456 -> on decrypt -> 9876543210
我目前的代码
function encodeString($str){ for($i=0; $i<5;$i++) { $str=strrev(base64_encode($str)); //apply base64 First and then reverse the string } return $str; } function decodeString($str){ for($i=0; $i<5;$i++) { $str=base64_decode(strrev($str)); //apply base64 first and then reverse the string} } return $str; }
请帮我 .提前致谢
//用于加密/解密的密钥
$关键= ‘mysecretkey’; // 8-32个字符,没有空格
//要加密的字符串
$string1='your sample key,that is the question';
// EnCrypt字符串
$string2=convert($string1,$key);
// DeCrypt回来
$string3=convert($string2,$key);
//测试输出
echo '<span style="font-family:Courier">'; echo 'Key: '.$key.'<br>'."\n"; echo $string1.'<br>'."\n"; echo $string2.'<br>'."\n"; echo $string3.'<br>'."\n"; echo '</span>'."\n";
OUTPUT
Key: mysecretkey your sample key,that is the question tvfw#ady{i|-rv|/2q|jq9dj3qkw%e~`jyp|k your sample key,that is the question
让我知道我可以帮助你更多.
以上是脚本宝典为你收集整理的PHP加密 – 并解密base64编码全部内容,希望文章能够帮你解决PHP加密 – 并解密base64编码所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。