Str.php
public static function hash($string, $algorithm = 'blowfish')
    {
        switch( strtolower($algorithm) ):
            case('md5'):
                $salt = '$1$'.(static::rand(12)).'$';
                break;
            case('sha256'):
                $salt = '$5$rounds=5000$'.(static::rand(16)).'$';
                break;
            case('sha512'):
                $salt = '$6$rounds=5000$'.(static::rand(16)).'$';
                break;
            case('blowfish'):
            default:
                $salt = '$2a$09$'.(static::rand(22)).'$';
                break;
        endswitch;

        return base64_encode(crypt($string, $salt));
    }
public static function hash($string, $algorithm = 'blowfish')
    {
        switch( strtolower($algorithm) ):
            case('md5'):
                $salt = '$1$'.(static::rand(12)).'$';
                break;
            case('sha256'):
                $salt = '$5$rounds=5000$'.(static::rand(16)).'$';
                break;
            case('sha512'):
                $salt = '$6$rounds=5000$'.(static::rand(16)).'$';
                break;
            case('blowfish'):
            default:
                $salt = '$2a$09$'.(static::rand(22)).'$';
                break;
        endswitch;

        return base64_encode(crypt($string, $salt));
    }
Hash string using crypt function

@uses    crypt()
@param   string  $string     string to hash
@param   string  $algorithm  [blowfish, md5, sha256, sha512]
@return  string