public function hash($string)
{
return hexdec(substr(md5($string), 0, 8));
}
public function testMd5Hash() { $hasher = new Md5Hasher(); $result1 = $hasher->hash('test'); $result2 = $hasher->hash('test'); $result3 = $hasher->hash('different'); $this->assertEquals($result1, $result2); $this->assertNotEquals($result1, $result3); // fragile but worthwhile }