Ver Mensaje Individual
  #7  
Antiguo 12-03-2009
Dado de baja Dado de baja is offline
Miembro
 
Registrado: ago 2007
Posts: 140
Reputación: 20
Dado de baja Va por buen camino
He localizado la función que desencripta..
Pero no me entero de nada. Creo que convierte a hexadecimal pero he realizado pruebas con una clave conocida y no da el resultado ni por asomo, tanto en MD5 Sha1

Código PHP:
function getCryptedPassword($plaintext, $salt = '', $encryption = 'md5-hex', $show_encrypt = false)
    {
        
// Get the salt to use.
        
$salt = JUserHelper::getSalt($encryption, $salt, $plaintext);

        
// Encrypt the password.
        
switch ($encryption)
        {
            case 
'plain' :
                return 
$plaintext;

            case 
'sha' :
                
$encrypted = base64_encode(mhash(MHASH_SHA1, $plaintext));
                return (
$show_encrypt) ? '{SHA}'.$encrypted : $encrypted;

            case 
'crypt' :
            case 
'crypt-des' :
            case 
'crypt-md5' :
            case 
'crypt-blowfish' :
                return (
$show_encrypt ? '{crypt}' : '').crypt($plaintext, $salt);

            case 
'md5-base64' :
                
$encrypted = base64_encode(mhash(MHASH_MD5, $plaintext));
                return (
$show_encrypt) ? '{MD5}'.$encrypted : $encrypted;

            case 
'ssha' :
                
$encrypted = base64_encode(mhash(MHASH_SHA1, $plaintext.$salt).$salt);
                return (
$show_encrypt) ? '{SSHA}'.$encrypted : $encrypted;

            case 
'smd5' :
                
$encrypted = base64_encode(mhash(MHASH_MD5, $plaintext.$salt).$salt);
                return (
$show_encrypt) ? '{SMD5}'.$encrypted : $encrypted;

            case 
'aprmd5' :
                
$length = strlen($plaintext);
                
$context = $plaintext.'$apr1$'.$salt;
                
$binary = JUserHelper::_bin(md5($plaintext.$salt.$plaintext));

                for (
$i = $length; $i > 0; $i -= 16) {
                    
$context .= substr($binary, 0, ($i > 16 ? 16 : $i));
                }
                for (
$i = $length; $i > 0; $i >>= 1) {
                    
$context .= ($i & 1) ? chr(0) : $plaintext[0];
                }

                
$binary = JUserHelper::_bin(md5($context));

                for (
$i = 0; $i < 1000; $i ++) {
                    
$new = ($i & 1) ? $plaintext : substr($binary, 0, 16);
                    if (
$i % 3) {
                        
$new .= $salt;
                    }
                    if (
$i % 7) {
                        
$new .= $plaintext;
                    }
                    
$new .= ($i & 1) ? substr($binary, 0, 16) : $plaintext;
                    
$binary = JUserHelper::_bin(md5($new));
                }

                
$p = array ();
                for (
$i = 0; $i < 5; $i ++) {
                    
$k = $i +6;
                    
$j = $i +12;
                    if (
$j == 16) {
                        
$j = 5;
                    }
                    
$p[] = JUserHelper::_toAPRMD5((ord($binary[$i]) << 16) | (ord($binary[$k]) << 8) | (ord($binary[$j])), 5);
                }

                return 
'$apr1$'.$salt.'$'.implode('', $p).JUserHelper::_toAPRMD5(ord($binary[11]), 3);

            case 
'md5-hex' :
            default :
                
$encrypted = ($salt) ? md5($plaintext.$salt) : md5($plaintext);
                return (
$show_encrypt) ? '{MD5}'.$encrypted : $encrypted;
        }
    } 
Alquien que sepa php podría indicarme ?
__________________
Saludos Cordiales.
------------------
Responder Con Cita