26 questions
0
votes
0
answers
46
views
How to find a prime that is larger than some constant value and what it's time complexity
I ask this in the context of hashing where a prime greater than some constant is required
for example in universal hashing:
h(k) = [(a.k+b) mod p] mod m
a and b are random numbers
m is the size of ...
5
votes
2
answers
2k
views
Ultra fast lookup in small sized container of 64-bit integer values using dynamic perfect hashing
I have input keys that can cheaply be converted to a uint64_t (ie, the input contains less than or equal to 64 bits).
Each unique key (not yet in the map) will be assigned some data (a pointer to an ...
1
vote
0
answers
488
views
Easily Memorable Hash (what 3 words)
I was hoping to create an easily memorable hash something like 3 random words (what3words), so the idea would be to hash a java object and the result was three random words.
Use case: I have objects ...
0
votes
1
answer
591
views
Universal Hash Function Implementation for Strings in Java
I have some troubles understanding the implementation of a universal hash function in Java.
The hash function (ax + b) mod p should be implemented in base of H_1.
Also this implementation should work ...
0
votes
1
answer
44
views
Unchange Data, hashing data
I want to save some data in a file like .cvs. One of the condition is, that the data can't change after write in the file.
If I want to read the data, it should be save that the data were not change ...
1
vote
0
answers
117
views
Value of K hash functions so that probability of false positive is at most 1/n
We have n elements , m=2n and k, where K is the number of hash functions, m being the size of bit array and n the number of elements. What will be the value of k such that the probability of getting a ...
0
votes
1
answer
237
views
Use of universal hashing
I'm trying to understand the usefullness of universal hashing over normal hashing, other than the function is randomly produced everytime, reading Cormen's book.
From what i understand in universal ...
0
votes
1
answer
730
views
Describe an Explicit Universal Hash Function Family
In this problem, I was given the follow mapping
U = {0, 1, 2, 3, 4, 5, 6, 7} to {0, 1}
From this, there is an explicit universal hashing function that must be derived, with the hint that this can be ...
-2
votes
1
answer
703
views
Is it a secure method to generate token?
I wan't to generate token to verify the email of users, I learn about universal hashing (selecting a hash function at random from a family of hash functions) and I wrote this code in PHP
Is it a ...
1
vote
1
answer
648
views
Pairwise independent hash functions in Java
I'm looking for a quick and easy way to use a (universal) family of pairwise independent hash functions in my Java projects.
Ideally, I would have some object UniversalFamily (representing the Family)...
0
votes
0
answers
82
views
Using C++ class as mere bit container
I'm currently implementing a HashTable in C++ using universal hashing (matrix hashing). The way I implement the matrix is by making an array of pointers (which are merely random bits, they do not "...
1
vote
1
answer
590
views
cmph Minimal perfect hashing
I've spent days trying to make the library work on my system.
The library has several algorithms which generate MPHFs.
My understanding of minimal hash function is, that when I hash two distinct keys ...
0
votes
2
answers
350
views
Universal hashing performs worse than modulo hashing, what is wrong?
In case you are not familiar with universal hashing, it's mainly an attempt to guarantee a low number of collisions (as opposed, say with using plain old modulo), using some rather simple math ...
1
vote
0
answers
105
views
How can I check file differences in JavaScript?
I'm using Electron, Githubs desktop framework built using JS and HTML 5. I need to check if fileA is different to fileB, and similarly with 2 strings.
These files and strings could be of equal size ...
3
votes
1
answer
506
views
Is Universal family of hash functions only to prevent enemy attack?
If my intention is only to have a good hash function that spreads data evenly into all of the buckets, then I need not come up with a family of hash functions, I could just do with one good hash ...
1
vote
0
answers
52
views
Choose the universe of keys
I need to hash a sequence S of numbers of length n^2 where each number is a sum of two numbers each of them is an element on one of the sequences: {x_1,..., x_n},{y_1,..., y_n}.
I am using universal ...
3
votes
1
answer
679
views
What is the difference between consistent hashing and cone hashing?
What I know is:
Consistent hashing: uniform distributed storage system
Cone hashing: non uniform distributed storage system
I want to know:
How it works?
What is the use of it?
What is the difference ...
2
votes
1
answer
284
views
Confusion related to universal hashing
I was reading this video lecture related to universal hashing. It shows the example of hashing IP addresses. Each IP address consists of 4, 32 bit integers, (x1,x2,x3,x4) with any xi having the ...
2
votes
2
answers
518
views
Universal hashing misunderstanding
I am trying to understand how universal hashing works. It is defined h(x) = [(a*x + b) mod p] mod m where a,b - random numbers, m - size of hash table, x - key, and p - prime number. For example, I ...
11
votes
2
answers
24k
views
How to generate 64 bit random numbers?
I'm implementing universal hashing and using the following universal hash function :
h(k)=((A*k)mod 2^64) rsh 64-r
where A is a random number between
2^61 and 2^62.
The rand() function in C++ has ...
-1
votes
2
answers
436
views
calculate the probability of having no collision when two elements are hashed h(x)=(x^2+1)mod3 [closed]
How can I calculate the probability of having no collision after inserting 2 elements.
answer is 4/9, but I do not see it how it is 4/9
-2
votes
1
answer
1k
views
universal hash function implementation for bloom filters in C
im simulating set intersection approximation using bloom filters. i have tried a lot of simple hash functions to hash the values to the filter. but its not good at avoiding collisions. so somebody ...
10
votes
4
answers
5k
views
Hash a Range of Values
I know that I can hash singular values as keys in a dict. For example, I can hash 5 as one of the keys in a dict.
I am currently facing a problem that requires me to hash a range of values.
...
3
votes
1
answer
883
views
Basics in Universal Hashing, how to ensure accessibility
to my current understanding Universal Hashing is a method whereby the hash function is chosen randomly at runtime in order to guarantee reasonable performance for any kind of input.
I understand we ...
2
votes
2
answers
639
views
understanding Universal hashing chapter on CLRS
Hi I am reading the chapter about universal hashing on CLRS.
On page 234
Corollary 11.4
Using universal hashing and collision resolution by chaining in a
table with m slots, it takes expected ...
8
votes
1
answer
2k
views
Hashtable- Rehashing
I have been told that Hashtable in .NET uses rehashing in order to reduce/avoid collision.
Ie. “Rehasing works as follows: assume we have a set of hash different functions, H1 ... Hn, and when ...