Questions tagged [hashing]

A hash function is any algorithm that maps data of arbitrary length to data of a fixed length. The values returned by a hash function are called hash values, hash codes, hash sums, checksums or simply hashes. From Wikipedia: http://en.wikipedia.org/wiki/Hash_function

Filter by
Sorted by
Tagged with
5 votes
0 answers
281 views

How to get a one-way hash function that is collision safe for about 1 million unique inputs? [duplicate]

Forgive me if this is a noob question - My CS education is a somewhat incomplete Basically, I need a way to hash an input, so that someone seeing the output doesn't see the original input value. ...
  • 207
1 vote
2 answers
2k views

Is hash calculated before/after compression?

I had a question regarding compression and calculation of checksum/hash of data. I would like to know if checksum has to be calculated before or after the compression of data before transmission. ...
2 votes
2 answers
3k views

Why a hashtable? Why not just a non-hashed associative array?

I've been learning about using a hashtable to efficiently check for items in a list without looping through the whole thing, but there's one thing that I don't get: Why hashed keys? It seems like: ...
0 votes
1 answer
97 views

Hash function for progressive changes

I am looking for a hashing algorithm that works like this. I start with a text file, and compute its hash. Now I know that I will remove one character at, say, position 67 and this character is a "m", ...
3 votes
2 answers
6k views

What's the shortest generating one-way hash algorithm?

I have a 24 character long id which is guaranteed to be unique. I would like to shorten that to 7-10 (or even shorter) characters long. If I generate an short id randomly then I would have to check ...
  • 133
2 votes
2 answers
276 views

Is there a known standard data structure which is a hash table that resolves collisions using a binary tree?

Is there a known standard data structure which is a hash table that resolves collisions using a binary tree? If so what is the name of this data structure? I imagine such a structure would be useful ...
  • 415
0 votes
1 answer
2k views

Complexity of ArrayList of LinkedHashSet

I get input strings from the console like this: while ((currentLine = bufferedReader.readLine()) != null ) { StringTokenizer string = new StringTokenizer(currentLine, " "); while (string....
  • 127
75 votes
2 answers
57k views

Why do so many hashed and encrypted strings end in an equals sign?

I work in C# and MSSQL and as you'd expect I store my passwords salted and hashed. When I look at the hash stored in an nvarchar column (for example the out the box aspnet membership provider). I've ...
  • 3,386
3 votes
4 answers
140 views

Can I save & store a user's submission in a way that proves that the data has not been altered, and that the timestamp is accurate?

There are many situations where the validity of the timestamp attached to a certain post (submission of information) might be invaluable for the post owner's legal usage. I'm not looking for a service ...
user avatar
0 votes
2 answers
82 views

Hashing + security as it pertains to a theoretical file sharing site

These days it's possible to hash a file client-side, send the hash to the server, and have the server check whether or not that file is already uploaded. If it is, we can skip the file upload and make ...
  • 1,889
8 votes
2 answers
4k views

Overriding GetHashCode in a mutable struct - What NOT to do?

I am using the XNA Framework to make a learning project. It has a Point struct which exposes an X and Y value; for the purpose of optimization, it breaks the rules for proper struct design, since its ...
2 votes
3 answers
2k views

Randomized Hash function with no collisions

Related to the question Which hashing algorithm is best for uniqueness and speed? Is there a way to create a hash function, or find one, whose hash length depends completely on the input length, has ...
  • 163
3 votes
3 answers
2k views

what is the javascript internal data structure?

Consider a basic js object: var obj={x:1,y:'2'}; Is this stored internally as a hashtable or does js use a different mechanism for key value pairs? If they are hash tables does anyone know how they ...
  • 257
2 votes
2 answers
6k views

Design Hash table with simple hash function

I want to learn to Design Hash table with simple hash function for better understanding. I understand that the hash table will work as long as the hash function maps each key to a non-negative integer ...
  • 195
0 votes
1 answer
147 views

Why Num&sizeMinusOne faster than num&(size-1)

I've been told that when I have a hash table of size m and m=2^k, I can use the & operator as num & (size-1) instead of num % size, to fit the hashCode to my table size. I've also been told ...
1 vote
1 answer
184 views

Measuring "novelty" of data

I have a heuristic in mind that should allow me to "score" data based on "novelty" that I would like to work in real-ish time. In this case, I mean novelty in the sense that the data source is ...
  • 352
0 votes
2 answers
157 views

How do crackers determine number of iterations of a Hashing algorithm?

Does a cracker need to know the number of iterations a hashing algorithm uses to compute a hash? If they don't know it, how do they figure it out? How much longer does it take to figure it out, than ...
  • 752
2 votes
3 answers
3k views

Optimal way to implement this specific lookup table in C#?

I want to create a lookup table for this data: The "input variables" (what is used to "lookup") are 4 different doubles that can each take on 1 of 200 numbers (the numbers range from 1-1000 but there ...
  • 123
0 votes
2 answers
1k views

How deterministic are SessionIDs from SHA'd GUIDs?

Assume I'm using the following code to generate pseudo-random sessionID's: sessionID = SHA-512(GENERATE-GUID()) The GUIDs are pretty deterministic, i.e. I see lots of GUIDs with a lot of the same ...
  • 101
3 votes
2 answers
428 views

Would using rainbow tables to detect weak user passwords feasible?

As I understand in most security breach where the list of hashed password are compromised, attackers do use brute-force to try to find weak password and, invariably, they always find quite some (like ...
2 votes
4 answers
3k views

Looking for monotonically increasing (integer) hash function

I'm looking for a HashFunction(X,Y: Integer): Integer that is monotonically increasing on X, then Y. So: HashFunction(x1,y1) > HashFunction(x2,y2) if x1>x2 HashFunction(x,y1) > HashFunction(x,y2) if ...
  • 1,140
4 votes
4 answers
849 views

Is there a name for the concept of a "cumulative checksum"? [closed]

Insofar as I understand it, tools like Git and Mercurial derive checksums from their data, and those checksums are used to derive other checksums used in aggregate, leading to a kind of accumulative ...
  • 151
5 votes
1 answer
10k views

Hashing Algorithm: Deleting an element in linear probing

While using Linear probing method to implement hashing, when we delete and element, the position of the deleted element is declared as a tombstone/ mark it as deleted. Why can't we just shift all the ...
  • 153
15 votes
6 answers
1k views

How to assure users that website and passwords are secure [closed]

On reliable websites I always see claims such as "All data is encrypted" or "All passwords are encrypted using 128bit encryption" and etc. However I have never come across a claim such as "All ...
1 vote
2 answers
2k views

Data Aggregation of CSV files java

I have k csv files (5 csv files for example), each file has m fields which produce a key and n values. I need to produce a single csv file with aggregated data. I'm looking for the most efficient ...
  • 227
6 votes
2 answers
6k views

Sorting versus hashing

My problem is as follows. I have an array of n strings with m < n of them distinct. I want to create a one-to-one function which assigns each of the m distinct strings to the numbers 0 ... m-1. ...
5 votes
3 answers
9k views

How can I reverse engineer a hash code?

I am building an application in C# that works with a Progress database. The passwords that are stored in this database are stored using a hash algorithm that Progress has not made public. However, I ...
4 votes
4 answers
364 views

Preventing password hashing algorithm from overloading CPU

These days password hashing algorithms are designed to be slow. While it prevents black hats from guessing the password (at least partially), it also gives additional work for the server. I can ...
  • 977
5 votes
2 answers
12k views

Finding duplicate files? [duplicate]

I am going to be developing a program that detects duplicate files and I was wondering what the best/fastest method would be to do this? I am more interested in what the best hash algorithm would be ...
6 votes
1 answer
1k views

How can I benchmark concurrent key-value stores?

I have some concurrent key-value store implementations that are implemented with hash tables and search trees that I would like to compare. I would like to benchmark them with a real world application ...
  • 69
0 votes
1 answer
426 views

Is there any design pattern to remove elements from a hash map?

In my application I keep track of the running threads via a hash map, in that way I can retrieve the correct thread and do any actions. The app evolved in a way that new threads are created and old ...
user avatar
0 votes
1 answer
1k views

Linear probing hashing collision resolution

So I have a quick question about the linear probing method of collision resolution in hash tables. So by definition a linear probing method would look like: while (hashTable[hash] != null) hash = ...
1 vote
1 answer
2k views

Max number of items mapped to same location in hashmap

I have a question about hashmaps. If you have this hashmap with m slots, and need to map n items to it, and n > m. There will be collisions for sure. But assuming there is simple uniform hashing ...
  • 139
5 votes
6 answers
3k views

Would md5 hashes allow detection of synced files?

We have to develop our own file management system in Java web application. We need to sync files between our main server and client severs and find out whether all the client server has all the latest ...
4 votes
2 answers
2k views

How can "hash functions" be used to implement hash maps at all?

My understandment is that hash maps allow us to link, say, a string, to certain memory location. But if every string were to be linked to a unique place in memory it would need a huge block of empty ...
  • 5,780
15 votes
3 answers
5k views

How do scalable bloom filters work?

I was reading up on scalable bloom filters and could not understand how each time a constituent bloom filters fills up, a new bloom filter with larger size is added. The elements that contributed to ...
8 votes
1 answer
2k views

Hash function classification

On the internet, I've come across this question: Classify the Hashing Functions based on the various methods by which the key value is found. with answers like Direct method Subtraction method ...
  • 2,613
5 votes
4 answers
524 views

Concept behind SHA-1 Checksum

What's the basis behind SHA-1 or SHA-2 or other Checksum algorithms? I read about it here http://en.wikipedia.org/wiki/SHA-1#Data_Integrity But I am still wondering about an answer in a layman's ...
  • 1,871
3 votes
1 answer
6k views

How to test if a hashing algorithm is good? [duplicate]

Possible Duplicate: Which hashing algorithm is best for uniqueness and speed? I have created a hash algorithm and would like to test if it is usable. What do I need to test and how?
0 votes
2 answers
4k views

Basic memcached question

I have been reading up on distributed hashing. I learnt that consistent hashing is used for distributing the keys among cache machines. I also learnt that, a key is duplicated on mutiple caches to ...
5 votes
1 answer
2k views

Hash Algorithm Randomness Visualization

I'm curious if anyone here has any idea how the images were generated as shown in this response: Which hashing algorithm is best for uniqueness and speed? Ian posted a very well-received response but ...
2 votes
2 answers
2k views

Looking for a non-cryptographic hash function that returns a single character

Suppose I have a dictionary of ASCII words stored in uppercase. I also want to save those words into separate files so that the total word count of each file is approximately the same. By simply ...
6 votes
2 answers
1k views

History of Associative Array?

In quite a lot of modern scripting languages (e.g. Perl, Python, Ruby, PHP, Lua, JavaScript), associative arrays are supported as a primitive or first-class data type (with various names like map, ...
  • 215
4 votes
1 answer
5k views

Directory structure (file system design)

I was looking at how file systems are designed and noticed that most places say that the directory hierarchy can be implemented using a hash table. Could someone please explain me how using a hash ...
  • 43
1 vote
0 answers
74 views

Built-in Context-and-Input-to-Output-Hashing in Compilers

Why doesn't (open source) compilers contain builtin funtionality for (shared) caching and reuse-fetching (using SHA1-hash of compiler-version, build-flags, target-platform and inputs) of executable ...
  • 151
1 vote
1 answer
300 views

hash with file instead of array

Is it possible to use hash function but with File instead of Array, and it's gonna be saving the record in a file position and then search will fseek to that position, but I'm not sure how to open a ...
  • 407
6 votes
1 answer
355 views

Using account (login) password in generated PDF?

Ever since I heard about programming, I was told that any password (especially the one used on login) should be stored in database using any kind of one-way hashing algorithm, and never ever as plain ...
  • 2,356
-3 votes
1 answer
2k views

Writing-Reading a hashtable to a text file

I'm implementing a hashtable structure for a dictionary. Dictionary is in a text file. There are 2 words on each line. I'm generating the hashtable by using the first word as a key. I'm holding the ...
19 votes
6 answers
5k views

What makes a hashing algorithm "secure"?

After reading this interesting question, I felt like I had a good idea of which insecure hashing algorithm I'd use if I needed one, but no idea why I might use a secure algorithm instead. So what is ...
  • 3,381
7 votes
8 answers
7k views

Using HashTable without overriding hashcode()

Today I was asked this question during an interview: What will happen if we do not override the hashcode method for our class, then add it to HashTable and then try to get objects? What could go ...
  • 443