{"name":"js-xxhash","publishConfig":{"access":"public","provenance":true},"version":"5.0.1","description":"Pure JS implementation of xxhash","main":"dist/cjs/index.cjs","types":"dist/cjs/index.d.cts","type":"module","exports":{".":{"import":"./index.mjs","types":"./dist/cjs/index.d.cts","require":"./dist/cjs/index.cjs"}},"scripts":{"clean":"rimraf dist/**","test":"npm run test:esm && npm run test:integrations","test:esm":"mocha --recursive \"./dist/esm/**/*.test.js\"","test:integrations":"cd test && npm i && npm test","build":"tsc -b . && ts2mjs dist/cjs --cjs && npm run build:bundle","build:bundle":"esbuild --bundle --platform=node --target=node18 --outfile=dist/cjs/index.cjs src/index.ts","clean-build":"npm run clean && npm run build","coverage":"NODE_ENV=test c8 -r lcov -r html npm run test-ts","lint":"npm run install:test && eslint .","install:test":"cd test && npm i","prettier":"prettier . -w","test-ts":"mocha --experimental-specifier-resolution=node --experimental-loader=ts-node/esm --require ts-node/register --recursive \"src/**/*.test.ts\"","prepare":"npm run build","perf":"perf-insight --register jiti/register  --file \"**/*.perf.{mts,ts}\"","insight:test":"perf-insight --register jiti/register --file \"test/**/*.perf.{mts,ts}\"","insight:utf8":"perf-insight --register jiti/register --file \"**/toUtf8.perf.{mts,ts}\"","ncu":"npx npm-check-updates","update-packages":"npx npm-check-updates -t semver -u && rimraf node_modules package-lock.json && npm i","watch":"tsc -b . -w"},"repository":{"type":"git","url":"git+https://github.com/Jason3S/xxhash.git"},"keywords":["xxhash","javascript","typescript"],"author":{"name":"Jason Dent"},"license":"MIT","bugs":{"url":"https://github.com/Jason3S/xxhash/issues"},"homepage":"https://github.com/Jason3S/xxhash#readme","devDependencies":{"@eslint/js":"^9.39.1","@tsconfig/node18":"^18.2.6","@types/chai":"^5.2.3","@types/mocha":"^10.0.10","@types/node":"^18.19.130","@types/xxhashjs":"^0.2.4","c8":"^10.1.3","chai":"^6.2.1","esbuild":"^0.27.0","eslint":"^9.39.1","globals":"^16.5.0","jiti":"^2.6.1","lorem-ipsum":"^2.0.8","mocha":"^11.7.5","perf-insight":"^2.0.1","prettier":"^3.6.2","ts-node":"^10.9.2","ts2mjs":"^4.0.0","typescript":"^5.9.3","typescript-eslint":"^8.47.0","xxhash-wasm":"^1.1.0","xxhashjs":"^0.2.2"},"engines":{"node":">=20.0.0"},"packageManager":"npm@11.6.2+sha512.ee22b335fcbc95662cdf3ab8a053daf045d9cf9c6df6040d28965abb707512b2c16fa6c5eec049d34c74f78f390cebd14f697919eadb97756564d4f9eccc4954","gitHead":"0b980730d9a6d1889afb4e4193d93f838f23a8a4","_id":"js-xxhash@5.0.1","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-OGuTCR9wqYqF2FrhjtGb6fx8Rm1jzhdpUEsY2sLkXbNYLzOS+XWcYT4KTUL7vnaRTmBuGuVpW1AK2zzxjgZXGg==","shasum":"35135863425169a42a2defe4741a60aeec3008e6","tarball":"http://registry-npm.ywwl.com/js-xxhash/download/js-xxhash-5.0.1.tgz","fileCount":20,"unpackedSize":32542,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/js-xxhash@5.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGXLqjEgsCfIjT3etUy0GOwtpuwtmtm8xLTjnjr0EvNMAiAyLhc8nsGbjhG72tOnqlL1aMuQiA1i58SpJ7rUqmzAOQ=="}],"size":7484,"noattachment":false,"key":"/js-xxhash/-/js-xxhash-5.0.1.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5b8da091-0d67-4875-8612-5ea476dbbc77"}},"directories":{},"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/js-xxhash_5.0.1_1763571853046_0.5646873113025666"},"_hasShrinkwrap":false,"readme":"# js-xxHash\n\nPure Javascript / Typescript Implementation of [xxHash](http://cyan4973.github.io/xxHash/)\n\nThis is an implementation for the\n[XXH32 Algorithm](https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md#xxh32-algorithm-description)\nA 64-bit version might come a bit later.\n\n## Why another version\n\n- I needed a fast simple hash for short to medium sized strings.\n- It needed to be pure JS.\n\n## Installation\n\n```\nnpm install --save js-xxhash\n```\n\n## Usage\n\n### Pure JS\n\nInternally it uses [TextEncoder](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder) to convert strings to a UTF-8 `Uint8Array`s.\n\n```typescript\nimport { xxHash32 } from 'js-xxhash';\n\nlet seed = 0;\nlet str = 'My text to hash 😊';\nlet hashNum = xxHash32(str, seed);\nconsole.log(hashNum.toString(16));\n```\n\nExpected:\n\n```\naf7fd356\n```\n\n### Node JS\n\n```typescript\nimport { xxHash32 } from 'js-xxhash';\n\nlet seed = 0;\nlet str = 'My text to hash 😊';\nlet hashNum = xxHash32(str, seed);\nconsole.log(hashNum.toString(16));\n```\n\n### Browser\n\n```typescript\n// Using a bundler\nimport { xxHash32 } from 'js-xxhash';\n// Using a CDN like jsDelivr\nimport { xxHash32 } from 'https://cdn.jsdelivr.net/npm/js-xxhash@{version}/index.mjs';\n\nlet seed = 0;\nlet str = 'My text to hash 😊';\nlet hashNum = xxHash32(str, seed);\nconsole.log(hashNum.toString(16));\n```\n\n# Performance\n\nTo evaluate performance this package was compared to:\n\n- [xxhashjs](https://www.npmjs.com/package/xxhashjs)\n- [xxhash-wasm](https://www.npmjs.com/package/xxhash-wasm)\n\nOne average a lorem-ipsum \"word\" is between 5 and 6 characters.\n\n## Performance for Strings\n\n```\nRunning Perf Suite: xxhash-string-words-10\nEvaluate xxhash performance with a string of 10 words.\n✔ js-xxhash string       731_148.14 ops/sec\n✔ xxhashjs string        432_753.87 ops/sec\n✔ xxhash-wasm string   3_381_907.91 ops/sec\n\nRunning Perf Suite: xxhash-string-words-100\nEvaluate xxhash performance with a string of 100 words.\n✔ js-xxhash string       420_458.19 ops/sec\n✔ xxhashjs string        124_443.56 ops/sec\n✔ xxhash-wasm string   2_289_457.63 ops/sec\n\nRunning Perf Suite: xxhash-string-words-1000\nEvaluate xxhash performance with a string of 1000 words.\n✔ js-xxhash string        74_861.33 ops/sec\n✔ xxhashjs string         16_656.57 ops/sec\n✔ xxhash-wasm string     729_339.20 ops/sec\n\nRunning Perf Suite: xxhash-string-words-10000\nEvaluate xxhash performance with a string of 10000 words.\n✔ js-xxhash string         6_293.40 ops/sec\n✔ xxhashjs string            551.90 ops/sec\n✔ xxhash-wasm string      90_170.30 ops/sec\n\nRunning Perf Suite: xxhash-string-words-100000\nEvaluate xxhash performance with a string of 100000 words.\n✔ js-xxhash string           709.30 ops/sec\n✔ xxhashjs string             40.05 ops/sec\n✔ xxhash-wasm string       8_093.17 ops/sec\n```\n\n### Performance with a Uint8Array Buffer\n\n```\nRunning Perf Suite: xxhash-buffer-words-10\nEvaluate xxhash performance with a buffer containing a string of 10 words.\n✔ js-xxhash buffer       2_859_850.03 ops/sec\n✔ xxhashjs buffer          699_053.22 ops/sec\n✔ xxhash-wasm buffer     3_657_504.67 ops/sec\n\nRunning Perf Suite: xxhash-buffer-words-100\nEvaluate xxhash performance with a buffer containing a string of 100 words.\n✔ js-xxhash buffer         800_609.77 ops/sec\n✔ xxhashjs buffer          402_424.91 ops/sec\n✔ xxhash-wasm buffer     2_569_294.66 ops/sec\n\nRunning Perf Suite: xxhash-buffer-words-1000\nEvaluate xxhash performance with a buffer containing a string of 1000 words.\n✔ js-xxhash buffer         79_925.04 ops/sec\n✔ xxhashjs buffer          55_568.13 ops/sec\n✔ xxhash-wasm buffer      753_856.33 ops/sec\n\nRunning Perf Suite: xxhash-buffer-words-10000\nEvaluate xxhash performance with a buffer containing a string of 10000 words.\n✔ js-xxhash buffer          8_152.57 ops/sec\n✔ xxhashjs buffer           6_046.82 ops/sec\n✔ xxhash-wasm buffer      104_463.50 ops/sec\n\nRunning Perf Suite: xxhash-buffer-words-100000\nEvaluate xxhash performance with a buffer containing a string of 100000 words.\n✔ js-xxhash buffer            458.33 ops/sec\n✔ xxhashjs buffer             602.90 ops/sec\n✔ xxhash-wasm buffer        9_835.61 ops/sec\n```\n","publish_time":1763571853284,"_cnpm_publish_time":1763571853284,"dist-tags":{"latest":"5.0.1"}}