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
0
votes
2 answers

Chance of a hash collision

Apologies if this is a duplicate question; most of those I've found are over my head, so I may have missed the answer. For a given hash, say MD5 (128 bits), what is the chance of a hash collision with 10^12 of them? My maths is not great, I've come…
Jodes
  • 14,118
  • 26
  • 97
  • 156
0
votes
1 answer

MD5 hashing collision in username hashing

This question does not need any code, it's just a conceptual thing about MD5 hashing. My app manages a community of users. I use MD5 hashing to reduce a user nickname of arbitrary length to a hash. I expect the MD5 of every nick to be different,…
rupps
  • 9,712
  • 4
  • 55
  • 95
0
votes
2 answers

Best method of making a hash function

I am building a composite key for a hash map in java and want to determine my own hash code for each of these objects. My question is what is the best methodology of the two below. My composite key has three String attributes and one int…
HXSP1947
  • 1,311
  • 1
  • 16
  • 39
0
votes
1 answer

Get a collision free hash for a specific query or a view with SQL Server 2008

I am working on a project where I need to synchronize data from our system to an external system. What I want to achieve, is to periodically send only changed items (rows) from a custom query. This query looks like this (but with many more columns)…
MaxiWheat
  • 6,133
  • 6
  • 47
  • 76
0
votes
1 answer

Implementing Good hashCode function in java?

I know now a days inbuilt utilities available like HashCodeBuilder from Apache commons lang but i was trying to understand how to implement it myself and came across the example of hascode function for Employee class at…
M Sach
  • 33,416
  • 76
  • 221
  • 314
0
votes
2 answers

CRC16 collision (2 CRC values of blocks of different size)

The Problem I have a textfile which contains one string per line (linebreak \r\n). This file is secured using CRC16 in two different ways. CRC16 of blocks of 4096 bytes CRC16 of blocks of 32768 bytes Now I have to modify any of these 4096 byte…
grubi
  • 155
  • 2
  • 16
0
votes
1 answer

Hashed array linked list collision resolution error

This block of code reads a dictionary file and stores it in a hashed array. This hashing array uses linked list collision resolution. But, for some incomprehensible reason, the reading stops in the middle. (i'm assuming some problem occurs when…
slow
  • 805
  • 3
  • 13
  • 27
-1
votes
1 answer

How collision between different HashMap objects is avoided?

I have found that HashMaps calculate hashes for performance optimization. They use hashCode() to split up Keys into different buckets, and equals() for further comparison within those buckets. However, I could not find an explanation of how…
vidma
  • 9
  • 3
-1
votes
2 answers

How to evaluate custom hash function?

I have a Dictionary with a custom hashing function. I want to test the hash function, because even though it returns different hash results for my test values, some of them may still map to the same bucket due to the modulo % operation. So how to…
phuclv
  • 37,963
  • 15
  • 156
  • 475
-1
votes
2 answers

Value modification of key-pair in HashMap and impact for a HashCode

A few days ago I had an interview and there a few interesting questions occurred. Namely, the recruiter asked me meticulous questions. Some of them concerned the close relationship between HashCode and the collections, which are based on the…
Martin
  • 1,139
  • 4
  • 23
  • 49
-1
votes
1 answer

Dealing with python hash() collision

I've created a program to take a users predetermined unique identifier, hash it, and store it in a dictionary mapping to the user's name. I later receive the unique identifier, rehash it, and can look up the user's name. I've come to a problem…
JamesRichardson
  • 131
  • 2
  • 13
-1
votes
1 answer

Will similar Strings in HashMap lead to increased chance of collisions?

Consider the following: HashMap hm = new HashMap<>(); final String prefix = "My objects "; int counter = 0; void put(Object value) { hm.put(prefix+(counter++), value); } Given that the key of each entry starts with the same…
Sina Madani
  • 1,246
  • 3
  • 15
  • 27
-1
votes
1 answer

How to determine whether to overwrite a value or use a collision strategy? (Java HashMaps)

I have been implementing a hashmap from scratch and this dawned on me. Lets say I have 3 distinct keys and 3 values Keys -> Value: A -> 1, B -> 2,C -> 3 and they each land in an open slot in the array. If the fourth key D produces the same…
Rstack
  • 45
  • 1
  • 10
-1
votes
2 answers

Hash Collisions even after overriding equals and hashcode methods for object being stored as key in Hashmap

I need to store object type of class edge as Key and ArrayList as Value public class edge { String edgeType; // Horizontal or Vertical edge int i; //i and j for a cell in 2D matrix int j; } HashMap>…
-1
votes
1 answer

Hash table collision-handling schemes and the load factors

Which of the hash table collision-handling schemes could tolerate a load factor above 1 and which could not? Thank you in advance!
CSstudent
  • 43
  • 1
  • 7
1 2 3
15
16