You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Herbert (Jira)" <ji...@apache.org> on 2021/07/15 07:02:00 UTC
[jira] [Commented] (CODEC-302) MurmurHash2.hash32 can return
negative
[ https://issues.apache.org/jira/browse/CODEC-302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17381099#comment-17381099 ]
Alex Herbert commented on CODEC-302:
------------------------------------
You should think of the signed integer as 32-bits. The sign is just another bit.
If you output the result using:
{code:java}
// Create the hash
int h = ...;
Integer.toHexString(h);
Integer.toUnsignedString(h);
{code}
Does this produce a different result to other implementations?
If the bits are the same then this is not a bug but an interpretation issue. If the bits are different then this is a bug and an example of input that produces different output from a reference would be useful.
> MurmurHash2.hash32 can return negative
> --------------------------------------
>
> Key: CODEC-302
> URL: https://issues.apache.org/jira/browse/CODEC-302
> Project: Commons Codec
> Issue Type: Bug
> Affects Versions: 1.15
> Reporter: Iris Scholer
> Priority: Major
>
> When running hash32, many values return a negative hash. Since the original implementation used unsigned values, this is unintended behavior and breaks compatibility with other implementations.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)