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

How do I choose the right checksum for a simple C++ program, and how do I implement it?

I'm very new to checksums, and fairly new to programming. I have a fairly simple C++ program (measuring psi) that I'm transferring to an Arduino board. Would crc16 be OK or should I go with crc32 or would that be overkill?
-2
votes
1 answer

K distinct hash functions

I have a list of items , for example ["Alice","Bob","Alice","John"] and I want to generate k hash functions such that : h1("Alice") = val1 h2("Alice") = val2 ... hk("Alice") = val3 I tried using MD5 algorithm in Python2.X for hashing but it will…
-2
votes
1 answer

What are the other Hash Key related functions for DB table Keys?

We are using Hash-Key function for one of the source tables to create a unique identifier key. But Hash-Key function has some limitations with respective to 32 bit integer. We tried using MD5 but we don't want to use Char based key for Char based…
-3
votes
1 answer

3 Byte output hashing algorithm

So for a project that I am working on, I am trying to get a hashing algorithm but I don't know anything about hashing algorithms. The final outcome I would like to archive is inputing a 6 byte value and get 3 unique bytes as my output. My other…
-3
votes
1 answer

Why do bit-shift operators make my hash function so fast?

I'm learning C right now and I had originally built this hash function for a spell checker program I'm building in a CS50 edx course. int hashing(char *word) { unsigned int hash = 0; for (int i = 0, n = strlen(word); i < n; i++) …
-3
votes
1 answer

Implementing a hash table that maps strings to an array in C++. I keep getting "Debug Assertion Failed" and I don't know why

So as the title says I'm trying to implement a hash table that uses a hash function to map strings into an array. The hash table uses separate chaining method to handle collisions and thus requires linked list (the hash table is implemented as an…
lol
  • 49
  • 1
  • 1
  • 8
-4
votes
1 answer

What is the probability of collision in Hash Function?

I want to ask about the probability of collision in Hash Function? Thanks
-6
votes
2 answers

Java : Is there any hash function available for converting string to number from the specified range

In java, I need a hash function or algorithm that generate the number from the specified input string in such a way that the generated number should be in the range like 1000 to 6000. Condition to satisfy : 1) The algorithm should always reproduce…
Vinoth
  • 7
  • 2
  • 10
-8
votes
2 answers

I don't understand this hash-function code

Can anyone please explain how this hash function work? I have spent a lot of time trying to figure it out and still don't know how it works. Full code is from…
1 2 3
17
18