Re: type of hash functions
- From: Logan Shaw <lshaw-usenet@xxxxxxxxxxxxx>
- Date: Tue, 21 Mar 2006 06:33:06 GMT
Adrian Wong wrote:
I am looking for two hash functions on strings. For different strings
that collide on one hash function it is guaranteed not to collide with
the other hash function. Do such complementary functions exist?
Such a pair of functions can exist, but if the pair does exist, then
the sum of the sizes of the two functions' outputs must be at least
as long as the input string. (Let's assume both keys and input strings
are a fixed size.)
To see why this is so, just think about this: if the pair of functions
exists, then for any string, the pair of keys generated (by the pair
of functions) uniquely identifies the string. Therefore, the original
string can be reconstructed using only the pair of hash keys. And that
means the pair of hash functions can be used as a form of data
compression.
And, it is already well established in the field of compression that
there is no such thing as a data compression function that (a) always
shrinks its input and (b) is lossless (here, being lossless equates
to having no collisions).
Therefore, since the two keys would have to be as big (on average) as
the original input string, even if this pair of functions does exist,
it is probably not that useful.
Note that I'm assuming we are talking about a situation where there
isn't a fixed set of strings to be hashed. If the set of strings is
known in advance, then a hash function can be created that has no
collisions for that set, and the output can be as small as desired
as long as the number of possible outputs is not smaller than the
number of possible inputs (i.e. the output is an integer large
enough to count from 1 to the size of the set of inputs).
- Logan
.
- Follow-Ups:
- Re: type of hash functions
- From: Adrian Wong
- Re: type of hash functions
- References:
- type of hash functions
- From: Adrian Wong
- type of hash functions
- Prev by Date: type of hash functions
- Next by Date: Connecting C To a Sql Database
- Previous by thread: type of hash functions
- Next by thread: Re: type of hash functions
- Index(es):
Relevant Pages
|
Loading