Sorvolando sull'utilità dei due return consecutiviOriginariamente inviato da thitan
in realtà un metodo c'è, se ne è già parlato su questo forum, non ricordo quale utente ha scritto un codice che ho usato qualche volta e funziona bene:
Codice PHP:function crypta($x){
$key="tuachiavedicryptazione";
if(strlen($key)<32){
$key = md5($key);
}
$ld = strlen($x);
$lk = strlen($key);
for($i=0, $crpass=""; $i<$ld; $i++){
$crpass .= sprintf("%02X",(ord($x[$i]))^(ord($key[$i%$lk])));
}
return $crpass;
return $x;
}
function decrypta($x){
$key="tuachiavedicryptazione";
if(strlen($key)<32) $key = md5($key);
$ld = strlen($x);
$lk = strlen($key);
for($i=0, $data=""; $i<$ld; $i+=2){
$data .= chr((hexdec(substr($x, $i, 2)))^(ord($key[($i>>1)%$lk])));
}
return $data;
return $x;
}
queste funzioni non c'entrano niente con md5


Rispondi quotando