Swat/SwatString.php
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;
    }
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;
    }
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 ; }
Gets a unique hash of a string

The hashing is as unique as md5 but the hash string is shorter than md5.
This method is useful if hash strings will be visible to end-users and
shorter hash strings are desired.

@param string $string the string to get the unique hash for.

@return string the unique hash of the given string. The returned string
is safe to use inside a URI.
Gets a unique hash of a string