古い「暗号化された」データを、古いシステムの適切な暗号化アルゴリズムに変換する必要があります。私はこのコードを持っています:
function unpackString($s,$l){
$tmp=unpack('c'.$l,$s);
$return=NULL;
foreach($tmp as $v){
if($v>0){
$return.=chr($v);
}
}
return $return;
}
function packString($s,$l){
$return=NULL;
for($i=0;$i<$l;$i++){
$return.=pack('c',ord(substr($s,$i,1)));
}
return $return;
}
$string='StackOverflow Is AWESOME';
$l=strlen($string);
$encoded=packString(base64_encode($string),$l);
$decoded=base64_decode(unpackString($encoded,$l));
echo "\n".$decoded."\n";
出力が表示される理由と表示StackOverflow Is A
されない理由StackOverflow Is AWESOME