framework/utils/CPasswordHelper.php
public static function hashPassword($password,$cost=13)
	{
		self::checkBlowfish();
		$salt=self::generateSalt($cost);
		$hash=crypt($password,$salt);

		if(!is_string($hash) || (function_exists('mb_strlen') ? mb_strlen($hash, '8bit') : strlen($hash))<32)
			throw new CException(Yii::t('yii','Internal error while generating hash.'));

		return $hash;
	}
public static function hashPassword($password,$cost=13)
	{
		self::checkBlowfish();
		$salt=self::generateSalt($cost);
		$hash=crypt($password,$salt);

		if(!is_string($hash) || (function_exists('mb_strlen') ? mb_strlen($hash, '8bit') : strlen($hash))<32)
			throw new CException(Yii::t('yii','Internal error while generating hash.'));

		return $hash;
	}
public static function hashPassword ( $ password , $ cost = 13 ) { self :: checkBlowfish ( ) ; $ salt = self :: generateSalt ( $ cost ) ; $ hash = crypt ( $ password , $ salt ) ; if ( ! is_string ( $ hash ) || ( function_exists ( 'mb_strlen' ) ? mb_strlen ( $ hash , '8bit' ) : strlen ( $ hash ) ) < 32 ) throw new CException ( Yii :: t ( 'yii' , 'Internal error while generating hash.' ) ) ; return $ hash ; }
Generate a secure hash from a password and a random salt.

Uses the
PHP {@link http://php.net/manual/en/function.crypt.php crypt()} built-in function
with the Blowfish hash option.

@param string $password The password to be hashed.
@param int $cost Cost parameter used by the Blowfish hash algorithm.
The higher the value of cost,
the longer it takes to generate the hash and to verify a password against it. Higher cost
therefore slows down a brute-force attack. For best protection against brute for attacks,
set it to the highest value that is tolerable on production servers. The time taken to
compute the hash doubles for every increment by one of $cost. So, for example, if the
hash takes 1 second to compute when $cost is 14 then then the compute time varies as
2^($cost - 14) seconds.
@return string The password hash string, always 60 ASCII characters.
@throws CException on bad password parameter or if crypt() with Blowfish hash is not available.
Generate a secure hash from a password and a random salt .