public static function hash($string)
    {
        $hash = md5($string, true);
        $hash = base64_encode($hash);

        // remove padding characters
        $hash = str_replace('=', '', $hash);

        // use modified Base64 for URL varient
        $hash = str_replace('+', '*', $hash);
        $hash = str_replace('/', '-', $hash);

        return $hash;
    }