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
0 answers

How to write a perfect hash function for 36 strings?

Using the numbers 0-5 I need to write a perfect has function for 36 Student ID Strings with six characters and 3 integers (e.g. BYPLOK120). The hash function looks something like as follows: String [] studentID = ... is 36 unique Strings in the…
0
votes
1 answer

Unambiguous hashable representation for plane defined by 3 points with integer coordinates

I need to be able to use planes as keys in a hash map. The planes are defined by three distinct points in 3d space. I have been unable to find a representation for a plane, that is the same no matter which points on it are used to construct it, so…
0
votes
0 answers

Hash table and hash function implementation

So this is an implementation for hash table https://www.programiz.com/dsa/hash-table that we took in class but I couldn't understand it. I have some question Is this like an array of size 10, like we have 10 bucket. we don't have built-in array in…
0
votes
1 answer

is it possible that hash function produces the same hash value for two different inputs?

is it possible that hash function produces the same hash value for two different inputs ? I am not mistaken I have read that hash function is one way encryption, so we cannot go back to the input using the result, and read that even if we change a…
0
votes
0 answers

How do I make the Binary A fixed length for my sha 256 hash function?

Hi I'm having trouble with a certain part of my code right now. I'm writing a SHA 256 Hash function and I'm having an error with the message schedule. I don't really know how to approach this issue I basically created words 0-15 but I keep running…
NemesisX
  • 1
  • 1
0
votes
1 answer

Fast hash function from 2^n-1 digit (means, binary 111....) into its sum of bits or other some small range

I m looking for easy hash-function what would map the number, consist of ones from the right (means, 1,3,7,15 = in binary: 1,11, 111,1111)into in the best way summ of its digits (do not suggest just bit count function, i do not want to rely on that…
user184868
  • 193
  • 9
0
votes
2 answers

Common Lisp SXHASH and nested lists

The standard says that (equal x y) implies (= (sxhash x) (sxhash y)). Let us check it: (defun sxhash-test () (let ((obj1 (list 1 2 (list 1 1))) (obj2 (list 1 2 (list 1 2)))) (format t "are objects equal?: ~a~%" (equal obj1 obj2)) ;; =>…
IgSokolov
  • 55
  • 4
0
votes
1 answer

Hash function that returns the same hash for a sum even if different terms lead to the same sum

let's say I have: n = 14 n is the result of the following sums of integers: [5, 2, 7] -> 5 + 2 + 7 = 14 = n [3, 4, 5, 2] -> 3 + 4 + 5 + 2 = 14 = n [1, 13] -> 1 + 13 = 14 = n [13, 1] -> 13 + 1 = 14 = n [4, 3, 5, 2] -> 4 + 3 + 5 + 2 = 14 = n ... I…
tonix
  • 6,671
  • 13
  • 75
  • 136
0
votes
3 answers

C++ - Hash/Map a std::vector in a single uint64_t

I need to map a std::vector to a single uint64_t. It is possible to do? I thought to use a hash function. Is that a solution? For example, this vector: std::vector v { 16377, 2631694347470643681, …
th3g3ntl3man
  • 1,926
  • 5
  • 29
  • 50
0
votes
1 answer

good hash function for a string of numbers and letters of the form "9X9XX99X9XX999999"

what would be a good hash code for a vehicle identification number, that is a string of numbers and letters of the form "9X9XX99X9XX999999," where a "9" represents a digit and an "X" represents a letter?
0
votes
0 answers

Quadratic Probing Hashfunction C++

I am currently implementing a hashtable with quadratic probing in C++. I started of by implementing a rather simple hashfunction: Adding up the ASCII values of each letter of my key (=string). Since I am aware that this is not a good hashfunction at…
xaemy
  • 11
  • 3
0
votes
2 answers

Hashing Function for a Dynamic Open Addressing Quadratically Probed Hash Table

I've been writing from scratch a C implementation for a dynamically sized hash table. I made a crucial error in that my hashing function was based on the capacity of the hash table. Since the capacity changes over times this doesn't work. What are…
Ben
  • 195
  • 7
0
votes
1 answer

How to generate ECFP hashing folding data?

I'm trying to convert chemical structures to ECFP data. Buy, I have a problem with the folding steps. I understand all of the processes of generating ECFP data through D. Rogers and M. Hahn's paper (J. Chem. Inf. Model., Vol. 50, No. 5, 2010) I…
0
votes
1 answer

How do I implement a hash function with two keys or more?

I am currently working on data structures and algorithm semester project in C++. I want to implement a hash function to access a person's data using his name (string) and his phone number (integer). I also plan to handle collisions with open…
SomeOne
  • 1
  • 1
0
votes
1 answer

I found a table with these values and want to know what hashing function this is similar to

INSERT INTO `car_user` (`id`, `name`, `email`, `address`, `phone`, `password`, `role`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 'Henry', 'henry@yahoo.com', 'Allgatan 20, Malmo, Sweden', '02939394',…