{"id":21947715,"url":"https://github.com/valpackett/argon2ian","last_synced_at":"2026-01-21T03:02:40.772Z","repository":{"id":176444535,"uuid":"657865832","full_name":"valpackett/argon2ian","owner":"valpackett","description":"Very compact Argon2 in WASM - mirror of https://codeberg.org/valpackett/argon2ian","archived":false,"fork":false,"pushed_at":"2024-07-26T08:24:20.000Z","size":60,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"trunk","last_synced_at":"2025-09-28T04:15:29.558Z","etag":null,"topics":["argon2","deno","deno-module","password-hash","typescript","typescript-library","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://jsr.io/@valpackett/argon2ian","language":"TypeScript","has_issues":false,"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/valpackett.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"patreon":"valpackett"}},"created_at":"2023-06-24T04:00:10.000Z","updated_at":"2025-01-17T04:28:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"6d616f6a-d522-4a2f-aa06-b7973192312c","html_url":"https://github.com/valpackett/argon2ian","commit_stats":null,"previous_names":["valpackett/argon2ian"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/valpackett/argon2ian","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fargon2ian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fargon2ian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fargon2ian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fargon2ian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valpackett","download_url":"https://codeload.github.com/valpackett/argon2ian/tar.gz/refs/heads/trunk","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fargon2ian/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28624341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["argon2","deno","deno-module","password-hash","typescript","typescript-library","wasm","webassembly"],"created_at":"2024-11-29T05:09:22.170Z","updated_at":"2026-01-21T03:02:40.757Z","avatar_url":"https://github.com/valpackett.png","language":"TypeScript","funding_links":["https://patreon.com/valpackett","https://img.shields.io/badge/dynamic/json?logo=patreon\u0026color=%23e85b46\u0026label=support%20me%20on%20patreon\u0026query=data.attributes.patron_count\u0026suffix=%20patrons\u0026url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F9395291","https://www.patreon.com/valpackett"],"categories":[],"sub_categories":[],"readme":"# argon2ian [![Support me on Patreon](https://img.shields.io/badge/dynamic/json?logo=patreon\u0026color=%23e85b46\u0026label=support%20me%20on%20patreon\u0026query=data.attributes.patron_count\u0026suffix=%20patrons\u0026url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F9395291)](https://www.patreon.com/valpackett)\n\nA *seriously size-optimized* WebAssembly build + conveniently async-ified TypeScript wrapper\nfor [Monocypher's implementation](https://monocypher.org/manual/argon2)\nof the Argon2 password hash / KDF, the winner of the Password Hashing Competition.\n\n| File                | Size in bytes |\n| ------------------- | ------------- |\n| Raw WASM            | 7145          |\n| WASM gzipped        | 3129          |\n| WASM gzipped base64 | 4172          |\n| With sync wrapper   | 5839          |\n| With async wrapper  | 6393          |\n\n- No emscripten in the build! Built with raw clang using [wasi-libc](https://github.com/WebAssembly/wasi-libc) for basic headers / compiler-rt\n- Using a simple arena allocator\n- Both `key` (called `secret`) and `ad` options are exposed for advanced usage\n- No `$argon2…` encoded strings support as of right now, as my primary use case is key derivation\n  - TODO: implement in typescript using [this constant-time base64 impl](https://github.com/StableLib/stablelib/blob/master/packages/base64/base64.ts) I guess\n- The `WebAssembly.Instance` is thrown away on every invocation to avoid occupying RAM when not working\n  - Before that, secrets are wiped from that memory (not that they won't remain all over everywhere on the JS side lol)\n- Native `DecompressionStream` used for decompressing the module ([caniuse](https://caniuse.com/mdn-api_compressionstream); WARN: arrived *very* recently in Firefox and Safari as of mid 2023)\n- Async wrapper based on Web Workers but completely bundle-able / deno-cache-able, no separate worker files because everything is inlined!\n- The sync version exposes the non-keyed blake2b hash function as well, because it's basically free (only added 20 bytes to encoded wasm)\n\nNote: the 1.x version were based on the reference implementation and therefore support version 0x10 and perform a tiny bit better\n(e.g. 393 → 372 ms/iter for argon2id with 256MiB) at the cost of extra ~2.2KiB size, not exposing blake2b, and not supporting the `p` (lanes) parameter\n(that one was just my fault, not the reference implementation's).\n\n## Usage\n\n### Async (powered by Web Workers)\n\nIt's typically not a great idea to block the main thread, whether in a client-side app in a browser or in a server app.\nArgon2ian provides an async API that hides all the messiness of Web Workers.\n\n```typescript\nimport { ArgonWorker, variant } from 'https://deno.land/x/argon2ian/dist/argon2ian.async.min.js'; // bundled\n// import { ArgonWorker, variant } from 'jsr:@valpackett/argon2ian/async'; // ← JSR/Deno\n\nimport { decode } from 'https://deno.land/std@0.192.0/encoding/hex.ts'; // just for the demo here\n\nconst wrk = new ArgonWorker();\nconst enco = new TextEncoder();\n\nawait wrk.ready;\n\nconst hash = await wrk.hash(enco.encode('password'), enco.encode('somesalt'),\n  { t: 2, variant: variant.Argon2i }); // -\u003e Uint8Array\n\nconst isCorrect = await wrk.verify(enco.encode('password'), enco.encode('somesalt'),\n  decode(enco.encode('c1628832147d9720c5bd1cfd61367078729f6dfb6f8fea9ff98158e0d7816ed0')),\n  { t: 2, variant: variant.Argon2i }); // -\u003e boolean\n\nconsole.log(hash, isCorrect);\nwrk.terminate(); // e.g. once you're done with it in a browser,\n// in a server just keep the worker running forever of course\n```\n\n### Blocking\n\nIn some scenarios like with many CLI apps there wouldn't be any benefit from the asynchornicity,\nor if you're already doing your own Web Worker with your own logic, etc…\n\n```typescript\nimport { hash, variant, verify } from 'https://deno.land/x/argon2ian/dist/argon2ian.sync.min.js'; // bundled\n// import { hash, variant, verify } from 'jsr:@valpackett/argon2ian/sync'; // ← JSR/Deno\n\nimport { decode } from 'https://deno.land/std@0.192.0/encoding/hex.ts'; // just for the demo here\n\nconst enco = new TextEncoder();\n\nconst hsh = hash(enco.encode('password'), enco.encode('somesalt'),\n  { t: 2, variant: variant.Argon2i }); // -\u003e Uint8Array\n\nconst isCorrect = verify(enco.encode('password'), enco.encode('somesalt'),\n  decode(enco.encode('c1628832147d9720c5bd1cfd61367078729f6dfb6f8fea9ff98158e0d7816ed0')),\n  { t: 2, variant: variant.Argon2i }); // -\u003e boolean\n\nconsole.log(hsh, isCorrect);\n```\n\n## License\n\nLike Monocypher, argon2ian is available under CC0 or 2-clause BSD.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalpackett%2Fargon2ian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalpackett%2Fargon2ian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalpackett%2Fargon2ian/lists"}