{"id":15992137,"url":"https://github.com/antonlydike/scrypt-webworker","last_synced_at":"2026-07-11T05:31:24.223Z","repository":{"id":133508526,"uuid":"79656057","full_name":"AntonLydike/scrypt-webworker","owner":"AntonLydike","description":"Making Scrypt run inside a WebWorker to keep the front-end fluid!","archived":false,"fork":false,"pushed_at":"2017-01-25T10:57:01.000Z","size":443,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T23:26:18.009Z","etag":null,"topics":["hashing","js-scrypt","scrypt","security","web-worker"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AntonLydike.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-01-21T16:05:05.000Z","updated_at":"2019-01-04T11:57:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5d7ca18-7f2a-404b-bc21-c7d84f34017f","html_url":"https://github.com/AntonLydike/scrypt-webworker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/AntonLydike/scrypt-webworker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Fscrypt-webworker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Fscrypt-webworker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Fscrypt-webworker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Fscrypt-webworker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AntonLydike","download_url":"https://codeload.github.com/AntonLydike/scrypt-webworker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonLydike%2Fscrypt-webworker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35352623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["hashing","js-scrypt","scrypt","security","web-worker"],"created_at":"2024-10-08T06:05:37.853Z","updated_at":"2026-07-11T05:31:24.218Z","avatar_url":"https://github.com/AntonLydike.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The WebWorker based Scrypt project\n\nScrypt implementation as webworkers. This uses promises and other Es6 features so I'll have to put it through babel before it can be used for more than very small homebrewed projects...\n\n## what each file is for:\n\n - `scrypt.js` the js-scrypt library. Taken from [tonyg/js-scrypt](https://github.com/tonyg/js-scrypt)\n - `scrypt.wrapper.js` a wrapper to initiate scrypt with each parameters, test it and communicate errors\n - `lodash.min.js` lodash library minified\n - `scrypt.worker.js` code that adds workerAPI and worker methods. This file contains all build instructions and can be built with `enary build -w scrypt.worker.js`\n - `scrypt.worker.build.js` a completely built version of this project. This is the webworker file\n - `scrypt.worker.wrapper.js` The file loaded in the browser. Contains all the code to create new Workers.\n\n### Structure of `scrypt.worker.js`\n\n```` js\n// @build add scrypt.js\n// @build add scrypt.wrapper.js\n// @build add lodash.min.js\n````\n\nThis part imports Scrypt, then my Scrypt wrapper and then the lodash library.\n\n```` js\n(function (self) {\n\t// ...\n}(self))\n````\n\nThis is a self-made webworker helper to easily register actions for a webworker.\n\n```` js\nself.addAction('init', function (settings) {\n\tinitScrypt(settings, this);\n}, ['n', 'r', 'p', 'l'], {doTest: false})\n\nself.addAction('hash', function ({passw, salt}) {\n\tif (Scrypt === undefined) {\n\t\treturn this.error('SCRYPT:MISSING_INIT', 'Did you forgot to call init?');\n\t}\n\n\tthis.return(Scrypt.hash(passw, salt));\n}, ['passw', 'salt'])\n````\n\nThis part registers the init function and the hash method.\n\nYou can pass `doTest:true` in the settings to `createScryptWorker(settings, workerUrl)` in order to perform an initial test run to verify that enough RAM is available etc...\n\n## Setup\n\n 1. Copy `scrypt.worker.build.js` someplace accessible on your page. Don't include it via `\u003cscript src=\"url...\"\u003e`\n 2. Copy `scrypt.worker.wrapper.js` to your project and include it via `script` tag.\n \n\n## Usage\n\n### Create new worker\n\ncreate a new worker like this:\n\n```` js\ncreateScryptWorker({\n\tp: 1, \n\tr: 8, \n\tn: 16384, \n\tl: 32\n}, '/path/to/scrypt.worker.build.js'\n).then((worker) =\u003e {\n\twindow.Scrypt = worker;\n})\n````\n\n### Use a worker to calculate a hash\n\n```` js\nScrypt.hash(\"passw\", \"salt\").then((Ui8Hash) =\u003e {\n\t// hash is a Uint8Array containing the hash value\n\tlet HexHash = HexFromUi8(Ui8Hash);\n})\n\n// HexFromUi8 method:\nfunction HexFromUi8 (Ui8Start) {\n    for (var hex = [], i = 0; i \u003c Ui8Start.length; i++) {\n        hex.push((Ui8Start[i] \u003e\u003e\u003e 4).toString(16));\n        hex.push((Ui8Start[i] \u0026 0xF).toString(16));\n    }\n    return hex.join(\"\");\n}\n````\n## Demo\n\nYou can see the demo code working [here](https://rawgit.com/AntonLydike/scrypt-webworker/master/demo/index.html).\n\n## License\n\n\njs-scrypt is written by Tony Garnock-Jones\n\u003ctonygarnockjones@gmail.com\u003e and is licensed under the [2-clause BSD license](http://opensource.org/licenses/BSD-2-Clause):\n\n\u003e Copyright \u0026copy; 2013\u0026ndash;2016, Tony Garnock-Jones\n\u003e All rights reserved.\n\u003e\n\u003e Redistribution and use in source and binary forms, with or without\n\u003e modification, are permitted provided that the following conditions\n\u003e are met:\n\u003e\n\u003e 1. Redistributions of source code must retain the above copyright\n\u003e    notice, this list of conditions and the following disclaimer.\n\u003e\n\u003e 2. Redistributions in binary form must reproduce the above copyright\n\u003e    notice, this list of conditions and the following disclaimer in\n\u003e    the documentation and/or other materials provided with the\n\u003e    distribution.\n\u003e\n\u003e THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\u003e \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\u003e LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n\u003e FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\u003e COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n\u003e INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\u003e BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\u003e LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\u003e CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\u003e LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n\u003e ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\u003e POSSIBILITY OF SUCH DAMAGE.\n\njs-scrypt relies on `scrypt` itself, which is written by Colin\nPercival and licensed as follows:\n\n\u003e Copyright 2009 Colin Percival\n\u003e All rights reserved.\n\u003e\n\u003e Redistribution and use in source and binary forms, with or without\n\u003e modification, are permitted provided that the following conditions\n\u003e are met:\n\u003e\n\u003e 1. Redistributions of source code must retain the above copyright\n\u003e    notice, this list of conditions and the following disclaimer.\n\u003e 2. Redistributions in binary form must reproduce the above copyright\n\u003e    notice, this list of conditions and the following disclaimer in the\n\u003e    documentation and/or other materials provided with the distribution.\n\u003e\n\u003e THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n\u003e ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\u003e IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n\u003e ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n\u003e FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\u003e DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n\u003e OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n\u003e HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\u003e LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n\u003e OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n\u003e SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonlydike%2Fscrypt-webworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonlydike%2Fscrypt-webworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonlydike%2Fscrypt-webworker/lists"}