Re: how to generate unique Hash Code for string
On Thu, 03 Jan 2008 02:38:17 -0800, Lasse Vågsæther Karlsen
<lasse@vkarlsen .nowrote:
Neither is "to copy the entire stream", per your suggestion. :)
Which is why I wrote "if you're going to accept an exact representation of
the file as a hash, you have to accept any mapping of that representation
to some other representation as a hash as well". Suggesting that
compression is a valid hash algorithm is only correct in a context where
one assumes your suggestion is valid as well; it's not actually a context
I personally think is worth considering, but I was happy to accept it on
your behalf for the sake of discussion.
I'm more than happy to agree that neither "copy the entire stream" (your
suggestion ) or "compress the stream" (my alternative suggestion) is
actually a hash algorithm. :)
Pete
On Thu, 03 Jan 2008 02:38:17 -0800, Lasse Vågsæther Karlsen
<lasse@vkarlsen .nowrote:
Peter Duniho wrote:
<snip>
>
[...]
Though, the definition of a hash function is that it typically produces
a finite and fixed range of output bits for an infinite (or rather,
unfixed) amount of input bits. As such, compression is not really hashing
>On Fri, 21 Dec 2007 05:22:59 -0800, Lasse Vågsæther Karlsen
><lasse@vkarlse n.nowrote:
>>
>>
>[...]
> That's why file compression works. In fact, compressing a file is one
><lasse@vkarlse n.nowrote:
>>
>>[...]
>>The only guaranteed way to produce a unique hash for a stream of X
>>bytes is just to copy the entire stream.
>>The only guaranteed way to produce a unique hash for a stream of X
>>bytes is just to copy the entire stream.
>[...]
> That's why file compression works. In fact, compressing a file is one
>
[...]
Though, the definition of a hash function is that it typically produces
a finite and fixed range of output bits for an infinite (or rather,
unfixed) amount of input bits. As such, compression is not really hashing
Which is why I wrote "if you're going to accept an exact representation of
the file as a hash, you have to accept any mapping of that representation
to some other representation as a hash as well". Suggesting that
compression is a valid hash algorithm is only correct in a context where
one assumes your suggestion is valid as well; it's not actually a context
I personally think is worth considering, but I was happy to accept it on
your behalf for the sake of discussion.
I'm more than happy to agree that neither "copy the entire stream" (your
suggestion ) or "compress the stream" (my alternative suggestion) is
actually a hash algorithm. :)
Pete
Comment