Re: return hash-code of a string
Eitan M wrote:
Hash code returns an integer,
Please do not top-post (placement of your reply above the material to which
you're replying).
and due that it is limited (it is not CRC),
What is the limitation that concerns you, and how does it cause trouble?
Why is CRC needed?
so a string like : "zzzzz" may have an exception.
What sort of exception do you mean?
"Flo 'Irian' Schaetz" <iryan@gmx.de> wrote in message
And thus spoke Eric Sosman...
By definition, a hash reduces information from a source (document, byte
sequence, ...). That is, in fact, the point of a hash code in the first
place. The reduced information set is easier to manipulate than the source
domain set, and by dint of being int, faster, too. Not to put to fine a point
on it, hash codes are a hack to compensate for human impatience.
This aside from their cryptographic utility, but that's not essential to
Object.hashCode().
So if you want a hash code, you want to reduce information. There's no point
in asking for a hash code that doesn't reduce information.
--
Lew