{"name":"@node-rs/xxhash","version":"1.5.0","keywords":["hash","xxhash","xxhashjs","Rust","node-rs","napi","napi-rs","N-API","Node-API"],"author":{"name":"LongYinan","email":"lynweklm@gmail.com"},"license":"MIT","_id":"@node-rs/xxhash@1.5.0","maintainers":[{"name":"dxd_sjtu","email":"dxd_sjtu@outlook.com"},{"name":"broooooklyn","email":"lynweklm@gmail.com"}],"homepage":"https://github.com/napi-rs/node-rs","bugs":{"url":"https://github.com/napi-rs/node-rs/issues"},"dist":{"shasum":"f7b860af1197dfba16305c229a977685eadf79d7","tarball":"http://registry-npm.ywwl.com/@node-rs/xxhash/download/@node-rs/xxhash-1.5.0.tgz","fileCount":5,"integrity":"sha512-L4X+yw91qA+7yHYsBlcTclpgtQBnNQQ5md0erolXEk4MeZVWhgLa6QRH9RLBhh1k4ZbBZP4XiTWj6FEcuYyhGg==","signatures":[{"sig":"MEYCIQDjTO9iraR832vW1pKxp5GS03fTudGHELy8QEPPuHz0BAIhAIy8HHEaQZi84C6xPHR9x89Iq9uV5uPB7lKijk+iYbQF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@node-rs%2fxxhash@1.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":18112,"size":4413,"noattachment":false,"key":"/@node-rs/xxhash/-/@node-rs/xxhash-1.5.0.tgz"},"main":"index.js","napi":{"targets":["x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu","aarch64-linux-android","aarch64-unknown-linux-gnu","aarch64-unknown-linux-musl","aarch64-pc-windows-msvc","armv7-unknown-linux-gnueabihf","x86_64-unknown-linux-musl","x86_64-unknown-freebsd","i686-pc-windows-msvc","armv7-linux-androideabi","wasm32-wasi-preview1-threads"],"binaryName":"xxhash"},"engines":{"node":">= 12"},"funding":{"url":"https://github.com/sponsors/Brooooooklyn","type":"github"},"gitHead":"5d6754d691a5bf69e00f23f6eefd6069e691c31b","scripts":{"bench":"cross-env NODE_ENV=production node benchmark/xxhash.js","build":"napi build --platform --release","version":"napi version","artifacts":"napi artifacts -d ../../artifacts","build:debug":"napi build --platform","prepublishOnly":"napi prepublish"},"typings":"index.d.ts","_npmUser":{"name":"broooooklyn","email":"lynweklm@gmail.com"},"repository":{"url":"git+https://github.com/napi-rs/node-rs.git","type":"git"},"_npmVersion":"lerna/8.0.1/node@v20.10.0+x64 (linux)","description":"Fastest xxhash implementation in Node.js","directories":{},"_nodeVersion":"20.10.0","dependencies":{"@node-rs/xxhash-darwin-x64":"1.5.0","@node-rs/xxhash-freebsd-x64":"1.5.0","@node-rs/xxhash-wasm32-wasi":"1.5.0","@node-rs/xxhash-darwin-arm64":"1.5.0","@node-rs/xxhash-android-arm64":"1.5.0","@node-rs/xxhash-linux-x64-gnu":"1.5.0","@node-rs/xxhash-linux-x64-musl":"1.5.0","@node-rs/xxhash-win32-x64-msvc":"1.5.0","@node-rs/xxhash-linux-arm64-gnu":"1.5.0","@node-rs/xxhash-win32-ia32-msvc":"1.5.0","@node-rs/xxhash-android-arm-eabi":"1.5.0","@node-rs/xxhash-linux-arm64-musl":"1.5.0","@node-rs/xxhash-win32-arm64-msvc":"1.5.0","@node-rs/xxhash-linux-arm-gnueabihf":"1.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"xxhash":"^0.3.0","webpack":"^5.89.0","xxhashjs":"^0.2.2","@napi-rs/cli":"^3.0.0-alpha.29","@types/xxhashjs":"^0.2.4"},"optionalDependencies":{"@node-rs/xxhash-darwin-x64":"1.5.0","@node-rs/xxhash-freebsd-x64":"1.5.0","@node-rs/xxhash-wasm32-wasi":"1.5.0","@node-rs/xxhash-darwin-arm64":"1.5.0","@node-rs/xxhash-android-arm64":"1.5.0","@node-rs/xxhash-linux-x64-gnu":"1.5.0","@node-rs/xxhash-linux-x64-musl":"1.5.0","@node-rs/xxhash-win32-x64-msvc":"1.5.0","@node-rs/xxhash-linux-arm64-gnu":"1.5.0","@node-rs/xxhash-win32-ia32-msvc":"1.5.0","@node-rs/xxhash-android-arm-eabi":"1.5.0","@node-rs/xxhash-linux-arm64-musl":"1.5.0","@node-rs/xxhash-win32-arm64-msvc":"1.5.0","@node-rs/xxhash-linux-arm-gnueabihf":"1.5.0"},"_npmOperationalInternal":{"tmp":"tmp/xxhash_1.5.0_1704213614364_0.3806038892995667","host":"s3://npm-registry-packages"},"readme":"# `@node-rs/xxhash`\n\n![](https://github.com/napi-rs/node-rs/workflows/CI/badge.svg)\n![](https://img.shields.io/npm/dm/@node-rs/xxhash.svg?sanitize=true)\n[![Install size](https://packagephobia.com/badge?p=@node-rs/xxhash)](https://packagephobia.com/result?p=@node-rs/xxhash)\n\n> 🚀 Help me to become a full-time open-source developer by [sponsoring me on Github](https://github.com/sponsors/Brooooooklyn)\n\n[`xxhash-rust`](https://github.com/DoumanAsh/xxhash-rust) binding for Node.js.\n\n## Install this package\n\n```\nyarn add @node-rs/xxhash\npnpm add @node-rs/xxhash\nnpm install @node-rs/xxhash\n```\n\n## API\n\n```ts\nexport type BufferLike =\n  | Buffer\n  | string\n  | Uint8Array\n  | ArrayBuffer\n  | SharedArrayBuffer\n  | ReadonlyArray<number>\n  | number[]\n\nexport function xxh32(input: BufferLike, seed?: number): number\nexport function xxh64(input: BufferLike, seed?: BigInt): BigInt\n\nexport class Xxh32 {\n  constructor(seed?: number)\n  update(input: BufferLike): this\n  digest(): number\n  reset(): void\n}\n\nexport class Xxh64 {\n  constructor(seed?: BigInt)\n  update(input: BufferLike): this\n  digest(): BigInt\n  reset(): void\n}\n\nexport class Xxh3 {\n  static withSeed(seed?: BigInt): Xxh3\n  static withSecret(secret: BufferLike): Xxh3\n  private constructor() {}\n  update(input: BufferLike): this\n  digest(): BigInt\n  reset(): void\n}\n\nexport const xxh3: {\n  xxh64: (input: BufferLike, seed?: BigInt) => BigInt\n  xxh64WithSecret: (input: BufferLike, secret: BufferLike) => BigInt\n  xxh128: (input: BufferLike, seed?: BigInt) => BigInt\n  xxh128WithSecret: (input: BufferLike, secret: BufferLike) => BigInt\n  Xxh3: typeof Xxh3\n}\n```\n\n## Performance\n\n### Hardware\n\n```\n                  ,MMMM.           Host        -  xxxxxxxxxxxxxxxxxxxxxxx\n                .MMMMMM            Machine     -  Mac15,9\n                MMMMM,             Kernel      -  24.0.0\n      .;MMMMM:' MMMMMMMMMM;.       OS          -  macOS 15.0.1 Sequoia\n    MMMMMMMMMMMMNWMMMMMMMMMMM:     DE          -  Aqua\n  .MMMMMMMMMMMMMMMMMMMMMMMMWM.     WM          -  Quartz Compositor\n  MMMMMMMMMMMMMMMMMMMMMMMMM.       Packages    -  194 (Homebrew), 32 (cargo)\n ;MMMMMMMMMMMMMMMMMMMMMMMM:        Shell       -  zsh\n :MMMMMMMMMMMMMMMMMMMMMMMM:        Terminal    -  warpterminal (Version v0.2024.10.23.14.49.stable_00)\n .MMMMMMMMMMMMMMMMMMMMMMMMM.       Resolution  -  5120x2880@160fps (as 2560x1440)\n  MMMMMMMMMMMMMMMMMMMMMMMMMMM.                    2992x1934@120fps (as 1496x967)\n   .MMMMMMMMMMMMMMMMMMMMMMMMMM.                   2232x1512@60fps (as 1116x756)\n     MMMMMMMMMMMMMMMMMMMMMMMM      Uptime      -  1d 2h 32m\n      ;MMMMMMMMMMMMMMMMMMMM.       CPU         -  Apple M3 Max (16)\n        .MMMM,.    .MMMM,.         CPU Load    -  16%\n                                   Memory      -  50.1 GB / 134.2 GB\n                                   Battery     -  78% & Discharging\n                                   Disk Space  -  624.0 GB / 994.7 GB\n```\n\n### Result\n\n```\n❯ yarn workspace @node-rs/xxhash bench\nxxh32 without initial seed\n┌─────────┬───────────────────────┬──────────┬───────────────────┬──────────┬─────────┐\n│ (index) │ Task Name             │ ops/sec  │ Average Time (ns) │ Margin   │ Samples │\n├─────────┼───────────────────────┼──────────┼───────────────────┼──────────┼─────────┤\n│ 0       │ '@node-rs/xxhash h32' │ '20,146' │ 49637.20101250711 │ '±0.20%' │ 10074   │\n│ 1       │ 'xxhash c++'          │ '17,348' │ 57642.4387319887  │ '±0.19%' │ 8675    │\n│ 2       │ 'xxhashjs h32'        │ '2,697'  │ 370657.902149741  │ '±0.24%' │ 1349    │\n└─────────┴───────────────────────┴──────────┴───────────────────┴──────────┴─────────┘\nxxh32 without initial seed multi step\n┌─────────┬───────────────────────┬──────────┬────────────────────┬──────────┬─────────┐\n│ (index) │ Task Name             │ ops/sec  │ Average Time (ns)  │ Margin   │ Samples │\n├─────────┼───────────────────────┼──────────┼────────────────────┼──────────┼─────────┤\n│ 0       │ '@node-rs/xxhash h32' │ '17,111' │ 58440.61746142987  │ '±0.20%' │ 8556    │\n│ 1       │ 'xxhashjs h32'        │ '2,738'  │ 365160.82262773765 │ '±0.19%' │ 1370    │\n└─────────┴───────────────────────┴──────────┴────────────────────┴──────────┴─────────┘\nxxh64 without initial seed\n┌─────────┬──────────────────────┬──────────┬────────────────────┬──────────┬─────────┐\n│ (index) │ Task Name            │ ops/sec  │ Average Time (ns)  │ Margin   │ Samples │\n├─────────┼──────────────────────┼──────────┼────────────────────┼──────────┼─────────┤\n│ 0       │ '@node-rs/xxhash 64' │ '50,159' │ 19936.33995215147  │ '±0.11%' │ 25080   │\n│ 1       │ 'xxhash C++'         │ '47,980' │ 20841.790588135264 │ '±0.17%' │ 23991   │\n│ 2       │ 'wasm'               │ '33,916' │ 29484.03756117805  │ '±0.21%' │ 16959   │\n│ 3       │ 'xxhashjs h64'       │ '95'     │ 10431058.97916674  │ '±0.57%' │ 48      │\n└─────────┴──────────────────────┴──────────┴────────────────────┴──────────┴─────────┘\nxxh64 without initial seed multi step\n┌─────────┬──────────────────────┬──────────┬────────────────────┬──────────┬─────────┐\n│ (index) │ Task Name            │ ops/sec  │ Average Time (ns)  │ Margin   │ Samples │\n├─────────┼──────────────────────┼──────────┼────────────────────┼──────────┼─────────┤\n│ 0       │ '@node-rs/xxhash 64' │ '46,603' │ 21457.79825765685  │ '±0.20%' │ 23302   │\n│ 1       │ 'wasm'               │ '34,681' │ 28834.205985814675 │ '±0.19%' │ 17341   │\n│ 2       │ 'xxhashjs h64'       │ '96'     │ 10411336.75510195  │ '±0.73%' │ 49      │\n└─────────┴──────────────────────┴──────────┴────────────────────┴──────────┴─────────┘\n```\n","publish_time":1704213614523,"_cnpm_publish_time":1704213614523,"dist-tags":{"depracated":"1.1.2","latest":"1.7.8"}}