String GetHashCode() hash相同

            Console.WriteLine("NB0903100006".GetHashCode());

 

            Console.WriteLine("NB0904140001".GetHashCode());

 

上面2个字符串有相同的hash

hash值碰撞

 

 

http://msdn.microsoft.com/en-gb/library/system.string.gethashcode.aspx

If two string objects are equal, the GetHashCode method returns identical values. However, there is not a unique hash code value for each unique string value. Different strings can return the same hash code.

 

 

posted @ 2009-04-15 13:47  gameoverboss  阅读(317)  评论(0编辑  收藏  举报