Skip to content

Error in getting the hash value #20

@binishbala

Description

@binishbala

Hi,
The hash value generated using the node-xxhash in node and net.jpountz.xxhash.XXHash32 in java are different. Please find the sample code and result when tried the generation of hash value of same string in java and node. Let me if i am doing any thing wrong.

In Node

var key = "Testkey"
var data = Buffer.from(key);
var SEED = 4321;
var hash = XXHash.hash(data, SEED);
console.log(hash);
Result : 3297801581

In Java

String key = "Testkey";
int SEED = 4321;
byte[] data = key.getBytes();
int hash = hash32.hash(data, 0, data.length, SEED);
System.out.println("hash value" + hash);

Result : hash value-997165715

Thanks
Binish

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions