{"id":21905369,"url":"https://github.com/hex7c0/arc4","last_synced_at":"2025-09-04T18:09:11.359Z","repository":{"id":18076561,"uuid":"21139361","full_name":"hex7c0/arc4","owner":"hex7c0","description":"rc4 stream cipher for Nodejs","archived":false,"fork":false,"pushed_at":"2023-04-04T10:05:29.000Z","size":402,"stargazers_count":7,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-24T07:33:09.423Z","etag":null,"topics":["cipher","nodejs","rc4"],"latest_commit_sha":null,"homepage":"https://github.com/hex7c0/arc4","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hex7c0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-06-23T19:29:23.000Z","updated_at":"2023-04-05T02:59:01.000Z","dependencies_parsed_at":"2024-06-18T21:14:54.594Z","dependency_job_id":"b0fa10e7-56ac-40ea-8361-be158e8077b2","html_url":"https://github.com/hex7c0/arc4","commit_stats":{"total_commits":191,"total_committers":4,"mean_commits":47.75,"dds":"0.015706806282722474","last_synced_commit":"9c7164ab44b4bc8e6123fbadc4a7f4a979509e7c"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Farc4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Farc4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Farc4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Farc4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hex7c0","download_url":"https://codeload.github.com/hex7c0/arc4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226950523,"owners_count":17708241,"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":["cipher","nodejs","rc4"],"created_at":"2024-11-28T16:33:04.117Z","updated_at":"2024-11-28T16:33:04.931Z","avatar_url":"https://github.com/hex7c0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [arc4](https://github.com/hex7c0/arc4)\n\n[![NPM version](https://img.shields.io/npm/v/arc4.svg)](https://www.npmjs.com/package/arc4)\n[![Linux Status](https://img.shields.io/travis/hex7c0/arc4.svg?label=linux-osx)](https://travis-ci.org/hex7c0/arc4)\n[![Windows Status](https://img.shields.io/appveyor/ci/hex7c0/arc4.svg?label=windows)](https://ci.appveyor.com/project/hex7c0/arc4)\n[![Dependency Status](https://img.shields.io/david/hex7c0/arc4.svg)](https://david-dm.org/hex7c0/arc4)\n[![Coveralls](https://img.shields.io/coveralls/hex7c0/arc4.svg)](https://coveralls.io/r/hex7c0/arc4)\n\n[RC4](https://en.wikipedia.org/wiki/RC4) stream cipher.\nYou can select from [\"[arc4](https://en.wikipedia.org/wiki/RC4)\", \"[rc4a](https://en.wikipedia.org/wiki/RC4#RC4A)\", \"[vmpc](https://en.wikipedia.org/wiki/RC4#VMPC)\", \"[rc4+](https://en.wikipedia.org/wiki/RC4#RC4.2B)\"] algorithm\n\nEncode/decode with different [encodings](http://nodejs.org/api/buffer.html#apicontent) _for *String only_, from nodejs doc:\n\u003e - 'ascii' - for 7 bit ASCII data only. This encoding method is very fast, and will strip the high bit if set.\n\u003e - 'utf8' - Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.\n\u003e - 'utf16le' - 2 or 4 bytes, little endian encoded Unicode characters. Surrogate pairs (U+10000 to U+10FFFF) are supported.\n\u003e - 'ucs2' - Alias of 'utf16le'.\n\u003e - 'base64' - Base64 string encoding.\n\u003e - 'binary' - A way of encoding raw binary data into strings by using only the first 8 bits of each character. This encoding method is deprecated and should be avoided in favor of Buffer objects where possible. This encoding will be removed in future versions of Node.\n\u003e - 'hex' - Encode each byte as two hexadecimal characters.\n\nMy original [python code](https://github.com/hex7c0/EncryptoPy/blob/master/modules/rc/rc4.py)\n\n## Installation\n\nInstall through NPM\n\n```bash\nnpm install arc4\n```\nor\n```bash\ngit clone git://github.com/hex7c0/arc4.git\n```\n\n## API\n\ninside nodejs project\n```js\nvar rc4 = require('arc4');\n\nvar cipher = rc4('arc4', 'secret_key');\nvar d = cipher.encodeString('ciao');\nvar e = cipher.decodeString(d);\n```\n\n### Methods\n\nchange your key and reload [gKsa](https://en.wikipedia.org/wiki/RC4#Key-scheduling_algorithm_.28KSA.29) (warning)\n```js\ncipher.change('foo');\ncipher.change([30, 31]);\ncipher.change(new Buffer('foo'));\n```\n\nencode a plaintext string, you can optionally choose input (defaults to 'utf8') and output (defaults to 'hex') [encoding](http://nodejs.org/api/buffer.html#apicontent)\n```js\ncipher.encodeString(plaintext [, input_encoding [, output_encoding]]);\ncipher.encodeString('string', 'utf8', 'base64');\n```\n\nencode a plaintext array\n```js\ncipher.encodeArray([49, 50, 51]);\n```\n\nencode a plaintext buffer data\n```js\ncipher.encodeBuffer(new Buffer('ciao'));\n```\n\nselect right function according with plaintext data type. Set input and output [encoding](http://nodejs.org/api/buffer.html#apicontent) only if data is a String\n```js\ncipher.encode(your_data [, input_encoding [, output_encoding]]);\n```\n\ndecode a ciphertext string, you can optionally choose input (defaults to 'hex') and output (defaults to 'utf8') [encoding](http://nodejs.org/api/buffer.html#apicontent)\n```js\ncipher.decodeString(ciphertext [, input_encoding [, output_encoding]]);\ncipher.decodeString('string', 'utf8', 'base64');\n```\n\ndecode a ciphertext array\n```js\ncipher.decodeArray([49,50,51]);\n```\n\ndecode a ciphertext buffer data\n```js\ncipher.decodeBuffer(new Buffer('ciao'));\n```\n\nselect right function according with ciphertext data type. Set input and output [encoding](http://nodejs.org/api/buffer.html#apicontent) only if data is a String\n```js\ncipher.decode(your_data [, input_encoding [, output_encoding]]);\n```\n\n### rc4(algorithm, password [, lodash])\n\n#### algorithm\n\n - `algorithm` - **String** Choose between [\"[arc4](https://en.wikipedia.org/wiki/RC4)\", \"[rc4a](https://en.wikipedia.org/wiki/RC4#RC4A)\", \"[vmpc](https://en.wikipedia.org/wiki/RC4#VMPC)\", \"[rc4+](https://en.wikipedia.org/wiki/RC4#RC4.2B)\"] *(default \"throw Error\")*\n\n#### password\n\n - `password` - **String | Array | Buffer** Your key *(default \"throw Error\")*\n\n#### [lodash]\n\n - `lodash` - **Boolean** Use [lodash](http://lodash.com/) library (check [benchmark](test/benchmark.js) test for right decision) *(default \"disabled\")*\n\n## Examples\n\nTake a look at my [examples](examples)\n\n### [License GPLv3](license)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex7c0%2Farc4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhex7c0%2Farc4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex7c0%2Farc4/lists"}