{"id":20722493,"url":"https://github.com/toomanybees/sha1-wasm","last_synced_at":"2025-03-11T08:20:52.701Z","repository":{"id":74388696,"uuid":"179580019","full_name":"TooManyBees/sha1-wasm","owner":"TooManyBees","description":"SHA1 hash algorithm in webassembly","archived":false,"fork":false,"pushed_at":"2019-04-04T21:30:20.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T23:15:31.809Z","etag":null,"topics":[],"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/TooManyBees.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":"2019-04-04T21:29:48.000Z","updated_at":"2019-04-04T21:30:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"693fbeb3-6733-4b3b-8472-81ad53b17523","html_url":"https://github.com/TooManyBees/sha1-wasm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2Fsha1-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2Fsha1-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2Fsha1-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2Fsha1-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TooManyBees","download_url":"https://codeload.github.com/TooManyBees/sha1-wasm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242996885,"owners_count":20219036,"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":[],"created_at":"2024-11-17T03:36:05.456Z","updated_at":"2025-03-11T08:20:52.669Z","avatar_url":"https://github.com/TooManyBees.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sha1-wasm\n\nIt's the [Rust sha1 crate](https://crates.io/crates/sha1) compiled to WebAssembly\nand bundled into a Node module.\n\n## Usage\n\n### In Node.js\n\n```javascript\nconst digest = require('./sha1');\ndigest(\"Hi there!\"); // '95e2b07e12754e52c37cfd485544d4f444597bff'\n```\n\n### In web\n\nInstead of importing the root level of the package, import `'sha1/web'` which\nloads the module from an array literal. This uses triple the byte size, but then\nit's not intended to be the primary use case.\n\n```javascript\nconst sha1 = require('./sha1/web');\nsha1.then(digest =\u003e {\n  /* do your thing; I don't know how to load modules asynchronously,\n     and I'm glad I don't need to\n   */);\n```\n\n## Building\n\nYou need Rust nightly installed with the `wasm32-unknown-unknown` target.\n\n```bash\ncurl https://sh.rustup.rs -sSf | sh\n\nrustup toolchain install nightly\n\nrustup target add wasm32-unknown-unknown\n```\n\nYou also need `wasm-gc` installed.\n\n```bash\ncargo install wasm-gc\n```\n\nFrom the project root, run the shell script `rust2wasm.sh`. This will compile\nthe Rust code and bundle the resulting WebAssembly into JavaScript files.\n\nAt this point, the `.js` files in `dist` can be copied by themselves into a\nproject, or bundled into a package.\n\n## Benchmark\n\nThis module is in general 3x faster than the all-JavaScript `sha1` package on npm,\nand the gap increases with the length of the source bytes. To run the benchmark,\n`node benchmark.js` from the `benchmark` folder.\n\n```\n$ node benchmark.js\nTest string is 107 chars long\npure js x 136,241 ops/sec ±0.82% (89 runs sampled)\nnode crypto x 407,798 ops/sec ±6.95% (71 runs sampled)\nrust/wasm x 497,166 ops/sec ±0.70% (90 runs sampled)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoomanybees%2Fsha1-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoomanybees%2Fsha1-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoomanybees%2Fsha1-wasm/lists"}