{"id":13634918,"url":"https://github.com/dchest/blake2s-js","last_synced_at":"2025-08-08T01:25:32.848Z","repository":{"id":6139828,"uuid":"7368555","full_name":"dchest/blake2s-js","owner":"dchest","description":"BLAKE2s cryptographic hash function in JavaScript","archived":false,"fork":false,"pushed_at":"2019-10-29T14:39:53.000Z","size":140,"stargazers_count":86,"open_issues_count":0,"forks_count":15,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-07-17T12:16:18.484Z","etag":null,"topics":["blake2","blake2s","hash","javascript"],"latest_commit_sha":null,"homepage":"https://dchest.github.io/blake2s-js/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dchest.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}},"created_at":"2012-12-29T17:15:31.000Z","updated_at":"2024-02-10T18:28:48.000Z","dependencies_parsed_at":"2022-08-30T08:11:48.327Z","dependency_job_id":null,"html_url":"https://github.com/dchest/blake2s-js","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/dchest/blake2s-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fblake2s-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fblake2s-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fblake2s-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fblake2s-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dchest","download_url":"https://codeload.github.com/dchest/blake2s-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fblake2s-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266897218,"owners_count":24002642,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"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":["blake2","blake2s","hash","javascript"],"created_at":"2024-08-02T00:00:37.650Z","updated_at":"2025-07-24T20:03:01.835Z","avatar_url":"https://github.com/dchest.png","language":"JavaScript","readme":"BLAKE2s implementation in JavaScript\n====================================\n\nBLAKE2 is a fast and secure cryptographic hash function.\n\nThis is a pure JavaScript public domain implementation of its BLAKE2s flavor\n(currently without tree mode support).\n\n* [BLAKE2s-js Demo](https://dchest.github.io/blake2s-js/)\n* [BLAKE2 Website](https://blake2.net)\n\n[![Build Status](https://travis-ci.org/dchest/blake2s-js.svg?branch=master)\n](https://travis-ci.org/dchest/blake2s-js)\n\n**This implementation is maintained, but will not receive new features. If you're looking for a full implementation of BLAKE2s, BLAKE2Xs and BLAKE2b, see my packages from [StableLib](https://github.com/StableLib/stablelib): `@stablelib/blake2s`, `@stablelib/blake2xs`, and `@stablelib/blake2b`.**\n\nInstallation\n------------\n\nVia NPM:\n\n    $ npm install blake2s-js\n\nor just download `blake2s.min.js`.\n\n\nUsage\n-----\n\n### new BLAKE2s(digestLength, key)\n### new BLAKE2s(digestLength, config)\n\nCreates a new instance of BLAKE2s hash with the given length of digest (default\nand maximum 32) and an optional secret key (a `Uint8Array` or `Array` of\nbytes) or config object in the following format:\n\n    {\n        salt: // 8-byte Uint8Array or Array of bytes\n        personalization: // 8-byte Uint8Array or Array of bytes\n        key: // 0-32-byte Uint8Array or Array of bytes\n    }\n\nAll keys in config are optional.\n\n\n#### .update(data[, offset, length])\n\nUpdates the hash with data (a `Uint8Array` or `Array` of bytes).  starting at\nthe given `offset` (optional, defaults to 0) and consuming the given `length`\n(optional, defaults to the length of `data` minus `offset`).\n\nReturns this instance to enable method chaining.\n\n\n#### .digest()\n\nReturns a `Uint8Array` with the digest of consumed data. Further updates will\nthrow error. Repeat calls of `digest()` will return the same digest.\n\n\n#### .hexDigest()\n\nLike `digest()`, but returns a hex-encoded string.\n\n\n#### BLAKE2s.digestLength = 32\n\nMaximum digest length.\n\n\n#### BLAKE2s.blockLength = 64\n\nBlock size of the hash function.\n\n\n#### BLAKE2s.keyLength = 32\n\nMaximum key length.\n\n#### BLAKE2s.personalizationLength = 8\n\nLength of personalization parameter.\n\n#### BLAKE2s.saltLength = 8\n\nLength of salt parameter.\n\n\nExample\n-------\n\n```javascript\nvar h = new BLAKE2s(32);\nh.update(new Uint8Array([1,2,3]));\nh.hexDigest();  // returns string with hex digest\nh.digest();     // returns Uint8Array\n\n// Keyed:\nvar key = new Uint8Array(BLAKE2s.keyLength);\nwindow.crypto.getRandomValues(key);\nvar h = new BLAKE2s(32, key);\n...\n\n// Keyed and salted:\nvar key = new Uint8Array(BLAKE2s.keyLength);\nvar salt = new Uint8Array(BLAKE2s.saltLength);\nwindow.crypto.getRandomValues(key);\nwindow.crypto.getRandomValues(salt);\nvar h = new BLAKE2s(32, { key: key, salt: salt });\n...\n\n// Personalized:\nvar data = new Uint8Array([1, 2, 3]);\nvar pers1 = new Uint8Array([1, 0, 0, 0, 0, 0, 0, 0]);\nvar h1 = new BLAKE2s(32, { personalization: pers1 });\nh1.update(data);\n\nvar pers2 = new Uint8Array([2, 0, 0, 0, 0, 0, 0, 0]);\nvar h2 = new BLAKE2s(32, { personalization: pers2 });\nh2.update(data);\n\nh1.hexDigest() !== h2.hexDigest() // true\n\n```\n","funding_links":[],"categories":["crypto (加密)"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdchest%2Fblake2s-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdchest%2Fblake2s-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdchest%2Fblake2s-js/lists"}