Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:这题竟然可以发现标准hash的bug......

Posted by alawing at 2008-11-26 15:07:39 on Problem 2503
In Reply To:这题竟然可以发现标准hash的bug...... Posted by:alawing at 2008-11-26 15:06:19
哦原来是乘法算的hash我说呢,hash(fv) = hash(gf)

> 经过我提交本题20+次
> 加上搜索网上数据得出
> int ELFhash(char* key)
> {
> 	unsigned long h = 0;
> 	while(*key)
> 	{
> 		h = (h<<4) + *key++;
> 		unsigned long g = h & 0Xf0000000L;
> 		if(g)
> 			h ^= g >> 24;
> 		h &= ~g;
> 	}
> 	return h % M;
> }
> 这个hash算法有覆盖= =;
> 例如eeeeeefvnb eeeeeegfnb这2个hash值竟然一样(函数里h算出来的就一样)
> 厄。。。。。
> 

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator