{"id":38798981,"url":"https://github.com/liushoukai/node-hashes","last_synced_at":"2026-01-17T12:45:27.590Z","repository":{"id":102407927,"uuid":"42839881","full_name":"liushoukai/node-hashes","owner":"liushoukai","description":"Some of the more common uses of hash functions.","archived":false,"fork":false,"pushed_at":"2025-09-03T02:32:32.000Z","size":44,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T13:25:45.853Z","etag":null,"topics":["hash-algorithm","hash-functions"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/node-hashes","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liushoukai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-21T02:40:07.000Z","updated_at":"2025-09-03T02:32:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"21f5fb78-d952-4ef3-9b74-0c30bfd0ee1d","html_url":"https://github.com/liushoukai/node-hashes","commit_stats":{"total_commits":52,"total_committers":3,"mean_commits":"17.333333333333332","dds":0.07692307692307687,"last_synced_commit":"326fe5042920eab419455709eebf673f76ab2aa7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/liushoukai/node-hashes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liushoukai%2Fnode-hashes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liushoukai%2Fnode-hashes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liushoukai%2Fnode-hashes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liushoukai%2Fnode-hashes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liushoukai","download_url":"https://codeload.github.com/liushoukai/node-hashes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liushoukai%2Fnode-hashes/sbom","scorecard":{"id":593735,"data":{"date":"2025-08-11","repo":{"name":"github.com/liushoukai/node-hashes","commit":"326fe5042920eab419455709eebf673f76ab2aa7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/27 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T22:37:21.144Z","repository_id":102407927,"created_at":"2025-08-20T22:37:21.144Z","updated_at":"2025-08-20T22:37:21.144Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T11:50:55.898Z","status":"ssl_error","status_checked_at":"2026-01-17T11:50:55.569Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hash-algorithm","hash-functions"],"created_at":"2026-01-17T12:45:27.501Z","updated_at":"2026-01-17T12:45:27.572Z","avatar_url":"https://github.com/liushoukai.png","language":"C++","readme":"# node-hashes\n\n[![node version][node-image]][node-url]\n[![appveyor build][appveyor-image]][appveyor-url]\n[![test coverage][coveralls-image]][coveralls-url]\n[![npm version][npm-image]][npm-url]\n[![npm downloads][downloads-image]][downloads-url]\n[![Code Climate][codeclimate-image]][codeclimate-url]\n\n\n\u003e Some of the more common uses of hash functions\n\n## Hash Function Algorithms\n\n\u003e ### RS Hash Function\n\u003e A simple hash function from Robert Sedgwicks Algorithms in C book.\n\n\u003e ### JS Hash Function\n\u003e A bitwise hash function written by Justin Sobel.\n\n\u003e ### PJW Hash Functionh\n\u003e This hash algorithm is based on work by Peter J. Weinberger of AT\u0026T Bell Labs.\n\u003e The book Compilers (Principles, Techniques and Tools) by Aho, Sethi and Ulman,\n\u003e recommends the use of hash functions that employ the hashing methodology found\n\u003e in this particular algorithm.\n\n\u003e ### ELF Hash Function\n\u003e Similar to the PJW Hash function, but tweaked for 32-bit processors.\n\u003e Its the hash function widely used on most UNIX systems.\n\n\u003e ### BKDR Hash Function\n\u003e This hash function comes from Brian Kernighan and Dennis Ritchie's book \"The C Programming Language\".\n\u003e It is a simple hash function using a strange set of possible seeds which all constitute a pattern of\n\u003e 31....31...31 etc, it seems to be very similar to the DJB hash function.\n\n\u003e ### SDBM Hash Function\n\u003e This is the algorithm of choice which is used in the open source SDBM project. The hash function\n\u003e seems to have a good over-all distribution for many different data sets. It seems to work well in\n\u003e situations where there is a high variance in the MSBs of the elements in a data set.\n\n\u003e ### DJB Hash Function\n\u003e An algorithm produced by Professor Daniel J. Bernstein and shown first to the world on the usenet\n\u003e newsgroup comp.lang.c. It is one of the most efficient hash functions ever published.\n\n\u003e ### DEK Hash Function\n\u003e An algorithm proposed by Donald E. Knuth in The Art Of Computer Programming Volume 3,\n\u003e under the topic of sorting and search chapter 6.4.\n\n\u003e ### AP Hash Function\n\u003e An algorithm produced by Arash Partow..\n\n\u003e ### BP Hash Function\n\u003e That code converts a (7-bit) ASCII string of at most (4 or 9) characters into a unique (32- or 64-)bit integer,\n\u003e depending on the platform.  If more characters are given, the first n-(5 or 10) characters are ignored,\n\u003e the low (4 or 1) bits of the next character are used, and the last (4 or 9) characters are used in full.\n\u003e The code does not use the length of the string, so leading null characters are ignored.\n\n\u003e ### FNV Hash Function\n\u003e The basis of the FNV hash algorithm was taken from an idea sent as reviewer comments to the IEEE\n\u003e POSIX P1003.2 committee by Glenn Fowler and Phong Vo back in 1991.\n\n\u003e ### MurmurHash3\n\u003e MurmurHash is a non-cryptographic hash function suitable for general hash-based lookup.It was created by Austin Appleby in 2008.It comes in 3 variants - a 32-bit version that targets low latency for hash table use and two 128-bit versions for generating unique identifiers for large blocks of data, one each for x86 and x64 platforms.\n\n## Install\n```\n$npm install node-hashes --save\n```\n\n## Usage\n```js\nvar hashes = require('node-hashes');\nvar ret = hashes.RSHash('foo');\n```\n\n```js\nvar hashes = require('node-hashes');\nvar seed = 32;\nvar ret = hashes.MurmurHash3_x86_128('foo', seed);\nfor (var i=0; i\u003cret.length; i++) {\n    console.info(ret[i]);\n}\n```\n\n## Benchmarks\n\n\u003e - RsHash(key) x 2,146,582 ops/sec ±0.36% (93 runs sampled)\n\u003e - JSHash(key) x 2,182,381 ops/sec ±0.35% (92 runs sampled)\n\u003e - PJWHash(key) x 1,926,879 ops/sec ±0.30% (93 runs sampled)\n\u003e - ELFHash(key) x 1,891,659 ops/sec ±0.38% (90 runs sampled)\n\u003e - BKDRHash(key) x 1,857,905 ops/sec ±0.64% (91 runs sampled)\n\u003e - ELFHash(key) x 1,894,290 ops/sec ±0.34% (89 runs sampled)\n\u003e - SDBMHash(key) x 1,912,925 ops/sec ±0.54% (90 runs sampled)\n\u003e - DJBHash(key) x 2,030,426 ops/sec ±0.23% (93 runs sampled)\n\u003e - DEKHash(key) x 1,913,679 ops/sec ±0.52% (92 runs sampled)\n\u003e - BPHash(key) x 1,970,864 ops/sec ±0.43% (91 runs sampled)\n\u003e - FNVHash(key) x 1,784,257 ops/sec ±0.51% (90 runs sampled)\n\u003e - APHash(key) x 1,780,209 ops/sec ±0.39% (92 runs sampled)\n\u003e - MurmurHash3_x86_32(key, 42) x 2,491,832 ops/sec ±0.42% (91 runs sampled)\n\u003e - MurmurHash3_x86_128(key, 42) x 580,621 ops/sec ±0.51% (91 runs sampled)\n\u003e - Fastest is MurmurHash3_x86_32(key, 42)\n\n## Functions\n\u003e - RSHash(key);\n\u003e - JSHash(key);\n\u003e - PJWHash(key);\n\u003e - ELFHash(key);\n\u003e - BKDRHash(key);\n\u003e - SDBMHash(key);\n\u003e - DEKHash(key);\n\u003e - BPHash(key);\n\u003e - FNVHash(key);\n\u003e - APHash(key);\n\u003e - MurmurHash3_x86_32(key [,seed]);\n\u003e - MurmurHash3_x86_128(key [,seed]);\n\n## People\n\n- [List of all contributors](https://github.com/liushoukai/node-hashes/graphs/contributors)\n\n## License\n\n[![GitHub license][license-image]][license-url]\n\n\n\n[node-image]: https://img.shields.io/badge/node.js-%3E=_0.11-brightgreen.svg?style=flat\n[node-url]: http://nodejs.org/download\n\n[npm-image]: https://img.shields.io/npm/v/node-hashes.svg\n[npm-url]: https://npmjs.org/package/node-hashes\n\n[downloads-image]: https://img.shields.io/npm/dm/node-hashes.svg\n[downloads-url]: https://npmjs.org/package/node-hashes\n\n[travis-image]: https://img.shields.io/travis/liushoukai/node-hashes/master.svg?label=linux\n[travis-url]: https://travis-ci.org/liushoukai/node-hashes\n\n[appveyor-image]: https://img.shields.io/appveyor/ci/liushoukai/node-hashes/master.svg?label=windows\n[appveyor-url]: https://ci.appveyor.com/project/liushoukai/node-hashes\n\n[coveralls-image]: https://img.shields.io/coveralls/liushoukai/node-hashes/master.svg\n[coveralls-url]: https://coveralls.io/r/liushoukai/node-hashes?branch=master\n\n[gratipay-image-liushoukai]: https://img.shields.io/gratipay/liushoukai.svg\n[gratipay-url-liushoukai]: https://gratipay.com/liushoukai/\n\n[license-image]: https://img.shields.io/badge/license-MIT-blue.svg\n[license-url]: https://raw.githubusercontent.com/liushoukai/node-hashes/master/LICENSE\n\n[codeclimate-image]:https://codeclimate.com/github/liushoukai/node-hashes/badges/gpa.svg\n[codeclimate-url]:https://codeclimate.com/github/liushoukai/node-hashes\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliushoukai%2Fnode-hashes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliushoukai%2Fnode-hashes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliushoukai%2Fnode-hashes/lists"}