/** * Returns a hash code for this string. The hash code for a * <code>String</code> object is computed as * <blockquote><pre> * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] * </pre></blockquote> * using <code>int</code> arithmetic, where <code>s[i]</code> is the * <i>i</i>th character of the string, <code>n</code> is the length of * the string, and <code>^</code> indicates exponentiation. * (The hash value of the empty string is zero.) * * @return int a hash code value for this object. */ public function hashCode() { $h = $this->hash; if ($h == 0) { $this->hash = $h = Integer::hexStringToInt(md5($this->string)); // $off = 0; // $val = $this->string; // $len = $this->count; // // for ($i = 0; $i < $len; $i++) { // $h = 31 * $h + $val[$off++]; // } // $this->hash = $h; } return $h; }