<?php
/**
* @Description 加密
* @param $str
* @return array
*/
function transform(string $str) : array
{
$booksecret = '+-. _@0123456789:qwertyuiopasdfghjklzxcvbnmMNBVCXZLKJHGFDSAPOIUYTREWQ';
$bookshuffle = str_shuffle($booksecret);
$res = null;
$strM = strlen($str);
for($i = 0; $i < $strM; $i++){
$postion = strpos($booksecret,$str[$i]);
$res .= $bookshuffle[$postion];
}
$result['shuff'] = $bookshuffle;
$result['req'] = $res;
return $result;
}
$res = transform('Modified by: I will never know what the next difficulty is');
/**
* @Description 解密
* @param $content
* @return string
*/
function gettrans(array $content) : string
{
$booksecret = '+-. _@0123456789:qwertyuiopasdfghjklzxcvbnmMNBVCXZLKJHGFDSAPOIUYTREWQ';
$shuff = $content['shuff'];
$res = $content['req'];
$strM = strlen($res);
$con = null;
for($i = 0; $i < $strM; $i++)
{
$con .= $booksecret[strpos($shuff,$res[$i])];
}
return $con;
}
echo gettrans($res);