

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer

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?

share|improve this question

marked as duplicate by Walter, Glenn Nelson, thorsten müller, GlenH7, StuperUser Dec 17 '12 at 16:19


Hmm, yes, sorry. Seems like a duplicate indeed! EDIT: I can't close my question because the duplicate is on SO and not on Programmers… – Oltarus Dec 16 '12 at 11:08

Short Answer: It depends on many-many factors.

There is no such thing as a good hash function for universal hashes (although there is such a thing as “universal hashing” but it has different meaning).

Depending on the context different criteria determine the quality of a hash. Some people may thing about SHA, however it is a cryptographic hash and it isn't at all good for hash tables which you probably mean.


Another important thing when hashing strings is to consider all characters (except when it's known in advance that the first three characters of all strings will be the same: because it would be a waste)


1) Just to eliminate the confusion between hashing and encryption look here - Fundamental difference between Hashing and Encryption algorithms

2) Also a good discussion on - What is the difference between a Hash Function and a Cryptographic Hash Function?

References to look:

share|improve this answer
How exactly could a cryptographic hash function be bad for a hash table (except perhaps for execution speed)? It seems to me that the requirements for a cryptographic hash are strictly greater than for a hash function in a hash table. – Michael Borgwardt Dec 16 '12 at 13:07
this sounds to me as a confusion between hashes and cryptographic hash, here is the explanation -… – Yusubov Dec 16 '12 at 13:21
no confusion at all, I understand the difference completely, but my question stands: what do you mean when you say "SHA, however it is a cryptographic hash and it isn't at all good for hash tables" – Michael Borgwardt Dec 16 '12 at 13:31
digital size and speed was in my mind – Yusubov Dec 16 '12 at 13:34
OK, so I'd say we can agree that for those reasons it would not be ideal, but would do the job well enough. – Michael Borgwardt Dec 16 '12 at 13:59
