/** * Generate crypted password * * @static * @access public * @return string the crypted password * @param string $pass new plaintext password * @param string $salt new crypted password from which to gain the salt */ function generatePasswd($pass, $salt = null) { return File_Passwd::crypt_des($pass, $salt); }
/** * Regression test for File_Passwd.crypt_md5 method * @access public */ function testcrypt_md5() { $this->assertEquals(crypt('a', '$1$ab'), File_Passwd::crypt_des('a', '$1$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); }