java,hash,apache-commons,hash-collision,apache-commons-lang

You might be able to more optimally distribute your generated hash codes by adding more parameters when generating the hash code (this is independent of the Apache commons library). With this example, you could pre-compute one or more properties of the Route class and use this property when generating the...

c++,vector,hashmap,hashtable,hash-collision

//inserting into hash table with linear probing as collision resolution if (hTable[(index+i)%hsize].key == FREE) { hTable[index] = record; You don't want to insert into [index] when [(index + i)%hsize] is the free location....

The simple answer is pretty obvious: yes, it increases the chance of collision by as many powers of 2 as there are bits missing. For 56 bytes halved to 28 bytes you get the chance of collision increased 2^(28*8). That still leaves the chance of collision at 1:2^(28*8). Your use...

math,probability,sha1,hash-collision

@Teepeemm has correctly answered the related question ‘given a particular sequence of 8 hex digits, what is the chance of another SHA-1 hash appearing with the same 8 digits?’ It's a very small number. What's at stake in this question, though, is a different question: ‘given a large number of...

java,hash,null,hashcode,hash-collision

From Joshua Bloch's excellent book Effective Java, 2nd Edition (page 49): If the value of the field is null, return 0 (or some other constant, but 0 is traditional). So you can use any constant of your choice, but usually, 0 is used as the hash code of null. In...

This has nothing to do with hash collision. Hash collisions (ie., keys with the same hashcode()) are handled correctly by the HashMap. In your example, both keys are equal (ie., 7.equals(7) == true), so the old value is replaced. In the following example Map<Integer, String> map = new HashMap<>(); map.put(7,...

Does Java use separate chaining only for collision handling? Yes. You can only have one entry per key in a Hashtable (or HashMap, which is what you should probably be using - along with generics). It's a key/value map, not a key/multiple-values map. In the context of a hash...

hash,collision,identifier,hash-collision,user-tracking

Possible explanations starting with the simplest: The collision rate is relatively stable, but your initial measurement isn't significant because of the low volume of positives that you got. 37 isn't very many. In this case, you've got two decent data points. The collision rate isn't very stable and changes over...