├── .npmrc ├── test ├── types │ ├── .gitignore │ ├── tap.d.ts │ ├── tsconfig.json │ ├── test.types.stream.ts │ └── test.types.incremental.ts ├── randomchunkstream.js ├── persistent │ ├── test.gc.incremental.js │ └── test.gc.async.js ├── byteswap │ ├── byteorderswap.js │ └── test.byteswap.js ├── test.randomchunkstream.js ├── uncaughtexceptionwrap_tap.js ├── test.endianness.js ├── test.compat.js ├── test.incremental.endianness.js └── test.promise.js ├── .jshintrc ├── index.js ├── bench ├── bench.all.sh ├── parben.js ├── bench.incremental.js ├── bench.js ├── bench.async.js └── bench.stream.js ├── .gitignore ├── incremental.js ├── .npmignore ├── checkout-murmurhash.sh ├── .github └── workflows │ ├── npmjs-publish.yml │ └── ci.yml ├── src ├── nodemurmurhash.h ├── incremental │ ├── asyncupdate.h │ ├── asyncupdate_impl.h │ ├── hasher_impl.h │ └── hasher.h ├── static_assert.h ├── murmurhash │ ├── PMurHash.h │ ├── MurmurHash2.h │ ├── PMurHash128.h │ ├── endianness.h │ ├── PMurHash.cpp │ └── MurmurHash2.cpp ├── asyncworker.h ├── inputdata.h ├── inputdata_impl.h ├── asyncworker_impl.h ├── murmurhashutils.h └── nodemurmurhash.cc ├── LICENSE ├── lazy_transform.js ├── promisify.js ├── package.json ├── binding.gyp ├── appveyor.yml ├── stream.d.ts ├── promisify.d.ts ├── stream.js ├── HISTORY.md ├── index.d.ts ├── incremental.d.ts └── README.md /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /test/types/.gitignore: -------------------------------------------------------------------------------- 1 | *.js 2 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "laxcomma": true, 4 | "laxbreak": true, 5 | "undef": true 6 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var binary = require('@mapbox/node-pre-gyp'); 4 | var path = require('path'); 5 | var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json'))); 6 | module.exports = require(binding_path); 7 | -------------------------------------------------------------------------------- /bench/bench.all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/sh 2 | 3 | SCRIPT=$(readlink -f "$0") 4 | SCRIPTPATH=$(dirname "$SCRIPT") 5 | 6 | for bench in "$SCRIPTPATH"/bench*.js 7 | do 8 | echo $(basename "$bench") "$@" 9 | node "$bench" "$@" || exit $? 10 | done 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | .idea 4 | .svn 5 | .tap 6 | *.tmp 7 | *.log 8 | *~ 9 | *.lnk 10 | *.sublime-project 11 | *.sublime-workspace 12 | sftp-config.json 13 | /node_modules 14 | /tmp 15 | /build 16 | *.o 17 | *.so 18 | .nyc_output 19 | *.tgz 20 | /lib 21 | package-lock.json 22 | /doc 23 | -------------------------------------------------------------------------------- /incremental.js: -------------------------------------------------------------------------------- 1 | /* expose pure incremental api */ 2 | "use strict"; 3 | 4 | var binary = require('@mapbox/node-pre-gyp'); 5 | var path = require('path'); 6 | var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json'))); 7 | module.exports = require(path.join(path.dirname(binding_path), 'murmurhashincremental.node')); 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .jshintrc 2 | .travis.yml 3 | appveyor.yml 4 | bench/ 5 | test/ 6 | checkout-murmurhash.sh 7 | 8 | # MIRRORED FROM .gitignore 9 | .DS_Store 10 | Thumbs.db 11 | .svn 12 | *.tmp 13 | *.log 14 | *~ 15 | *.lnk 16 | *.sublime-project 17 | *.sublime-workspace 18 | sftp-config.json 19 | /node_modules 20 | /tmp 21 | /build 22 | *.o 23 | *.so 24 | .nyc_output 25 | *.tgz 26 | /lib 27 | /doc 28 | -------------------------------------------------------------------------------- /checkout-murmurhash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | mkdir -p src/murmurhash 4 | cd src/murmurhash 5 | for file in \ 6 | MurmurHash2.cpp \ 7 | MurmurHash2.h \ 8 | MurmurHash3.cpp \ 9 | MurmurHash3.h \ 10 | PMurHash.c \ 11 | PMurHash.h 12 | do 13 | if [ ! -e "$file" ] 14 | then curl "https://raw.githubusercontent.com/aappleby/smhasher/master/src/$file" -O -f 15 | else echo "$file already exists, skipping" 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /.github/workflows/npmjs-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish Package to npmjs 2 | on: 3 | release: 4 | types: [published] 5 | 6 | permissions: 7 | id-token: write # Required for OIDC 8 | contents: read 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v5 15 | # Setup .npmrc file to publish to npm 16 | - uses: actions/setup-node@v6 17 | with: 18 | registry-url: 'https://registry.npmjs.org' 19 | node-version: lts/* 20 | - run: npm install 21 | - run: npm publish --provenance --access public 22 | -------------------------------------------------------------------------------- /src/nodemurmurhash.h: -------------------------------------------------------------------------------- 1 | #if !defined(NODEMURMURHASH_HEADER) 2 | #define NODEMURMURHASH_HEADER 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define HashSize (static_cast(sizeof(HashValueType) * HashLength)) 10 | 11 | namespace MurmurHash { 12 | 13 | typedef void (*MurmurHashFunctionType)(const void *, int, uint32_t, void *); 14 | 15 | typedef enum { 16 | DefaultOutputType, 17 | NumberOutputType, 18 | HexStringOutputType, 19 | BinaryStringOutputType, 20 | Base64StringOutputType, 21 | BufferOutputType, 22 | ProvidedBufferOutputType, 23 | UnknownOutputType, 24 | } OutputType; 25 | 26 | typedef enum { 27 | MSBFirst, 28 | LSBFirst 29 | } ByteOrderType; 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /src/incremental/asyncupdate.h: -------------------------------------------------------------------------------- 1 | #if !defined(ASYNCUPDATE_HEADER) 2 | #define ASYNCUPDATE_HEADER 3 | 4 | namespace MurmurHash { 5 | using v8::Local; 6 | using v8::Value; 7 | 8 | template