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
0
votes
1 answer

How to correctly implement hash insert function in c++?

I need to read a file and then store each word to the hash table with linked list collision handling, and count how many times each word appeared (node's value). When I run my code with small text (like 30 lines) it works, but starting from about…
0
votes
1 answer

How to generate hash of arbitrary length with MurmurHash3 32 bit

I am currently trying to hash a set of strings using MurmurHash3, since 32 bit hash seems to be too large for me to handle. I wanted to reduce the number of bit used to generate hashes to around 24 bits. I already found some questions explaining how…
0
votes
1 answer

Does HMAC encrypts the original Plaintext message?

So my Question is a combination of 3: Does HMAC hashing also hash the message along with the Secret key send to the recipient? Or just the Secret key is hashed, leaving the message as Plaintext? If ONLY the secret key is hashed(not hashing the…
mohdraqif
  • 23
  • 1
  • 5
0
votes
2 answers

Pass a parameter to an unordered_map (or set) hash struct

I have the following struct: array map_size; struct Node{ int id; array pos; vector nbs; bool in_open; bool in_closed; }; Every Node has a position (pos) that is in range of map_size (global…
BMarin
  • 55
  • 6
0
votes
3 answers

How can we customize our own hash function for C++ unordered set to gain a specific order?

In competitive coding we face many question where we have to provide the output in an order of input. So, we need to make own hash function. Any idea how could I write my own hash function?
0
votes
0 answers

What happens between when a user inputs their password and when the specific hashes math starts working with it?

For reference I only know python so that's what I've been working with. I've recently been looking into making my own hashing algorithm to further my understanding on how they work, I'm not looking into creating the most cryptographically secure…
NULL
  • 1
  • 2
0
votes
2 answers

Hash function precision issue

I'm writing a program that spell checks words, but my hash function is not returning the same number for the same words. My question is how is my hash function not returning the same hash for the same input. Here is a Minimal, Reproducible Example…
Nicolas F
  • 505
  • 6
  • 17
0
votes
2 answers

Can someone explain to me how this HASH FUNCTION works (also if they have another better option)?

I'm working on CS50's pset 5, speller. I need a hash function for a hash table that will efficiently store all of the words on the dictionary (~140,000). I found this one online, but I don't understand how it works. I don't know what << or ^ mean.…
Nicolas F
  • 505
  • 6
  • 17
0
votes
0 answers

Insert and delete node from hash table in C

in the code I made I have problems in deleting a node from the list of a hash table. In fact it seems that the first node of a list is connected to the last node of the previous list. For example: the first node of the list in position 6 of the…
Argo2007
  • 23
  • 5
0
votes
1 answer

Looking for Hash Function

I am looking for a hash function with the following properties It maps an arbitrary string uniformly between 0 and 1 The hash function output is independent of the length of the string The hash function accepts a random seed For a given random seed…
0
votes
0 answers

Finding a hash function that calculates average of an item in a stream of tuples

am new to this topic and I am trying to learn so my question might have been a bit confusing. What my question actually is: I have a stream of data coming in the form of tuple [Country, state, person]. now on this stream of data, I want to perform…
0
votes
1 answer

use one hash to monitor a collection of revision hash changes?

excuse me for the vague title, let me explain: I have a collection of git repos, and I need to come up with a "synthetic" hash which is generated by the revision hashes from these repos, so it can be used to differentiate which repo has new…
Chen Xie
  • 3,849
  • 8
  • 27
  • 46
0
votes
2 answers

How to hash multiple times and concatenate a string in each round

I am writing a program which concatenate a word R at the end of a password and then calculate the SHA-256 hash. Later on, adding the R word again at the end of the hex result and calculate the new hash with SHA256. I want this to repeat for 100…
Codefather
  • 27
  • 1
  • 9
0
votes
0 answers

Java monotonically increasing hash function

Is there implementation for monotonically increasing hash function: given x,y,z are monotonically increasing the f(x,y,z) will be monotonically increasing ? Update We can assume x,y,x are positive integers and the method result is long
Alex Stanovsky
  • 1,286
  • 1
  • 13
  • 28
0
votes
0 answers

Why `register` is used in DJBX33A hash algorithm?

I see register is used here. https://gist.github.com/hmic/1676398 But I don't why it is specified as register. It seems the reasons listed here don't apply. https://www.geeksforgeeks.org/understanding-register-keyword/ Could anybody let me know why…
user1424739
  • 11,937
  • 17
  • 63
  • 152