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));
    }