{"id":28306876,"url":"https://github.com/ashu11-a/ashcrypt","last_synced_at":"2026-04-24T12:06:56.499Z","repository":{"id":231948319,"uuid":"783102336","full_name":"Ashu11-A/AshCrypt","owner":"Ashu11-A","description":"Files protected with encryption","archived":false,"fork":false,"pushed_at":"2025-04-21T10:21:34.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-11T10:12:07.624Z","etag":null,"topics":["aes","aes-256","aes-cipher","aes-encryption","aes-gcm","asynchronous-crypto","buffer","crypto","crypto-library","crypto-tools","cryptography","encryption","gcm","node-aes","node-crypto","nodejs","pbkdf2","stream-encryption","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ashcrypt","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/Ashu11-A.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,"zenodo":null}},"created_at":"2024-04-07T00:16:54.000Z","updated_at":"2025-04-21T10:28:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"0eb8a6c4-49d9-4de7-b018-2205646f2e1d","html_url":"https://github.com/Ashu11-A/AshCrypt","commit_stats":null,"previous_names":["ashu11-a/fpe","ashu11-a/ashcrypt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ashu11-A/AshCrypt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashu11-A%2FAshCrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashu11-A%2FAshCrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashu11-A%2FAshCrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashu11-A%2FAshCrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ashu11-A","download_url":"https://codeload.github.com/Ashu11-A/AshCrypt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashu11-A%2FAshCrypt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32222531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T10:26:35.452Z","status":"ssl_error","status_checked_at":"2026-04-24T10:25:27.643Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["aes","aes-256","aes-cipher","aes-encryption","aes-gcm","asynchronous-crypto","buffer","crypto","crypto-library","crypto-tools","cryptography","encryption","gcm","node-aes","node-crypto","nodejs","pbkdf2","stream-encryption","typescript"],"created_at":"2025-05-24T04:12:52.774Z","updated_at":"2026-04-24T12:06:56.495Z","avatar_url":"https://github.com/Ashu11-A.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# AshCrypt\n\n![license-info](https://img.shields.io/github/license/Ashu11-A/AshCrypt?style=for-the-badge\u0026colorA=302D41\u0026colorB=f9e2af\u0026logoColor=f9e2af)\n![stars-infoa](https://img.shields.io/github/stars/Ashu11-A/AshCrypt?colorA=302D41\u0026colorB=f9e2af\u0026style=for-the-badge)\n\n![Last-Comitt](https://img.shields.io/github/last-commit/Ashu11-A/AshCrypt?style=for-the-badge\u0026colorA=302D41\u0026colorB=b4befe)\n![Comitts Year](https://img.shields.io/github/commit-activity/y/Ashu11-A/AshCrypt?style=for-the-badge\u0026colorA=302D41\u0026colorB=f9e2af)\n![reposize-info](https://img.shields.io/github/languages/code-size/Ashu11-A/AshCrypt?style=for-the-badge\u0026colorA=302D41\u0026colorB=90dceb)\n\n![SourceForge Languages](https://img.shields.io/github/languages/top/Ashu11-A/AshCrypt?style=for-the-badge\u0026colorA=302D41\u0026colorB=90dceb)\n![npm package minimized gzipped size](https://img.shields.io/bundlejs/size/AshCrypt?style=for-the-badge\u0026colorA=302D41\u0026colorB=3ac97b)\n\n\u003c/div\u003e\n\n---\n\n## 📃 Description\n\n**AshCrypt** is a modular and efficient encryption library for handling large files using the **AES-GCM** encryption algorithm. It provides chunked encryption and decryption support using streams for memory-efficient processing, suitable for secure file handling and transmission.\n\nThe library divides files into configurable chunks (default 512 KB), encrypts each chunk separately, and appends essential metadata (salt, IV, tag) to each chunk.\n\n---\n\n## ⚙️ Features\n\n- 🔐 AES-GCM encryption (128, 192, or 256-bit)\n- 🧩 Configurable chunk size (default: 512KB)\n- 📁 Stream-based I/O for large files\n- 🔄 Parallel processing support for better performance\n- 📦 Easy integration and usage via typed API\n\n---\n\n## 🚀 Installation\n\n```bash\nnpm install ashcrypt\n```\n\n---\n\n## 🧠 Usage\n\n```ts\nimport { AES, Stream } from 'ashcrypt';\n\nconst aes = new AES({ secret: 'my-very-secure-password' });\nconst stream = new Stream({ algorithm: aes });\n\n// Encrypting a file\nstream.read('input.txt', 'encrypt')\n  .pipe(stream.write('output.enc'))\n  .on('finish', () =\u003e {\n\n    // Decrypting a file\n    stream.read('output.enc', 'decrypt')\n      .pipe(stream.write('decrypted.txt'));\n  })\n\n```\n\n---\n\n## 🔐 Class: `AES`\n\nHandles key derivation and encryption/decryption of buffers.\n\n### Constructor\n\n```ts\nnew AES({ secret, chunkSize, algorithm, iterations });\n```\n\n- `secret`: Password or passphrase\n- `chunkSize`: (Optional): Default: 512 * 1000 (512KB)\n- `algorithm`: (Optional): Default: 'aes-256-gcm'\n- `iterations`: (Optional): Default: 100000 (PBKDF2 iterations)\n\n### `getKey(salt: Buffer): Promise\u003cBuffer\u003e`\nDerives a key from the given salt using PBKDF2.\n\n### `getChunkSize(baseChunkSize: number): number`\nReturns the final size of a chunk after encryption (includes metadata).\n\n### `encrypt(buffer: Buffer): Promise\u003cBuffer\u003e`\nEncrypts a single chunk. Appends `salt + iv + tag` to encrypted content.\n\n### `decrypt(buffer: Buffer): Promise\u003cBuffer\u003e`\nDecrypts a previously encrypted chunk. Extracts and uses the appended metadata.\n\n---\n\n## 📄 Class: `Stream\u003cAlgorithm\u003e`\n\nProvides stream-based encryption/decryption for large files.\n\n### Constructor\n\n```ts\nnew Stream({ algorithm, maxParallel });\n```\n\n- `algorithm`: Instance of AES (or compatible)\n- `maxParallel` (optional): Number of parallel chunks to process (default: 1)\n\n### `create(type: \"encrypt\" | \"decrypt\"): Transform`\nCreates a transform stream for encryption or decryption.\n\n### `read(path: string, type: \"encrypt\" | \"decrypt\"): Transform`\nReturns a read stream piped through transformation (encryption/decryption).\n\n### `write(path: string): WriteStream`\nReturns a write stream to save the final output.\n\n---\n\n## 📦 Chunk Format\n\nEach chunk is encoded as:\n\n```plaintext\n[salt (16–32B)][IV (12B)][Auth Tag (16B)][Encrypted Data]\n```\n\n- **Salt**: Random bytes used for PBKDF2\n- **IV**: Initialization vector\n- **Auth Tag**: AES-GCM tag for integrity\n- **Encrypted Data**: Ciphertext of the original chunk\n\n---\n\n## 📜 License\n\nLicensed under the MIT License. See [LICENSE](./LICENSE) for details.\n\n---\n\n\u003cdiv align=\"center\"\u003e\nMade by Matheus Nilton Biolowons\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashu11-a%2Fashcrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashu11-a%2Fashcrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashu11-a%2Fashcrypt/lists"}