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

hex encbuf returns big endian

Open clytras opened this issue 4 years ago • 0 comments

const XXHash = require('xxhash');

const seed = 0xA0B0C0D0;

const s1 = XXHash.hash(Buffer.from('test1234'), seed);
const s1hex =  XXHash.hash(Buffer.from('test1234'), seed, 'hex');

console.log(`s1:`, s1.toString(16));
// s1: 19c64649

console.log(`s1hex:`, s1hex);
// s1hex: 4946c619

Why bufenc hex returns a big endian? Is this intentional? I believe that can lead to many headaches when generating hashes using xxhash from multiple systems.

Tested on Ubuntu 16 and Windows 10 using node 10.19.0.

clytras avatar Feb 27 '20 15:02 clytras