node-xxhash icon indicating copy to clipboard operation
node-xxhash copied to clipboard

Error in getting the hash value

Open binishbala opened this issue 8 years ago • 4 comments

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

binishbala avatar Nov 07 '17 14:11 binishbala

Can you try the master branch?

mscdex avatar Nov 07 '17 18:11 mscdex

Able to see only master branch for the node. Checked out the master branch of the java code. After this also getting the different hash code in java and javascript.

binishbala avatar Nov 08 '17 15:11 binishbala

I meant the master branch for this module (xxhash).

mscdex avatar Nov 08 '17 15:11 mscdex

Still the same result.

binishbala avatar Nov 09 '17 07:11 binishbala