- substr: documentation ( source)
- microtime: documentation ( source)
- str_replace: documentation ( source)
- base64_encode: documentation ( source)
- strrev: documentation ( source)
- md5: documentation ( source)
<?php
function encrypt($plain) {
$plain = md5($plain);
$V = md5('??????');
//var_dump($V);
$rnd = md5(substr(microtime(),11));// hao miao
//var_dump(substr(microtime(),11)+mt_rand(0,35));
$cipher = '';
for($i = 0; $i < strlen($plain); $i++) { //32ci
$cipher .= ($plain[$i] ^ $rnd[$i]);
echo $cipher;
}
$cipher .= $rnd;
echo $cipher;
$V .= strrev($V);
echo $V;
//var_dump($cipher);
for($i = 0; $i < strlen($V); $i++) {
$cipher[$i] = ($cipher[$i] ^ $V[$i]);
}
//var_dump($cipher);
//var_dump($V);
return str_replace('=', '', base64_encode($cipher));
}
encrypt('sb')
?>