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

Does halving every SHA224 2 bytes to 1 byte to halve the hash length introduce a higher collision risk?

Let's say I have strings that need not be reversible and let's say I use SHA224 to hash it. The hash of hello world is 2f05477fc24bb4faefd86517156dafdecec45b8ad3cf2522a563582b and its length is 56 bytes. What if I convert every two chars to its…
Alper Turan
  • 1,220
  • 11
  • 24
1
vote
1 answer

Hash Table: Should I increase the element count on collisions?

Right now my hash tables count the number of every element inserted into the hash table. I use this count, with the total hash table size, to calculate the load factor and when it reaches like 70%, I rehash it. I was thinking that maybe I should…
rfgamaral
  • 16,546
  • 57
  • 163
  • 275
1
vote
2 answers

Separate chaining for HashTables in Java

Based on the following code snippet : Hashtable balance = new Hashtable(); Enumeration names; String str; double bal; balance.put("Zara", new Double(3434.34)); //first entry for Zara balance.put("Mahnaz", new Double(123.22)); …
Dubby
  • 1,154
  • 3
  • 16
  • 31
1
vote
1 answer

Why is my identifier collision rate increasing?

I'm using a hash of IP + User Agent as a unique identifier for every user that visits a website. This is a simple scheme with a pretty clear pitfall: identifier collisions. Multiple individuals browse the internet with the same IP + user agent…
samthebrand
  • 3,020
  • 7
  • 41
  • 56
1
vote
2 answers

Java : How to make this hash table function work on a much larger scale

I have the following code, that will take 30 strings (that are numbers) and put them into a hash table after computing them with "%29" import java.util.Arrays; public class HashFunction { String[] theArray; int arraySize; int…
user3274463
  • 53
  • 1
  • 4
  • 12
1
vote
1 answer

which hash functions are orthogonal to each other?

I'm interested in multi-level data integrity checking and correcting. Where multiple error correcting codes are being used (they can be 2 of the same type of codes). I'm under the impression that a system using 2 codes would achieve maximum…
1
vote
1 answer

Is using unique data better than random data for a hash?

I need to generate global unique ids by hashing some data. On the one hand, I could use a combination of timestamp and network address, which is unique since every computer can only create one id at the same time. But since this data is to long I'd…
danijar
  • 32,406
  • 45
  • 166
  • 297
1
vote
1 answer

How is data retrieved from a HashTable in collision?

According to this, time complexity of search in a hashtable is O(1). However if there is a collision, then obviously this should be O(1) + something. My question is: When you say get(someKey) from a hashtable, the hashing function is applied to…
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
1
vote
2 answers

Collision rates for trimmed SHA1- hashes

With my webapp I'm storing cached files with a hash generated filename in various subdirectories to optimize performance levels. One way I know that I could improve performance also would be to ensure that the generated names follow a 8.3 filename…
James South
  • 10,147
  • 4
  • 59
  • 115
1
vote
1 answer

Probing hash tables

I am implementing a hash table for a project, using 3 different kinds of probing. Right now I'm working on linear. For linear probing, I understand how the probing works, and my instructor implied he wanted the step size to be 1. The thing is, no…
1
vote
11 answers

Chaining in HashMap

Code: public static void main(String[] args) { Map map= new HashMap(); map.put("a", "s"); map.put("a", "v"); System.out.println(map.get("a")); } Now, as per my understanding, since the key values in…
Kraken
  • 23,393
  • 37
  • 102
  • 162
1
vote
2 answers

Hash collision worries

If I have a system where a hash is generated out of a total permutation of 1 million possibilities. If there's a 10% chance of a collision, should I worry about the generating algorithm running 5 times? I have a system similar to jsfiddle, where a…
qwertymk
  • 34,200
  • 28
  • 121
  • 184
0
votes
2 answers

What hash function is better?

I write my implementation of HashMap in Java. I use open addressing for collision resolution. For better key distribution I want use a nice hash function for int hashcode of key. I dont know what hash function is better for it? public int getIndex(K…
gizzy
  • 47
  • 1
  • 5
0
votes
3 answers

Hash Cryptographic Function Output Anomolies

Anyone know if MD5, Whirlpool, SHA[n], etc., have any "special" input that might get a hexdigest output to align into: All numeric characters All alpha characters All of the same character/pattern repeated consistently or entirely Example in…
yurisich
  • 6,991
  • 7
  • 42
  • 63
0
votes
3 answers

How can i count the collisions in this hash function?

This is a prefix hashing function. i want to count the number of collisions in this method but i am not sure how to do it. It seems like it might be simple but i just cant think of a great way to do it.... int HashTable_qp::preHash(string & key, int…
user977154
  • 1,045
  • 4
  • 19
  • 39