joomla password encryption

前端 未结 9 1680
借酒劲吻你
借酒劲吻你 2020-11-27 14:13

I need to access the joomla user table jos_users for login checking from external php script [codeignitor].

joomla storing password like this

         


        
相关标签:
9条回答
  • 2020-11-27 14:41

    From the joomla source file libraries/joomla/crypt/password/simple.php there are multiple ways they get stored, and some do not have a ':' character.

        switch ($type)
        {
            case '$2a$':
            case JCryptPassword::BLOWFISH:
                if (JCrypt::hasStrongPasswordSupport())
                {
                    $type = '$2y$';
                }
                else
                {
                    $type = '$2a$';
                }
    
                $salt = $type . str_pad($this->cost, 2, '0', STR_PAD_LEFT) . '$' . $this->getSalt(22);
    
                return crypt($password, $salt);
    
            case JCryptPassword::MD5:
                $salt = $this->getSalt(12);
    
                $salt = '$1$' . $salt;
    
                return crypt($password, $salt);
    
            case JCryptPassword::JOOMLA:
                $salt = $this->getSalt(32);
    
                return md5($password . $salt) . ':' . $salt;
    
    
        }
    }
    
    0 讨论(0)
  • 2020-11-27 14:42

    Joomla "understands" the passwords with "normal" md5.

    What I've done in the past (to test a user's login), was to save the original password, encrypt a new one in md5, replace it in the database, test it with the browser (and it works) and when I was done, paste the original password in the database.

    0 讨论(0)
  • 2020-11-27 14:46

    If you just use md5($password); it'll work, try it. Joomla has a mechanism and it can work with multiple types of passwords (including, as of late, strong passwords). You don't have to worry about the part after the colon. Just use md5($password) and it'll definitely work.

    By the way, this'll also work on Joomla 3.x.

    0 讨论(0)
提交回复
热议问题