[TYPO3-english] Creating a salted MD5 password fails

Marc Klein realshiva at gmx.de
Tue Apr 8 17:57:55 CEST 2014


Hi,
 
I'm trying to generate a salted MD5 password in a eID script and doing something wrong :-(.
When I call the getHashedPassword() Method 3 times in a row I get 3 different results and none of them matches the hash in the DB.
 
----
    protected function saltPassword ( $password ) {
        $saltedPassword = '';
        echo $password . ' || ';
        $saltedpasswordsInstance = tx_saltedpasswords_salts_factory::getSaltingInstance();
        echo $saltedPassword = $saltedpasswordsInstance->getHashedPassword($password);
        echo ' || ';
        $saltedpasswordsInstance = tx_saltedpasswords_salts_factory::getSaltingInstance();
        echo $saltedPassword = $saltedpasswordsInstance->getHashedPassword($password);
        echo ' || ';
        $saltedpasswordsInstance = tx_saltedpasswords_salts_factory::getSaltingInstance();
        echo $saltedPassword = $saltedpasswordsInstance->getHashedPassword($password);
        echo ' || ';
        return $saltedPassword;
    }
----
Results in

asdf || $1$JiUaTtX5$gxeLYdT0M/WiA5E3TENA61 || $1$Ns7LPbhO$rgjOQve.ETW0qW0m7rhQU. || $1$9uVyi3MZ$yhsbscIDxwVR4pxYQnCrQ1

Any idea what I'm doing wrong?
 
With best regards
Marc


More information about the TYPO3-english mailing list