{"_id":"string-hash-64","_rev":"7-08f3ac980946d63fa94420237e6e7435","name":"string-hash-64","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"string-hash-64","version":"1.0.0","keywords":["string","hashing","64 bit"],"author":{"name":"Mustafa Dokumacı","email":"mustafa@foraa.com"},"license":"MIT","_id":"string-hash-64@1.0.0","maintainers":[{"name":"vapurfilozofu","email":"mustafa@foraa.com"}],"homepage":"https://github.com/mstdokumaci/string-hash-64#readme","bugs":{"url":"https://github.com/mstdokumaci/string-hash-64/issues"},"dist":{"shasum":"cacc507f243fa6f2e4d75a779938f347c545b1c0","tarball":"https://registry.npmjs.org/string-hash-64/-/string-hash-64-1.0.0.tgz","integrity":"sha512-Nx4oQH7XO7e3eIhlSCGnczmYBuQuFLNceiV8dnhG58TkCTjXSCGzFR9QYQGnepmpby14eXRaIVQVHojX60tmzg==","signatures":[{"sig":"MEQCIGJjB31NOCSqAn6EL/MRtFRPCojxM0CrTsggIv+gMAjMAiBu6iMn+NbpLBrHG8ze/F6JSuNT5urzHFrf8H3zCmLoUw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./index","gitHead":"e44179ca1225459eec483b842ce5783c06e5ca35","scripts":{"test":"node test | tap-difflet && standard"},"_npmUser":{"name":"vapurfilozofu","email":"mustafa@foraa.com"},"repository":{"url":"git://github.com/mstdokumaci/string-hash-64.git","type":"git"},"_npmVersion":"5.3.0","description":"fast 64 bit string hashing function","_nodeVersion":"8.3.0","dependencies":{},"devDependencies":{"tape":"*","standard":"*","tap-difflet":"*"},"_npmOperationalInternal":{"tmp":"tmp/string-hash-64-1.0.0.tgz_1502953852957_0.07597707165405154","host":"s3://npm-registry-packages"},"directories":{}},"1.0.1":{"name":"string-hash-64","version":"1.0.1","keywords":["string","hashing","64 bit"],"author":{"name":"Mustafa Dokumacı","email":"mustafa@foraa.com"},"license":"MIT","_id":"string-hash-64@1.0.1","maintainers":[{"name":"vapurfilozofu","email":"mustafa@foraa.com"}],"homepage":"https://github.com/mstdokumaci/string-hash-64#readme","bugs":{"url":"https://github.com/mstdokumaci/string-hash-64/issues"},"dist":{"shasum":"c3495d565385c2bceceb6f4acee07fefd6b9f528","tarball":"https://registry.npmjs.org/string-hash-64/-/string-hash-64-1.0.1.tgz","integrity":"sha512-o/0unh3aQG5zaBJ4kcbCq3Y3r32dstbn2okarLmT8/dAVR8ER+7nYnhbEJw/Yw3SXcS25wXo+xTgrUPX/RsN4g==","signatures":[{"sig":"MEUCIDOIzwh/z/UFQ0641DuI5MucFm4Xxt37AO5Gy//mvaHDAiEA02CSL5PbikW4PHpodFYP5mYIB3vlyQcZbcn1kUSTMU8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./index","gitHead":"373cd030fcaea23c65d1654b5bca8832c9210533","scripts":{"test":"node test | tap-difflet && standard"},"_npmUser":{"name":"vapurfilozofu","email":"mustafa@foraa.com"},"repository":{"url":"git://github.com/mstdokumaci/string-hash-64.git","type":"git"},"_npmVersion":"5.3.0","description":"fast 64 bit string hashing function","_nodeVersion":"8.3.0","dependencies":{},"devDependencies":{"tape":"*","standard":"*","tap-difflet":"*"},"_npmOperationalInternal":{"tmp":"tmp/string-hash-64-1.0.1.tgz_1502958968411_0.035051991464570165","host":"s3://npm-registry-packages"},"directories":{}},"1.0.2":{"name":"string-hash-64","version":"1.0.2","keywords":["string","hashing","64 bit"],"author":{"name":"Mustafa Dokumacı","email":"mustafa@foraa.com"},"license":"MIT","_id":"string-hash-64@1.0.2","maintainers":[{"name":"vapurfilozofu","email":"mustafa@foraa.com"}],"homepage":"https://github.com/mstdokumaci/string-hash-64#readme","bugs":{"url":"https://github.com/mstdokumaci/string-hash-64/issues"},"dist":{"shasum":"289d29b225ab2329175bd7cb942a7ecaf43d1e38","tarball":"https://registry.npmjs.org/string-hash-64/-/string-hash-64-1.0.2.tgz","integrity":"sha512-kPyawNEwyEG5X1G/UsIkv68mdx1c/EoDGrcqicNZ6FPCU5vF3xmJW7Vbqwb94Sxl250BYs6k0lRkPll42BAwWA==","signatures":[{"sig":"MEUCIHbeCGAaa/5NWJaWiP46jScp7tI03W3SSItBlEV0xywxAiEAwxGpF7JYIrdcbHTnRqB/1ruCuSPLHbOJiy+D193c/NY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./index","gitHead":"00a1dfbf443ee8f3eb476cba798471139187a693","scripts":{"test":"node test | tap-difflet && standard"},"_npmUser":{"name":"vapurfilozofu","email":"mustafa@foraa.com"},"repository":{"url":"git://github.com/mstdokumaci/string-hash-64.git","type":"git"},"_npmVersion":"5.3.0","description":"fast 64 bit string hashing function","_nodeVersion":"8.3.0","dependencies":{},"devDependencies":{"tape":"*","standard":"*","tap-difflet":"*"},"_npmOperationalInternal":{"tmp":"tmp/string-hash-64-1.0.2.tgz_1503037660041_0.9742802542168647","host":"s3://npm-registry-packages"},"directories":{}},"1.0.3":{"name":"string-hash-64","version":"1.0.3","keywords":["string","hashing","64 bit"],"author":{"name":"Mustafa Dokumacı","email":"mustafa@foraa.com"},"license":"MIT","_id":"string-hash-64@1.0.3","maintainers":[{"name":"vapurfilozofu","email":"mustafa@foraa.com"}],"homepage":"https://github.com/mstdokumaci/string-hash-64#readme","bugs":{"url":"https://github.com/mstdokumaci/string-hash-64/issues"},"dist":{"shasum":"0deb56df58678640db5c479ccbbb597aaa0de322","tarball":"https://registry.npmjs.org/string-hash-64/-/string-hash-64-1.0.3.tgz","integrity":"sha512-D5OKWKvDhyVWWn2x5Y9b+37NUllks34q1dCDhk/vYcso9fmhs+Tl3KR/gE4v5UNj2UA35cnX4KdVVGkG1deKqw==","signatures":[{"sig":"MEQCIEsHrjHfm7CenHrDqy3BFVrziCSMgXjEGbupRk+uFi99AiBjPYvekagtsxrJT50EgZFIAaR1CQWavgz+5vXyBwxzDA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./index","gitHead":"34f00b3f3e1aa6219a14c7f9a7bac54fad5d1b3b","scripts":{"test":"node test | tap-difflet && standard"},"_npmUser":{"name":"vapurfilozofu","email":"mustafa@foraa.com"},"repository":{"url":"git://github.com/mstdokumaci/string-hash-64.git","type":"git"},"_npmVersion":"5.3.0","description":"fast 64 bit string hashing function","_nodeVersion":"8.3.0","dependencies":{},"devDependencies":{"tape":"*","standard":"*","tap-difflet":"*"},"_npmOperationalInternal":{"tmp":"tmp/string-hash-64-1.0.3.tgz_1503414404203_0.19460571883246303","host":"s3://npm-registry-packages"},"directories":{}},"2.0.0":{"_id":"string-hash-64@2.0.0","bugs":{"url":"https://github.com/mstdokumaci/string-hash-64/issues"},"dist":{"shasum":"c1e68c0635cbfda060b000a85d02406bb5b6cde7","tarball":"https://registry.npmjs.org/string-hash-64/-/string-hash-64-2.0.0.tgz","fileCount":5,"integrity":"sha512-+BCceHdHUtqC2aiaOFmOUFMoSi5qUui1i3VGRe9pT3Kbh+4ge9a1dXKUwPWXabvwe3HoZ3O+HGCxX+ia1ObIrg==","signatures":[{"sig":"MEUCIQC3hBs6zxATi5E9mTN8W4ckRlhIxWWbVPxYJzADDNgangIge7/UsPzdAMdUWjX72DfIKj5y64y+lpeVgSKwDHYgY2w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHNdI+FONHczyCHDDFk/kgOL952JBWqNO8oJRvRuRsWfAiA7QBy0Ufsn/A1DPOPwUDoVnvtriZaiNh3Wd+jmdWKYHA=="}],"unpackedSize":4340},"main":"./index","name":"string-hash-64","author":{"name":"Mustafa Dokumacı","email":"mustafa@foraa.com"},"engines":{"node":">=18"},"gitHead":"ef05808e95ff9de0978a38c48e031a5e9bc8ecf1","license":"MIT","scripts":{"test":"standard && node --test test.js","test:collisions":"node scripts/collisions.js"},"typings":"./types.d.ts","version":"2.0.0","_npmUser":{"name":"vapurfilozofu","email":"mustafa@foraa.com"},"homepage":"https://github.com/mstdokumaci/string-hash-64#readme","keywords":["string","hashing","hash","djb2","53-bit"],"repository":{"url":"git://github.com/mstdokumaci/string-hash-64.git","type":"git"},"_npmVersion":"11.8.0","description":"fast djb2-style string hashing returning a 53-bit safe integer","directories":{},"maintainers":[{"name":"vapurfilozofu","email":"mustafa@foraa.com"}],"_nodeVersion":"25.2.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"standard":"^17.1.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/string-hash-64_2.0.0_1791816251005_0.24730500009514977"}}},"time":{"created":"2017-08-17T07:10:53.849Z","modified":"2026-10-12T14:44:11.274Z","1.0.0":"2017-08-17T07:10:53.849Z","1.0.1":"2017-08-17T08:36:09.203Z","1.0.2":"2017-08-18T06:27:41.936Z","1.0.3":"2017-08-22T15:06:45.108Z","2.0.0":"2026-10-12T14:44:11.085Z"},"bugs":{"url":"https://github.com/mstdokumaci/string-hash-64/issues"},"author":{"name":"Mustafa Dokumacı","email":"mustafa@foraa.com"},"license":"MIT","homepage":"https://github.com/mstdokumaci/string-hash-64#readme","keywords":["string","hashing","hash","djb2","53-bit"],"repository":{"url":"git://github.com/mstdokumaci/string-hash-64.git","type":"git"},"description":"fast djb2-style string hashing returning a 53-bit safe integer","maintainers":[{"name":"vapurfilozofu","email":"mustafa@foraa.com"}],"readme":"# string-hash-64\n\n[![npm version](https://badge.fury.io/js/string-hash-64.svg)](https://badge.fury.io/js/string-hash-64)\n[![test](https://github.com/mstdokumaci/string-hash-64/actions/workflows/test.yml/badge.svg)](https://github.com/mstdokumaci/string-hash-64/actions/workflows/test.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\nAn improved version of djb2: two djb2-style lanes with different strides (33 and 65599) combined into a 53-bit integer hash that always fits in `Number.MAX_SAFE_INTEGER`. Returns a number between 0 and 9007199254740991.\n\n```js\nconst hash = require('string-hash-64')\n\nhash('hello') // 6000404498017767\n```\n\n## Collisions, measured against djb2\n\n**Zero collisions among the first 300 million sequential integers**, djb2 already has 12.6 million duplicate entries in that same batch.\n\nRun `npm run test:collisions` to reproduce (it grows sequential batches until the first collision; needs ~4GB of RAM and a few minutes).\n\n| | string-hash-64 | djb2 | djb2 (reverse loop) |\n| --- | ---: | ---: | ---: |\n| first collision among sequential integers | **318,937,570** | 1,626,086 | 5,004,826 |\n| duplicate entries in a batch of 300M sequential integers | **0** | 12,608,182 | 10,963,171 |\n| duplicate entries among 10M random 12-character keys | **0** | 11,896 | 11,728 |\n\nFirst collision: `hash(\"103939545\") === hash(\"318937570\")`.\n\n## Performance\n\nThroughput is on par with djb2 — the two lanes overlap in the JIT'ed loop, so the extra multiply per character does not show up in practice (medians from the same run):\n\n| ns per key | 8 chars | 12 chars | 32 chars | 64 chars |\n| --- | ---: | ---: | ---: | ---: |\n| string-hash-64 | 24.6 | 32.5 | 107.5 | 197.8 |\n| djb2 | 26.2 | 33.5 | 111.1 | 200.9 |\n\nYour machine will differ; the comparison script prints its own table.\n\n## Breaking change in 2.0.0\n\nHash values differ from 1.x. Rehash anything you persisted. The API is unchanged: `hash(string)` returns a number.\n\n## Development\n\n- `npm test`: linter + unit tests\n- `npm run test:collisions`: the full comparison against djb2 above\n\n## License\n\nMIT\n","readmeFilename":"README.md","users":{"vapurfilozofu":true}}