This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Hashing of "switch/case" selections


----- Original Message -----
From: <dewar@gnat.com>
Sent: Friday, December 29, 2000 5:10 AM

> <<  I think Mr. Huffman and Mr. Kern might disagree..... surely a
> .ZIP file is a unique hash of a given input, and one that has a
> very useful difference from that original input.  Of course, IANAQCS.
> >>
>
> A zip file is simply a 1-1 mapping that may (but obviously does not
> always) have a length less than the original file -- obviously if the
zip file
> is shorter than the original file in some cases, it will be longer
> in other cases.
>
> No one would call this a hash function in my experience. As I say, the
> central point of a hash function is that it performs a many to one
> mapping, that's what makes it interesting.

  The definition of 'unique' hash given in Andy's original mail seems to
me to imply that it is a one to one mapping. I do agree with you about the
conventional uses of hashes in (eg) string lookups; but how about crypto
hashes? A non-reversible hashing function that produced input the same
length as its output might be very useful there. Of course, IANAQCA. And
zipping a file is a lousy way to encrypt it.

> To call all 1-1 mappings hash functions is truly odd terminology :-)

  Ah, but I wasn't referring to *all* 1-1 mappings. I chose one that had
the property that for a non-flat frequency distribution of the input
range, the output will be shorter than the input. This seemed useful and
interesting to me.  I was stretching a metaphor slightly for humour. But
the point I was making is that if there's redundancy in the set of
possible input data, there may be some value in a unique hash. Mind you,
that's probably because I misread your original point

>"unique hashes are not even desirable, note that in particular the
>original input meets the definition of a unique hash. I don't find the
>concept at all useful in this context."

 and missed out the fairly vital qualifier, " in this context".  D'oh! I
believe it's time I went offline for a few hours....

           DaveK



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]