{"_id":"@alesblaznik/murmurhash-native","_rev":"2-af061a0cf15f4ed3ef233254444f94ce","name":"@alesblaznik/murmurhash-native","dist-tags":{"latest":"3.5.2"},"versions":{"3.5.1":{"name":"@alesblaznik/murmurhash-native","version":"3.5.1","keywords":["murmurhash","murmurhash3","murmurhash128","murmurhash32","murmurhash2","murmurhash64","progressive hash","PMurHash","PMurHash128","hash"],"author":{"name":"Rafał Michalski","email":"royal@yeondir.com"},"license":"MIT","_id":"@alesblaznik/murmurhash-native@3.5.1","maintainers":[{"name":"alesblaznik","email":"ales.blaznik@sap.com"}],"contributors":[],"homepage":"http://github.com/alesblaznik/node-murmurhash-native","bugs":{"url":"https://github.com/alesblaznik/node-murmurhash-native/issues"},"tap":{"lines":95,"branches":85,"functions":100,"statements":95,"check-coverage":true},"dist":{"shasum":"d1e25ecb03b05f85881b91a731557e5f5a52dbda","tarball":"https://registry.npmjs.org/@alesblaznik/murmurhash-native/-/murmurhash-native-3.5.1.tgz","fileCount":75,"integrity":"sha512-rbj+AU96soeHpHltt4bNcXiyQNk9JIGeLCk5wJM3CNp78LGSUa5W8PUxALBthFIbzYnjWCzGXzRTyn6SUBrNdw==","signatures":[{"sig":"MEUCIQDCFwfJgKfrSzgjFOz/vr53J6S3viG+C44QpMats16NDAIgHr6vWw8rS4jECPR2lvOptl6LpQ7nVFLNzzUSFYQP534=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":194251},"main":"index.js","types":"index.d.ts","binary":{"host":"https://github.com/alesblaznik/node-murmurhash-native/releases/download/","module_name":"murmurhash","module_path":"./lib/{configuration}/","remote_path":"v{version}"},"engines":{"node":">=6"},"gitHead":"9af2ad9fd6db19bf3cb1b5c7d2c7c8672bbd08e0","scripts":{"tsc":"tsc -p test/types","test":"tap -C -Rclassic ./test/test*.js ./test/types/test*.js","bench":"sh bench/bench.all.sh","install":"node-pre-gyp install --fallback-to-build","rebuild":"node-pre-gyp rebuild","test-gc":"tap -Rspec --node-arg=--expose-gc ./test/persistent/test.gc.*.js","test-ts":"tap -C -Rclassic ./test/types/test*.js","typedoc":"typedoc --tsconfig test/types/tsconfig.json index.d.ts promisify.d.ts incremental.d.ts stream.d.ts"},"_npmUser":{"name":"alesblaznik","email":"ales.blaznik@sap.com"},"repository":{"url":"git+https://github.com/alesblaznik/node-murmurhash-native.git","type":"git"},"_npmVersion":"10.9.3","description":"MurmurHash (32,64,128)bit native bindings for nodejs","directories":{},"_nodeVersion":"22.20.0","dependencies":{"nan":"^2.14.1","@mapbox/node-pre-gyp":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^16.3.10","typedoc":"^0.17.4","bluebird":"^3.7.2","commander":"^5.0.0","typescript":"^3.8.3","@types/node":"^13.13.2","murmurhash3js":"^3.0.1","@types/bluebird":"3.5.25","node-pre-gyp-github":"2.0.0","typedoc-plugin-sourcefile-url":"^1.0.6","typedoc-plugin-external-module-name":"^3.0.0"},"typeScriptVersion":"2.0","_npmOperationalInternal":{"tmp":"tmp/murmurhash-native_3.5.1_1762470307817_0.8201117319095581","host":"s3://npm-registry-packages-npm-production"}},"3.5.2":{"name":"@alesblaznik/murmurhash-native","description":"MurmurHash (32,64,128)bit native bindings for nodejs","keywords":["murmurhash","murmurhash3","murmurhash128","murmurhash32","murmurhash2","murmurhash64","progressive hash","PMurHash","PMurHash128","hash"],"version":"3.5.2","license":"MIT","author":{"name":"Rafał Michalski","email":"royal@yeondir.com"},"contributors":[],"homepage":"http://github.com/alesblaznik/node-murmurhash-native","repository":{"type":"git","url":"git+https://github.com/alesblaznik/node-murmurhash-native.git"},"scripts":{"install":"node-pre-gyp install --fallback-to-build","test":"tap -C -Rclassic ./test/test*.js ./test/types/test*.js","test-ts":"tap -C -Rclassic ./test/types/test*.js","test-gc":"tap -Rspec --node-arg=--expose-gc ./test/persistent/test.gc.*.js","bench":"sh bench/bench.all.sh","rebuild":"node-pre-gyp rebuild","tsc":"tsc -p test/types","typedoc":"typedoc --tsconfig test/types/tsconfig.json index.d.ts promisify.d.ts incremental.d.ts stream.d.ts"},"binary":{"module_name":"murmurhash","module_path":"./lib/{configuration}/","host":"https://github.com/alesblaznik/node-murmurhash-native/releases/download/","remote_path":"v{version}"},"main":"index.js","types":"index.d.ts","typeScriptVersion":"2.0","tap":{"check-coverage":true,"lines":95,"functions":100,"branches":85,"statements":95},"engines":{"node":">=6"},"dependencies":{"@mapbox/node-pre-gyp":"^2.0.0","nan":"^2.14.1"},"devDependencies":{"@types/bluebird":"3.5.25","@types/node":"^13.13.2","bluebird":"^3.7.2","commander":"^5.0.0","murmurhash3js":"^3.0.1","node-pre-gyp-github":"2.0.0","tap":"^16.3.10","typedoc":"^0.17.4","typedoc-plugin-external-module-name":"^3.0.0","typedoc-plugin-sourcefile-url":"^1.0.6","typescript":"^3.8.3"},"gitHead":"f0612e0e41fcb988faf128132a598654b303f665","_id":"@alesblaznik/murmurhash-native@3.5.2","bugs":{"url":"https://github.com/alesblaznik/node-murmurhash-native/issues"},"_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-inHTt6X8WtpJE3r3uJTLFjpqQvarkRgTkOXXaGT7qM2EaHorlmwgPHnFOj9lVBeV+UAip/tzgG15FBVwljzX2w==","shasum":"0bb9c7224cbfe6eadb7035672f585d72124d6fab","tarball":"https://registry.npmjs.org/@alesblaznik/murmurhash-native/-/murmurhash-native-3.5.2.tgz","fileCount":36,"unpackedSize":169574,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alesblaznik%2fmurmurhash-native@3.5.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDDjV7N+olax+ctDSyIKdtC3l5ybI90+zYRHYKVxQ0JcAiEAsvT4vLSWzkocvPNkFkae+fXtGQDSTzWeDlOiFwaDWcE="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:010b79b1-3998-4670-9d40-4db5a7618b1e"}},"directories":{},"maintainers":[{"name":"alesblaznik","email":"ales.blaznik@sap.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/murmurhash-native_3.5.2_1762472118964_0.43985862861434355"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-06T23:05:07.753Z","modified":"2025-11-06T23:35:19.621Z","3.5.1":"2025-11-06T23:05:08.091Z","3.5.2":"2025-11-06T23:35:19.158Z"},"bugs":{"url":"https://github.com/alesblaznik/node-murmurhash-native/issues"},"author":{"name":"Rafał Michalski","email":"royal@yeondir.com"},"license":"MIT","homepage":"http://github.com/alesblaznik/node-murmurhash-native","keywords":["murmurhash","murmurhash3","murmurhash128","murmurhash32","murmurhash2","murmurhash64","progressive hash","PMurHash","PMurHash128","hash"],"repository":{"type":"git","url":"git+https://github.com/alesblaznik/node-murmurhash-native.git"},"description":"MurmurHash (32,64,128)bit native bindings for nodejs","contributors":[],"maintainers":[{"name":"alesblaznik","email":"ales.blaznik@sap.com"}],"readme":"MurmurHash bindings for node\n============================\n\nThis library provides Austin Appleby's non-cryptographic \"MurmurHash\" hashing algorithm functions in a few different flavours.\n\n[![NPM][NPM img]][NPM Status]\n[![Node][Node img]][NPM Status]\n[![Travis][Travis img]][Travis Status]\n[![AppVeyor][AppVeyor img]][AppVeyor Status]\n[![License][License img]][License Link]\n\nKey features:\n\n* blocking and asynchronous api interfaces\n* additional MurmurHash3 32 and 128 bit progressive implementations based on [PMurHash][PMurHash]\n* stream wrapper for progressive hasher with [crypto.Hash-like][crypto.Hash] bi-api interface\n* serializable state of the progressive hasher\n* BE or LE byte order variants of hashes\n* promise wrapper\n* prebuilt binaries for most standard system configurations\n* TypeScript declarations ([docs][typescript-docs])\n\nInstall:\n--------\n\nThere are prebuilt [binaries][releases] available for painless installation on\nsome Linuxes (x64), OS-X (x64) and Windows (x64 and x86) thanks to [node-pre-gyp][node-pre-gyp] and [node-pre-gyp-github][node-pre-gyp-github].\n\n```\nnpm install murmurhash-native\n```\n\nIf the prebuilt release is not available for your system or nodejs version,\nthe compilation from source will kick-in. For more information on building from\nsource please consult [this page][node-gyp-install].\n\nIf for some reason (e.g. an incompatible GLIBC) you might want to force building from source, type:\n\n```\nnpm i murmurhash-native --build-from-source\n```\n\nTo reinstall prebuilt binary (e.g. after switching between major nodejs versions):\n\n```\nnpm rebuild --update-binary\n```\n\nTypeScript\n----------\n\n`murmurhash-native` is [ready][typescript-docs] for the TypeScript without any external declarations. However this module is node-specific package, if you're going to use it in TypeScript, do not forget to include `@types/node` and enable `es2015` language features in your `tsconfig.json`.\n\nMake a hash:\n------------\n\n```js\nvar murmurHash = require('murmurhash-native').murmurHash\n\nmurmurHash( 'hash me!' ) // 2061152078\nmurmurHash( new Buffer('hash me!') ) // 2061152078\nmurmurHash( 'hash me!', 0x12345789 ) // 1908692277\nmurmurHash( 'hash me!', 0x12345789, 'buffer' ) // <Buffer 71 c4 55 35>\nmurmurHash( 'hash me!', 0x12345789, 'hex' ) // '71c45535'\nvar buf = new Buffer('hash me!____')\nmurmurHash( buf.slice(0,8), 0x12345789, buf, 8 )\n// <Buffer 68 61 73 68 20 6d 65 21 71 c4 55 35>\n\nvar murmurHash128x64 = require('murmurhash-native').murmurHash128x64\nmurmurHash128x64( 'hash me!' ) // 'c43668294e89db0ba5772846e5804467'\n\nvar murmurHash128x86 = require('murmurhash-native').murmurHash128x86\nmurmurHash128x86( 'hash me!' ) // 'c7009299985a5627a9280372a9280372'\n\n// asynchronous\n\nmurmurHash( 'hash me!', function(err, hash) { assert.equal(hash, 2061152078) });\n\n// output byte order (default is BE)\n\nvar murmurHashLE = require('murmurhash-native').LE.murmurHash;\nmurmurHashLE( 'hash me!', 0x12345789, 'buffer' ) // <Buffer 35 55 c4 71>\nmurmurHashLE( 'hash me!', 0x12345789, 'hex' ) // '3555c471'\n```\n\nThese functions are awaiting your command:\n\n* `murmurHash`       - MurmurHash v3 32bit\n* `murmurHash32`     - (an alias of murmurHash)\n* `murmurHash128`    - MurmurHash v3 128bit platform (x64 or x86) optimized \n* `murmurHash128x64` - MurmurHash v3 128bit x64 optimized\n* `murmurHash128x86` - MurmurHash v3 128bit x86 optimized\n* `murmurHash64`     - MurmurHash v2 64bit platform (x64 or x86) optimized\n* `murmurHash64x64`  - MurmurHash v2 64bit x64 optimized\n* `murmurHash64x86`  - MurmurHash v2 64bit x86 optimized\n\nand they share the following signature:\n\n```js\nmurmurHash(data[, callback])\nmurmurHash(data, output[, offset[, length]][, callback])\nmurmurHash(data{string}, encoding|output_type[, seed][, callback])\nmurmurHash(data{Buffer}, output_type[, seed][, callback])\nmurmurHash(data, seed[, callback])\nmurmurHash(data, seed, output[, offset[, length]][, callback])\nmurmurHash(data, seed, output_type[, callback])\nmurmurHash(data, encoding, output_type[, callback])\nmurmurHash(data{string}, encoding, output[, offset[, length]][, callback])\nmurmurHash(data{string}, encoding, seed[, callback])\nmurmurHash(data{string}, encoding, seed, output[, offset[, length]][, callback])\nmurmurHash(data{string}, encoding, seed, output_type[, callback])\n```\n\n* `@param` `{string|Buffer}` `data` - a byte-string to calculate hash from\n* `@param` `{string}` `encoding` - data string encoding, should be:\n    \"utf8\", \"ucs2\", \"ascii\", \"hex\", \"base64\" or \"binary\";\n    \"binary\" by default\n* `@param` `{Uint32}` `seed` - murmur hash seed, 0 by default\n* `@param` `{Buffer}` `output` - a Buffer object to write hash bytes to;\n    the same object will be returned\n* `@param` `{number}` `offset` - start writing into output at offset byte;\n    negative offset starts from the end of the output buffer\n* `@param` `{number}` `length` - a number of bytes to write from calculated hash;\n    negative length starts from the end of the hash;\n    if absolute value of length is larger than the size of calculated\n    hash, bytes are written only up to the hash size\n* `@param` `{string}` `output_type` - a string indicating return type:\n    - \"number\" - (default) for murmurHash32 an unsigned 32-bit integer,\n               other hashes - hexadecimal string\n    - \"hex\"    - hexadecimal string\n    - \"base64\" - base64 string\n    - \"binary\" - binary string\n    - \"buffer\" - a new Buffer object;\n* `@param` `{string}` `encoding|output_type` - data string encoding\n   or a return type; because some valid return types are also valid\n   encodings, the only values recognized here for `output_type` are:\n    - \"number\"\n    - \"buffer\"\n* `@param` `{Function}` `callback` - optional callback(err, result)\n    if provided the hash will be calculated asynchronously using libuv\n    worker queue, the return value in this instance will be `undefined`\n    and the result will be provided to the callback function;\n    Be carefull as reading and writing by multiple threads to the same\n    memory may render undetermined results\n\n* `@return` `{number|Buffer|String|undefined}`\n\nThe order of bytes written to a Buffer or encoded string depends on\nfunction's endianness.\n\n`data` and `output` arguments might reference the same Buffer object\nor buffers referencing the same memory (views).\n\n\nThere are additional namespaces, each for different variant of function endianness:\n\n* `BE` - big-endian (most significant byte first or network byte order)\n* `LE` - little-endian (least significant byte first)\n* `platform` - compatible with `os.endianness()`\n\nFunctions in the root namespace are big-endian.\n\n\nStreaming and incremental api\n-----------------------------\n\nThe dual-api interface for progressive MurmurHash3 is available as a submodule:\n\n```js\nvar murmur = require('murmurhash-native/stream');\n````\n\nIncremental (a.k.a. progressive) api\n\n```js\nvar hash = murmur.createHash('murmurhash128x86');\nhash.update('hash').digest('hex'); // '0d872bbf2cd001722cd001722cd00172'\nhash.update(' me!').digest('hex'); // 'c7009299985a5627a9280372a9280372'\n\nvar hash = murmur.createHash('murmurhash128x86', {endianness: 'LE'});\nhash.update('hash').digest('hex'); // 'bf2b870d7201d02c7201d02c7201d02c'\nhash.update(' me!').digest('hex'); // '999200c727565a98720328a9720328a9'\n```\n\nStreaming api\n\n```js\nvar hash = murmur.createHash('murmurhash32', {seed: 123, encoding: 'hex', endianness: 'platform'});\nfs.createReadStream('README.md').pipe(hash).pipe(process.stdout);\n```\n\n### Serializable state\n\nThe incremental MurmurHash utilities may be serialized and later deserialized.\nOne may also copy a hasher's internal state onto another.\nThis way the hasher utility can be re-used to calculate a hash of some data\nwith already known prefix.\n\n```js\nvar hash = murmur.createHash('murmurhash128x64').update('hash');\nhash.digest('hex');                   // '4ab2e1e022f63e2e9add75dfcea2dede'\n\nvar backup = murmur.createHash(hash); // create a copy of a hash with the same internal state\nbackup.update(' me!').digest('hex');  // 'c43668294e89db0ba5772846e5804467'\n\nhash.copy(backup)                     // copy hash's state onto the backup\n    .update(' me!').digest('hex');    // 'c43668294e89db0ba5772846e5804467'\n\nvar serial = hash.serialize();        // serialize hash's state\nserial == 'AAAAAAAAAAAAAAAAAAAAAGhzYWgAAAAAAAAAAAAAAFQAAAAEtd3X';\n                                      // restore backup from serialized state\nvar backup = murmur.createHash('murmurhash128x64', {seed: serial});\nbackup.update(' me!').digest('hex');  // 'c43668294e89db0ba5772846e5804467'\n                                      // finally\nhash.update(' me!').digest('hex');    // 'c43668294e89db0ba5772846e5804467'\n```\n\nThe dual-api with streaming is a javascript wrapper over the native module.\nThe native incremental module is directly available at `murmurhash-native/incremental`.\n\nSee [hasher.cc](src/incremental/hasher.cc) for full api description\n(and there's some crazy templating going on there...).\n\n\nPromises\n--------\n\nThe native murmurHash functions run asynchronously if the last argument is a callback.\nThere is however a promisify wrapper:\n\n```js\nvar mm = require('murmurhash-native/promisify')();\nmm.murmurHash32Async( 'hash me!', 0x12345789 )\n      .then(hash => { assert.equal(hash, 1908692277) });\n// Promise { <pending> }\n```\n\nYou may provide your own promise constructor:\n\n```js\nvar bluebird = require('bluebird');\nvar mm = require('murmurhash-native/promisify')(bluebird);\nmm.murmurHash32Async( 'hash me!', 0x12345789 )\n      .then(hash => { assert.equal(hash, 1908692277) });\n// Promise {\n//   _bitField: 0,\n//   _fulfillmentHandler0: undefined,\n//   _rejectionHandler0: undefined,\n//   _promise0: undefined,\n//   _receiver0: undefined }\n```\n\n\nSignificant changes in 3.x\n--------------------------\n\nThe most important change is full platform indifference of rendered output.\nIn 2.x output hash as binary data provided via buffer was endian sensitive.\nStarting with 3.x the data written to output buffer is always MSB (byte) first.\n\nThe \"hex\", \"base64\" and \"binary\" output types has been (re)added, but this time\nwith a sane definition.\n\nSo in this version the following is true on all platforms:\n\n```js\nassert.strictEqual(murmurHash('foo', 'buffer').toString('hex'), murmurHash('foo', 0, 'hex'));\nassert.strictEqual(murmurHash('foo', 'buffer').toString('base64'), murmurHash('foo', 0, 'base64'));\n```\n\n\nSignificant changes in 2.x\n--------------------------\n\nThe 1.x output types were very confusing. E.g. \"hex\" was just an equivalent of\n`murmurHash(data, \"buffer\").toString(\"hex\")` which rendered incorrect hexadecimal\nnumber. So all the string output type encodings: \"utf8\", \"ucs2\", \"ascii\", \"hex\",\n\"base64\" and \"binary\" were completely removed in 2.0 as being simply useless.\n\nThe \"number\" output type has been adapted to all variants in a way more compatible\nwith other murmurhash [implementations][murmurhash3js]. For 32bit hash the return\nvalue is an unsigned 32-bit integer (it was signed integer in 1.x) and for other\nhashes it's a hexadecimal number.\n\nThe \"buffer\" output type wasn't modified except that the default output is now\n\"number\" for all of the hashes.\n\nAdditionally when passing unsupported value to `encoding` or `output_type`\nargument the function throws `TypeError`.\n\nAnother breaking change is for the BE platforms. Starting with 2.0 endian-ness\nis recognized, so hashes should be consistent regardless of the cpu type.\n\nSince v2.1 the callback argument was introduced.\n\n\nBugs, limitations, caveats\n--------------------------\nWhen working with Buffers, input data is not being copied, however for strings\nthis is unavoidable. For strings with byte-length < 1kB the static buffer is\nprovided to avoid mem-allocs.\n\nThe hash functions optimized for x64 and x86 produce different results.\n\nTested on Linux (x64), OS X (x64) and MS Windows (x64 and x86).\n\nThis version provides binaries for nodejs: v10, v11, v12, v13 and v14.\n\nFor binaries of murmurhash-native for previous versions of nodejs, use version\n3.4.1 or 3.3.0 of this module.\n\n[Travis Status]: https://travis-ci.org/royaltm/node-murmurhash-native\n[Travis img]: https://img.shields.io/travis/royaltm/node-murmurhash-native.svg?maxAge=86400&style=flat-square&label=unix\n[AppVeyor img]: https://img.shields.io/appveyor/ci/royaltm/node-murmurhash-native.svg?maxAge=86400&style=flat-square&label=windows\n[AppVeyor Status]: https://ci.appveyor.com/project/royaltm/node-murmurhash-native\n[NPM img]: https://img.shields.io/npm/v/murmurhash-native.svg?maxAge=86400&style=flat-square\n[NPM Status]: https://www.npmjs.com/package/murmurhash-native\n[Node img]: https://img.shields.io/node/v/murmurhash-native.svg?maxAge=2592000&style=flat-square\n[License img]: https://img.shields.io/npm/l/murmurhash-native.svg?maxAge=2592000&style=flat-square\n[License Link]: https://opensource.org/licenses/MIT\n[bitHound img]: https://img.shields.io/bithound/dependencies/github/royaltm/node-murmurhash-native.svg?maxAge=86400&style=flat-square\n[murmurhash3js]: https://www.npmjs.com/package/murmurhash3js\n[PMurHash]: https://github.com/aappleby/smhasher/blob/master/src/PMurHash.c\n[crypto.Hash]: https://nodejs.org/dist/latest-v6.x/docs/api/crypto.html#crypto_class_hash\n[node-pre-gyp]: https://github.com/mapbox/node-pre-gyp\n[node-pre-gyp-github]: https://github.com/bchr02/node-pre-gyp-github\n[releases]: https://github.com/royaltm/node-murmurhash-native/releases\n[node-gyp-install]: https://github.com/nodejs/node-gyp#installation\n[typescript-docs]: http://royaltm.github.io/node-murmurhash-native/globals.html","readmeFilename":"README.md"}