{"id":22356331,"url":"https://github.com/do-/node-pwd-shaker","last_synced_at":"2026-01-05T21:47:46.179Z","repository":{"id":250464085,"uuid":"833507924","full_name":"do-/node-pwd-shaker","owner":"do-","description":"password hashing with salt, pepper","archived":false,"fork":false,"pushed_at":"2024-07-27T16:50:34.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T05:28:37.963Z","etag":null,"topics":["hash","nodejs","password","pepper","salt"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/do-.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":"2024-07-25T07:41:43.000Z","updated_at":"2024-09-26T08:42:01.000Z","dependencies_parsed_at":"2024-07-27T17:16:46.219Z","dependency_job_id":null,"html_url":"https://github.com/do-/node-pwd-shaker","commit_stats":null,"previous_names":["do-/node-pwd-shaker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-%2Fnode-pwd-shaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-%2Fnode-pwd-shaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-%2Fnode-pwd-shaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-%2Fnode-pwd-shaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/do-","download_url":"https://codeload.github.com/do-/node-pwd-shaker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245437090,"owners_count":20615209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","nodejs","password","pepper","salt"],"created_at":"2024-12-04T14:09:55.813Z","updated_at":"2026-01-05T21:47:41.159Z","avatar_url":"https://github.com/do-.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![workflow](https://github.com/do-/node-pwd-shaker/actions/workflows/main.yml/badge.svg)\n![Jest coverage](./badges/coverage-jest%20coverage.svg)\n\n`pwd-shaker` is a node.js library simpifying some routine tasks related to one-way password encryption (hash computing).\n\nIt is totally based on the standard [crypto](https://nodejs.org/api/crypto.html) module and use no external dependencies.\n\nAs the basic feature here is to apply so called [_salt_](https://en.wikipedia.org/wiki/Salt_(cryptography)) and [_pepper_](https://en.wikipedia.org/wiki/Pepper_(cryptography)), it's named after the related [condiment dispensers](https://en.wikipedia.org/wiki/Salt_and_pepper_shakers).\n\nThe library features two classes:\n* [PasswordShaker](https://github.com/do-/node-pwd-shaker/wiki/PasswordShaker) implementing basic functionality;\n* [PasswordShakerFile](https://github.com/do-/node-pwd-shaker/wiki/PasswordShakerFile), the derived class with `pepper` kept in a file instead of RAM.\n\n# Installation\n```sh\nnpm install pwd-shaker\n```\n# Usage\n```js\nconst {PasswordShakerFile} = require ('pwd-shaker')\n\nconst shaker = new PasswordShakerFile ({\n  path         : '/etc/this_information_system/secret_pepper',\n  // order     : ['pepper', 'salt', 'pwd'],\n  // algorithm : 'sha256',\n  // encoding  : 'hex',\n})\n\nconst {login, pwd} = //...available from input\nconst salt = shaker.sprinkle (32)\nconst hash = shaker.cook (pwd, salt)\n// store login+hash+salt instead of login+pwd\n\n//...then...\n\nconst {login, pwd} = //...available from input\nconst {hash, salt} = //...fetch by login\nif (shaker.test (hash, pwd, salt)) {\n  // auth OK\n}\nelse {\n  // kick out\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo-%2Fnode-pwd-shaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdo-%2Fnode-pwd-shaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo-%2Fnode-pwd-shaker/lists"}