/** * Regression test for File_Passwd.crypt_apr_md5 method * @access public */ function testcrypt_apr_md5() { $apr = '$apr1$ab$KfzLTsXi6eQkfErEn8CHY.'; $this->assertEquals($apr, File_Passwd::crypt_apr_md5('ab', 'ab')); }
/** * Generate password with htpasswd executable * * @access private * @return string the crypted password * @param string $pass the plaintext password * @param string $salt the salt to use * @param string $mode encyption mode, usually determined from * <var>$this->_mode</var> */ function _genPass($pass, $salt = null, $mode = null) { $mode = is_null($mode) ? utf8_strtolower($this->_mode) : utf8_strtolower($mode); if ($mode == 'md5') { return File_Passwd::crypt_apr_md5($pass, $salt); } elseif ($mode == 'des') { return File_Passwd::crypt_des($pass, $salt); } elseif ($mode == 'sha') { return File_Passwd::crypt_sha($pass, $salt); } return PEAR::raiseError(sprintf(FILE_PASSWD_E_INVALID_ENC_MODE_STR, $mode), FILE_PASSWD_E_INVALID_ENC_MODE); }