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
1
vote
1 answer

Vowpal Wabbit hash collision works better than L1 as regularization

I have VW classification model which i wanted to inspect for number of features and number of hash collisions. I trained it and test it on different datasets. The datasets conatins more than 400k features, so with 18bit VW space, it is possible to…
1
vote
2 answers

Which digits of a UUID are least likely to collide if the generator (e.g. Java version of UUID) is unknown?

Suppose we have an existing set of UUIDs (say, millions, though it doesn't matter) that may have been generated by different clients, so that we don't know the algorithm that generated any UUID. But we can assume that they are popular…
Andrew Cheong
  • 29,362
  • 15
  • 90
  • 145
1
vote
0 answers

Resizing hash table using chaining method

I need to implement a program, which will insert numbers from input to hash table. I want to use chaining method to avoid collisions. The program must have a function to resize hash table. My question is, how to count load factor, and when the hash…
A.Cabb
  • 65
  • 6
1
vote
3 answers

What is the difference between hash()%n and n%hash()

In many books, syllabus, tutorials I've seen that a good option to find a proper cell of an item is to calculate a number of the cell: item.hash()%(n-1) = # of the bucket. But why is this certain expression is mentioned? How does the inverse one…
Pasha
  • 1,768
  • 6
  • 22
  • 43
1
vote
2 answers

Calculating Hash Collisions with 160 bits

Assume a hash function that produces digests of 160 bits. How many messages do we need to hash to get a collision with approximately 75% probability? Thank you for you help :)
1
vote
1 answer

Hash-collision: Chance growing with multiple hashing

Is the chance of hash-collisions growing, when you hash the object multiple times? Meaning, is the chance of collisions higher for hash(hash(object)) than for hash(object)?
F.M.F.
  • 1,929
  • 3
  • 23
  • 42
1
vote
1 answer

In .NET, can there be key collisions for a Dictionary

I just learned that: Dictionaries in .NET are implemented as Hash tables from this answer and the linked MSDN article about the Dictionary Class . The string hash function GetHashCode() does not provide a unique hash code value for…
Marcel
  • 15,039
  • 20
  • 92
  • 150
1
vote
1 answer

Store Secure Username in Database

I would like to protect my users' username in an online service, as it may be personally identifying (e.g., an email-address), but am wondering if it's even possible... My first inclination was to hash it (unsalted), but am worried about possible…
Eliott
  • 332
  • 3
  • 13
1
vote
1 answer

What about using multiple rand() functions to create unique ID

I was just wondering, in term of security, what about using multiple rand() functions to generate one unique ID? Like so: $unique_id = rand(1, 15) . rand(15, 50) . rand(50, 100) . rand(15, 50); would result to something like 8215236. I don't want to…
1
vote
2 answers

Hash code collision handling in collison chain

Let us consider HashMap, which employs separate chaining to resolve hashcode collisions. If I have multiple entries, where hascode comes out to be same, the collision mechanism forms a linked-list chain of all those entries. Now, lets consider a…
Mandar Kale
  • 337
  • 2
  • 13
1
vote
1 answer

How can I find a collision for a toy hash function?

I'd like to find a collision for a simple hash function below (python): def hash_function(s=''): # 'Hello World!' -> 7b2ea1ba a, b, c, d = 0xa0, 0xb1, 0x11, 0x4d result_hash = '' for byte in bytes(s, 'ascii'): a ^= byte …
Denis Yakovenko
  • 3,241
  • 6
  • 48
  • 82
1
vote
2 answers

Java Hash Code Implementation with Multiple equals and if

From what i know, Every equals object must have same hash code. However what if in equals method have multiple if that need to be followed ? Location is an object, Junction is an object, length is an integer, offset is an integer, section is an…
Rifqi Ryan
  • 19
  • 1
1
vote
2 answers

Could elements stored in the same bucket be reassigned to separate buckets after rehashing?

Until now, I know that after rehashing in a HashMap, all the entries are rehashed with the new table length. But I want to know what will happen when I have collisions. e.g. Map map = new HashMap<>(5); map.put("a",…
emer
  • 55
  • 1
  • 7
1
vote
3 answers

When exactly does the ordering of the hash map keys are affected,

I know that there is no guarantee in the order of the keys in the hashmap. Will the reordering happen if there is no rehashing or hash collision?
Jerin Joseph
  • 759
  • 1
  • 7
  • 22
1
vote
1 answer

How does google's sparse hash table handle collisions?

How does google's sparse hash table handle collisions? i.e. when 2 elements map to the same bucket, how does it decide where to put the new (colliding) element? I'm reading What is the main implementation idea behind sparse hash table? but that…
dhruvbird
  • 6,061
  • 6
  • 34
  • 39