-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer output #32
Comments
The hashes are You first need to allocate enough space for the 32-bit (4 bytes) or 64-bit (8 bytes) hashes respectively, with // 32-bit hash, is a number and requires 4 bytes
const hash32 = h32(input);
const buf32 = Buffer.allocUnsafe(4);
buf32.writeUint32BE(value);
// 64-bit hash, is a bigint and requires 8 bytes
const hash64 = h64(input);
const buf64 = Buffer.allocUnsafe(8);
buf64.writeBigUint64BE(value); Here, they are written as Big-Endian, and if necessary, there are also the Little-Endian versions ( There is no advantage to have it integrated into this library, since there's no additional overhead compared to doing it yourself and because this library keeps everything compatible between Browser and Node, it wouldn't use |
Would be nice to have an option to get the hash as a buffer for easy of use with e.g https://github.com/mafintosh/turbo-hash-map
The text was updated successfully, but these errors were encountered: