php 加密解密小程序
php 加密解密小程序,按键盘顺序重新排序字母表
$subject=$_GET['s'];
$replace = ['a'=>'q','b'=>'w','c'=>'e','d'=>'r','e'=>'t','f'=>'y','g'=>'u','h'=>'i','i'=>'o','j'=>'p','k'=>'a',
'l'=>'s','m'=>'d','n'=>'f','o'=>'g','p'=>'h','q'=>'j','r'=>'k','s'=>'l','t'=>'z','u'=>'x',
'v'=>'c','w'=>'v','x'=>'b','y'=>'n','z'=>'m'];
$encrypt=strtr($subject, $replace);
$decrypt=strtr($encrypt, array_flip($replace));
echo '加密:'.$encrypt;
echo '解密:'.$decrypt;
//输入abcdefg
//输出 加密:qwertyu解密:abcdefg
评论 (0)