Questions tagged [hash-collision]

a situation that occurs when two distinct pieces of data have the same hash value, checksum, fingerprint, or cryptographic digest.

See also the wiki tag.

233 questions
7
votes
2 answers

How can I evenly distribute distinct keys in a hashtable?

I have this formula: index = (a * k) % M which maps a number 'k', from an input set K of distinct numbers, into it's position in a hashtable. I was wondering how to write a non-brute force program that finds such 'M' and 'a' so that 'M' is minimal,…
Pavel
  • 1
  • 3
  • 17
  • 51
7
votes
5 answers

Why isn't randomized probing more popular in hash table implementations?

According to various sources, such as Wikipedia and various .edu websites found by Google, the most common ways for a hash table to resolve collisions are linear or quadratic probing and chaining. Randomized probing is briefly mentioned but not…
dsimcha
  • 67,514
  • 53
  • 213
  • 334
7
votes
6 answers

What does it mean by "the hash table is open" in Java?

I was reading the Java api docs on Hashtable class and came across several questions. In the doc, it says "Note that the hash table is open: in the case of a "hash collision", a single bucket stores multiple entries, which must be searched…
derrdji
  • 12,661
  • 21
  • 68
  • 78
7
votes
2 answers

What is the difference between a multi-collision and a first or second pre-image attack on a hash function?

What is the difference between a multi-collision in a hash function and a first or second preimage. First preimage attacks: given a hash h, find a message m such that hash(m) = h. Second preimage attacks: given a fixed message m1, find a different…
7
votes
5 answers

Uniquely identifying URLs with one 64-bit number

This is basically a math problem, but very programing related: if I have 1 billion strings containing URLs, and I take the first 64 bits of the MD5 hash of each of them, what kind of collision frequency should I expect? How does the answer change if…
itsadok
  • 28,822
  • 30
  • 126
  • 171
6
votes
2 answers

How to find identical byte[]-objects in two arrays concurrently?

I'm trying to implement an collision attack on hashes (I'm visiting the course 'cryptography'). Therefore I have two arrays of hashes (= byte-sequences byte[]) and want to find hashes which are present in both arrays. After some research and a lot…
Florian Pilz
  • 8,002
  • 4
  • 22
  • 30
6
votes
1 answer

How was SHA-0 broken? - What is the significance of a mere handful of hash collisions?

I wanted to understand how the SHA0 hash function was broken. I understand that utilising the birthday problem/pigeon-hold principle, hash collision(s) were found. http://www.mail-archive.com/cryptography%40metzdowd.com/msg02554.html contains an…
dsf
  • 145
  • 3
  • 8
6
votes
3 answers

substr md5 collision

I need a 4-character hash. At the moment I am taking the first 4 characters of a md5() hash. I am hashing a string which is 80 characters long or less. Will this lead to collision? or, what is the chance of collision, assuming I'll hash less than…
Neel Basu
  • 12,638
  • 12
  • 82
  • 146
6
votes
2 answers

Uniform distribution of hashcode()

I define my class as: final class Key> { private final T q; private final T o; public Key(T q1, T o1) { q = q1; o = o1; } @Override public boolean equals(Object obj) { if(obj…
nd07
  • 127
  • 9
6
votes
2 answers

What property of the bit pattern is it that causes collisions?

I was reading about Java's approach to randomize hash keys here Apparently the idea is to make sure that the lower bits are "random" to help the distribution but I am trying to understand this more. So if we have a table of size 10 then the numbers…
Jim
  • 18,826
  • 34
  • 135
  • 254
6
votes
2 answers

Why does a HashTable store the hash value of the key in the table in java

I was going through Java's implementation of the put method for a hashtable and came across this : // Makes sure the key is not already in the hashtable. Entry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) %…
akanksha1105
  • 338
  • 2
  • 7
5
votes
4 answers

512 bit hash vs 4 128bit hash

Interestingly I haven't found enough information regarding any test or experiment of collision chances of single 512bit hash like whirlpool versus concatenation of 4 128bit hashes like md5, sha1 etc. Possibility of 4 128bit hashes to appear same…
Rick James
  • 307
  • 1
  • 9
5
votes
3 answers

Will this hash function collide unusually frequently?

I had the following code to generate a hash of an object: public int GetHashCode(MyType obj) { return (obj.Prop1.GetHashCode() + obj.Prop2.GetHashCode() + obj.Prop3.GetHashCode()).GetHashCode(); } I.e. I add all the properties' hash codes and…
Xodarap
  • 11,581
  • 11
  • 56
  • 94
5
votes
2 answers

Distribution of CRC checksums

I am investigating about the collision propability of CRC checksums when they are used as a hashes. I know how to calculate the collision propability for hash algorithms that are evenly distributed (which means the chance to get all possible…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
5
votes
3 answers

About Object.hashcode() and collisions

I was reading the JavaDoc for Object.hashCode method, it says that As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the…
Luigi Cortese
  • 10,841
  • 6
  • 37
  • 48
1 2
3
15 16