{"id":18240748,"url":"https://github.com/kawanet/sha1-uint8array","last_synced_at":"2025-07-03T21:42:31.777Z","repository":{"id":47775726,"uuid":"324197486","full_name":"kawanet/sha1-uint8array","owner":"kawanet","description":"Fast SHA-1 digest hash based on Uint8Array, pure JavaScript.","archived":false,"fork":false,"pushed_at":"2023-08-21T16:50:51.000Z","size":108,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T23:46:49.456Z","etag":null,"topics":["digest","hash","javascript","sha-1","sha1","typedarray","uint8array"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sha1-uint8array","language":"TypeScript","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/kawanet.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":"2020-12-24T16:37:38.000Z","updated_at":"2025-04-29T02:15:17.000Z","dependencies_parsed_at":"2024-06-19T20:14:09.265Z","dependency_job_id":null,"html_url":"https://github.com/kawanet/sha1-uint8array","commit_stats":{"total_commits":68,"total_committers":1,"mean_commits":68.0,"dds":0.0,"last_synced_commit":"01e525178481f0d801eb2a5892e7af19323b27d8"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kawanet/sha1-uint8array","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kawanet%2Fsha1-uint8array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kawanet%2Fsha1-uint8array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kawanet%2Fsha1-uint8array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kawanet%2Fsha1-uint8array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kawanet","download_url":"https://codeload.github.com/kawanet/sha1-uint8array/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kawanet%2Fsha1-uint8array/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263221766,"owners_count":23432996,"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":["digest","hash","javascript","sha-1","sha1","typedarray","uint8array"],"created_at":"2024-11-05T05:04:53.886Z","updated_at":"2025-07-03T21:42:31.746Z","avatar_url":"https://github.com/kawanet.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sha1-uint8array\n\n[![Node.js CI](https://github.com/kawanet/sha1-uint8array/workflows/Node.js%20CI/badge.svg?branch=main)](https://github.com/kawanet/sha1-uint8array/actions/)\n[![npm version](https://img.shields.io/npm/v/sha1-uint8array)](https://www.npmjs.com/package/sha1-uint8array)\n[![minified size](https://img.shields.io/bundlephobia/min/sha1-uint8array)](https://cdn.jsdelivr.net/npm/sha1-uint8array/dist/sha1-uint8array.min.js)\n\nFast SHA-1 digest hash based on Uint8Array, pure JavaScript.\n\n## SYNOPSIS\n\n```js\nimport {createHash} from \"sha1-uint8array\";\n\nconst text = \"\";\nconst hex = createHash().update(text).digest(\"hex\");\n// =\u003e \"da39a3ee5e6b4b0d3255bfef95601890afd80709\"\n\nconst data = new Uint8Array(0);\nconst hash = createHash().update(data).digest();\n// =\u003e \u003cUint8Array da 39 a3 ee 5e 6b 4b 0d 32 55 bf ef 95 60 18 90 af d8 07 09\u003e\n```\n\nSee TypeScript declaration\n[sha1-uint8array.d.ts](https://github.com/kawanet/sha1-uint8array/blob/main/types/sha1-uint8array.d.ts)\nfor detail.\n\n## COMMONJS\n\nBoth ES Modules and CommonJS supported.\n\n```js\nconst {createHash} = require(\"sha1-uint8array\");\n```\n\n## COMPATIBILITY\n\nIt has a better compatibility with Node.js's `crypto` module in its smaller footprint.\n\n|module|string IN|Uint8Array IN|TypedArray IN|hex OUT|Uint8Array OUT|minified|\n|---|---|---|---|---|---|---|\n|[crypto](https://nodejs.org/api/crypto.html)|✅ OK|✅ OK|✅ OK|✅ OK|✅ OK|-|\n|[sha1-uint8array](http://github.com/kawanet/sha1-uint8array)|✅ OK|✅ OK|✅ OK|✅ OK|✅ OK|3KB|\n|[hash.js](https://www.npmjs.com/package/hash.js)|✅ OK|✅ OK|🚫 NO|✅ OK|✅ OK|17KB|\n|[jssha](https://npmjs.com/package/jssha)|✅ OK|✅ OK|🚫 NO|✅ OK|✅ OK|10KB|\n|[crypto-js](https://npmjs.com/package/crypto-js)|✅ OK|🚫 NO|🚫 NO|✅ OK|🚫 NO|109KB|\n|[jshashes](https://npmjs.com/package/jshashes)|✅ OK|🚫 NO|🚫 NO|✅ OK|🚫 NO|23KB|\n|[sha.js](https://npmjs.com/package/sha.js)|✅ OK|✅ OK|🚫 NO|✅ OK|✅ OK|26KB|\n|[create-hash](https://npmjs.com/package/create-hash)|✅ OK|✅ OK|🚫 NO|✅ OK|✅ OK|95KB|\n|[tiny-sha1](https://npmjs.com/package/tiny-sha1)|🚫 NO|✅ OK|🚫 NO|✅ OK|🚫 NO|2KB|\n|[crypto.subtle.digest()](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest)|🚫 NO|✅ OK|✅ OK|🚫 NO|🚫 NO|-|\n\nThe W3C standard `crypto.subtle.digest()` API has a different interface which\n[returns](https://github.com/microsoft/TypeScript/blob/master/lib/lib.dom.d.ts)\n`Promise\u003cArrayBuffer\u003e`.\n\n## SPEED\n\nIt runs well both on Node.js and browsers.\nNode.js's native `crypto` module definitely runs faster than any others on Node.js, though.\n\n|module|version|node.js V14|Chrome 87|Safari 14|\n|---|---|---|---|---|\n|[crypto](https://nodejs.org/api/crypto.html)|-|69ms 👍|N/A|N/A|\n|[sha1-uint8array](http://github.com/kawanet/sha1-uint8array)|0.10.0|251ms|352ms 👍|202ms 👍|\n|[hash.js](https://www.npmjs.com/package/hash.js)|1.1.7|500ms|619ms|882ms|\n|[jssha](https://npmjs.com/package/jssha)|3.2.0|720ms|799ms|747ms|\n|[crypto-js](https://npmjs.com/package/crypto-js)|4.0.0|765ms|842ms|991ms|\n|[jshashes](https://npmjs.com/package/jshashes)|1.0.8|674ms|1,498ms|721ms|\n|[sha.js](https://npmjs.com/package/sha.js)|2.4.11|361ms|964ms|3,487ms|\n\nThe benchmark above shows milliseconds for 20,000 times of\nSHA-1 `hex` hash digest generation for approx 1KB string as input.\nIt is tested on macOS 10.15.7 Intel Core i7 3.2GHz.\nYou could run the benchmark as below.\n\n```sh\ngit clone https://github.com/kawanet/sha1-uint8array.git\ncd sha1-uint8array\nnpm install\nnpm run build\n\n# run the benchmark on Node.js\nREPEAT=10000 ./node_modules/.bin/mocha test/99.benchmark.js\n\n# run tests and the benchmark on browser\nmake -C browser\nopen browser/test.html\n```\n\n## WEB BROWSERS\n\n- The minified build of the library is also available for Web browsers via\n[jsDelivr CDN](https://www.jsdelivr.com/package/npm/sha1-uint8array).\n- https://cdn.jsdelivr.net/npm/sha1-uint8array/dist/sha1-uint8array.min.js\n- Live Demo https://kawanet.github.io/sha1-uint8array/\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/sha1-uint8array/dist/sha1-uint8array.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    const text = \"\";\n    const hex = SHA1.createHash().update(text).digest(\"hex\");\n    // =\u003e \"da39a3ee5e6b4b0d3255bfef95601890afd80709\"\n    \n    const data = new Uint8Array(0);\n    const hash = SHA1.createHash().update(data).digest();\n    // =\u003e \u003cUint8Array da 39 a3 ee 5e 6b 4b 0d 32 55 bf ef 95 60 18 90 af d8 07 09\u003e\n\u003c/script\u003e\n```\n\n## BROWSERIFY\n\nIt works great with\n[browserify](https://www.npmjs.com/package/browserify)\nvia `browser` property of `package.json` of your app if you needs\n`crypto.createHash(\"sha1\").update(data).digest(\"hex\");` syntax only.\n\n```json\n{\n  \"browser\": {\n    \"crypto\": \"sha1-uint8array/dist/sha1-uint8array.min.js\"\n  },\n  \"devDependencies\": {\n    \"browserify\": \"^17.0.0\",\n    \"sha1-uint8array\": \"^0.10.0\"\n  }\n}\n```\n\nIt costs only less than 3KB, whereas `browserify`'s default `crypto` polyfill\ncosts more than 300KB huge even after minified.\n\n```js\n// On Node.js, this loads Node.js's native crypto module which is faster.\n// On browsers, this uses sha1-uint8array.min.js which is small and fast.\nconst crypto = require(\"crypto\");\n\nconst hash = crypto.createHash(\"sha1\").update(\"\").digest(\"hex\");\n// =\u003e \"da39a3ee5e6b4b0d3255bfef95601890afd80709\"\n```\n\n## LINKS\n\n- https://www.npmjs.com/package/sha1-uint8array\n- https://www.npmjs.com/package/sha256-uint8array\n- https://github.com/kawanet/sha1-uint8array\n- https://github.com/kawanet/sha1-uint8array/blob/main/types/sha1-uint8array.d.ts\n\n## MIT LICENSE\n\nCopyright (c) 2020-2023 Yusuke Kawasaki\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\nSoftware.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkawanet%2Fsha1-uint8array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkawanet%2Fsha1-uint8array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkawanet%2Fsha1-uint8array/lists"}