Questions tagged [hash-function]

A hash function is an algorithm that maps large data sets of keys to smaller data sets of a fixed length. Hash functions are not reversible.

The values returned by a hash function are called hash values, hash codes, hash sums, checksums or simply hashes.

Hash functions are mostly used to accelerate lookup times for data comparison tasks such as finding items in a hash table, database, detecting duplicated or similar records in a large file, etc.

Read more on Wikipedia.

264 questions
5
votes
1 answer

Locality Preserving Hash Function

Is there any Java library that provides an implementation (or several) of a Locality Preserving Hash Function for Strings?
Laurent
  • 14,122
  • 13
  • 57
  • 89
5
votes
1 answer

Does the C++ standard define the structure of a bucket for unordered_set?

When a hash value for an element in a unordered_set is computed it is placed in a "bucket" together with other -- different -- elements but same hash value. My experience is that the elements in such a bucket are stored in a singly linked list.…
towi
  • 21,587
  • 28
  • 106
  • 187
5
votes
2 answers

How to make my hashing algorithm faster

My question is connected with task from CS50, pset5. For ones who don't know any about that, I'll try to explain. Nothing very special. I just need to make function which will intake dictionary file (it was written before, all of the words in that…
5
votes
1 answer

what would be a good hash function for bucket sort?

First, most places that claim to have an implementation of bucket sort are actually implementing counting sort. My question is about bucket sort as implemented on Geek Viewpoint and Wikipedia. I don't really get/like the hash function on Geek…
Katedral Pillon
  • 14,534
  • 25
  • 99
  • 199
5
votes
4 answers

Constructing a hash table/hash function

I would like to construct a hash table that looks up keys in sequences (strings) of bytes ranging from 1 to 15 bytes. I would like to store an integer value, so I imagine an array for hashing would suffice. I'm having difficulty conceptualizing how…
snap
  • 711
  • 3
  • 11
  • 25
5
votes
1 answer

good hash function for struct key that has three ints

For a simple C++ struct that has three ints to identify a unique structure, what can be a good hash function implementation if not too much is known about the realistic values of a,b and c. I need to use the struct as Key to unordered_map? struct…
Saher Ahwal
  • 9,015
  • 32
  • 84
  • 152
5
votes
2 answers

Minhash implementation how to find hash functions for permutations

I have a problem implementing minhashing. On paper and from reading I understand the concept, but my problem is the permutation "trick". Instead of permuting the matrix of sets and values the suggestion for implementation is: "pick k (e.g. 100)…
user2359192
  • 71
  • 1
  • 3
5
votes
2 answers

Dynamic perfect hashing and universal hash functions - explanation please?

So I'm reading up about hash tables, hash functions etc. I was intrigued to read on wikipedia about how "dynamic perfect hashing" involves using a second hash table as the data structure to store multiple values within a particular bucket. Where I…
Ray
  • 3,468
  • 8
  • 26
  • 27
5
votes
3 answers

Java Fastest Hash Function

I have a Boolean string (like "01100..001") of length 128 characters (means 128 number of 0/1). I am searching for an efficient (fast) hash function in Java, which produce a much lower representation than 128 bit and obviously with less collision.…
Arpssss
  • 3,850
  • 6
  • 36
  • 80
4
votes
1 answer

Understanding hashing passwords in Java by MessageDigest

I'm creating a simple web application and want to store hashed passwords into a database. I need the hash function for the authentication token too (concatenating the user name and the date and send them with their hash to the client as the…
Roy Tsabari
  • 2,000
  • 6
  • 26
  • 41
4
votes
9 answers

Hash function on list independant of order of items in it

I want to have a dictionary that assigns a value to a set of integers. For example key is [1 2 3] and value will have certain value. The thing is that [3 2 1] needs to be treated the same in my case so hash needs to be equal, if I go with hash…
Valentin Kuzub
  • 11,703
  • 7
  • 56
  • 93
4
votes
1 answer

load factor in separate chaining?

Why is it recommended to have a load factor of 1.0 in separate chaining? I've seen plenty of people saying that it is recommended, but not given a clear explanation of why. With open addressing, I know the load factor should be between 0.5 and 0.7…
JozzWhers
  • 81
  • 1
  • 4
4
votes
2 answers

Is double hashing collision resistant?

Double Hashing can surely provides more security than only 1 layer of hashing, but does that necessarily mean it is more collision resistant? This question in a more math form: If H is a collision resistant hash function, is H(H(x)) for some x still…
4
votes
3 answers

Relationship between (1) hash function, (2) length of signature and (3) jaccard similarity?

I am trying to understand/implement minHash based jaccard similarity in python. The main goal is use it in MapReduce. However I am not clear how the choice of hash function and length of signature affects error rate in computing jaccard similarity.…
4
votes
1 answer

I need some direction on writing a Hash Function to sort ~160,000 strings

My instructor dumped this on us, and told us we just needed to google how to write a hash function. I am quite directionless on this. We wrote a basic Hash Table template for class, but I have a project due that requires ~160,000 strings to be…
rearden
  • 135
  • 1
  • 1
  • 11
1 2
3
17 18