New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arc4

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arc4 - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

5

History.md

@@ -0,1 +1,6 @@

v2.1.3 / 2014-08-04
==================
* Doc update
v2.1.2 / 2014-07-27

@@ -2,0 +7,0 @@ ==================

4

index.min.js
/*
* arc4 v2.1.2
* arc4 v2.1.3
* (c) hex7c0 https://github.com/hex7c0/arc4/
* Licensed under GPLv3
*/
"use strict";function gSbox(){return[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]}function gKsa(a){for(var b=0,c=gSbox(),d=a,e=d.length,f=0;256>f;f++)b=(b+c[f]+d[f%e])%256,c[b]=[c[f],c[f]=c[b]][0];return c}function body(a,b,c){var d=0,e=0;if("string"==typeof b)for(var f=0,g=a.length;g>f;f++)d=(d+1)%256,e=(e+c[d])%256,c[e]=[c[d],c[d]=c[e]][0],b+=String.fromCharCode(a.charCodeAt(f)^c[(c[d]+c[e])%256]);else for(var f=0,g=a.length;g>f;f++)d=(d+1)%256,e=(e+c[d])%256,c[e]=[c[d],c[d]=c[e]][0],b[f]=a[f]^c[(c[d]+c[e])%256];return b}function bodyRC4A(a,b,c){var d=0,e=0,f=0,g=c.slice();if("string"==typeof b)for(var h=0,i=a.length;i>h;h++)d=(d+1)%256,e=(e+c[d])%256,c[e]=[c[d],c[d]=c[e]][0],b+=String.fromCharCode(a.charCodeAt(h)^g[(c[d]+c[e])%256]),h++,f=(f+g[d])%256,g[f]=[g[d],g[d]=g[f]][0],b+=String.fromCharCode(a.charCodeAt(h)^c[(g[d]+g[f])%256]);else for(var h=0,i=a.length;i>h;h++)d=(d+1)%256,e=(e+c[d])%256,c[e]=[c[d],c[d]=c[e]][0],b[h]=a[h]^g[(c[d]+c[e])%256],h++,f=(f+g[d])%256,g[f]=[g[d],g[d]=g[f]][0],b[h]=a[h]^c[(g[d]+g[e])%256];return b}function bodyVMPC(a,b,c){var d,e,f=0,g=0;if("string"==typeof b)for(var h=0,i=a.length;i>h;h++)d=c[f],g=c[(g+d)%256],e=c[g],b+=String.fromCharCode(a.charCodeAt(h)^c[c[e]+1]),c[g]=[d,c[f]=e][0],f=(f+1)%256;else for(var h=0,i=a.length;i>h;h++)d=c[f],g=c[(g+d)%256],e=c[g],b[h]=a[h]^c[c[e]+1],c[g]=[d,c[f]=e][0],f=(f+1)%256;return b}function bodyRC4P(a,b,c){var d,e,f,g=0,h=0;if("string"==typeof b)for(var i=0,j=a.length;j>i;i++)g=(g+1)%256,d=c[g],h=c[(h+d)%256],e=c[h],c[h]=[d,c[g]=e][0],f=(c[g<<5^h>>3]+c[h<<5^g>>3])%256,b+=String.fromCharCode(a.charCodeAt(i)^c[d+e]+c[170^f]^c[h+e]);else for(var i=0,j=a.length;j>i;i++)g=(g+1)%256,d=c[g],h=c[(h+d)%256],e=c[h],c[h]=[d,c[g]=e][0],f=(c[g<<5^h>>3]+c[h<<5^g>>3])%256,b[i]=a[i]^c[d+e]+c[170^f]^c[h+e];return b}function RC4(a){this.key,this.change(a)}module.exports=function(a){return new RC4(a)},RC4.prototype.change=function(a){if(this.key=new Array(a.legth),Array.isArray(a))this.key=a;else{if("string"!=typeof a&&!Buffer.isBuffer(a))throw new Error("Invalid data");a=new Buffer(a);for(var b=0,c=a.length;c>b;b++)this.key[b]=a[b]}},RC4.prototype.codeString=function(a){return body(a,"",gKsa(this.key))},RC4.prototype.codeArray=function(a){return body(a,new Array(a.length),gKsa(this.key))},RC4.prototype.codeBuffer=function(a){return body(a,new Buffer(a.length),gKsa(this.key))},RC4.prototype.code=function(a){if("string"==typeof a)return this.codeString(a);if(Array.isArray(a))return this.codeArray(a);if(Buffer.isBuffer(a))return this.codeBuffer(a);throw new Error("Invalid data")},RC4.prototype.codeStringRC4A=function(a){return bodyRC4A(a,"",gKsa(this.key))},RC4.prototype.codeArrayRC4A=function(a){return bodyRC4A(a,new Array(a.length),gKsa(this.key))},RC4.prototype.codeBufferRC4A=function(a){return bodyRC4A(a,new Buffer(a.length),gKsa(this.key))},RC4.prototype.codeRC4A=function(a){if("string"==typeof a)return this.codeStringRC4A(a);if(Array.isArray(a))return this.codeArrayRC4A(a);if(Buffer.isBuffer(a))return this.codeBufferRC4A(a);throw new Error("Invalid data")},RC4.prototype.codeStringVMPC=function(a){return bodyVMPC(a,"",gKsa(this.key))},RC4.prototype.codeArrayVMPC=function(a){return bodyVMPC(a,new Array(a.length),gKsa(this.key))},RC4.prototype.codeBufferVMPC=function(a){return bodyVMPC(a,new Buffer(a.length),gKsa(this.key))},RC4.prototype.codeVMPC=function(a){if("string"==typeof a)return this.codeStringVMPC(a);if(Array.isArray(a))return this.codeArrayVMPC(a);if(Buffer.isBuffer(a))return this.codeBufferVMPC(a);throw new Error("Invalid data")},RC4.prototype.codeStringRC4P=function(a){return bodyRC4P(a,"",gKsa(this.key))},RC4.prototype.codeArrayRC4P=function(a){return bodyRC4P(a,new Array(a.length),gKsa(this.key))},RC4.prototype.codeBufferRC4P=function(a){return bodyRC4P(a,new Buffer(a.length),gKsa(this.key))},RC4.prototype.codeRC4P=function(a){if("string"==typeof a)return this.codeStringRC4P(a);if(Array.isArray(a))return this.codeArrayRC4P(a);if(Buffer.isBuffer(a))return this.codeBufferRC4P(a);throw new Error("Invalid data")};
"use strict";function gSbox(){return[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]}function gKsa(a){for(var b=0,c=gSbox(),d=a,e=d.length,f=0;256>f;f++)b=(b+c[f]+d[f%e])%256,c[b]=[c[f],c[f]=c[b]][0];return c}function body(a,b,c){var d=0,e=0;if("string"==typeof b)for(var f=0,g=a.length;g>f;f++)d=(d+1)%256,e=(e+c[d])%256,c[e]=[c[d],c[d]=c[e]][0],b+=String.fromCharCode(a.charCodeAt(f)^c[(c[d]+c[e])%256]);else for(var f=0,g=a.length;g>f;f++)d=(d+1)%256,e=(e+c[d])%256,c[e]=[c[d],c[d]=c[e]][0],b[f]=a[f]^c[(c[d]+c[e])%256];return b}function bodyRC4A(a,b,c){var d=0,e=0,f=0,g=c.slice();if("string"==typeof b)for(var h=0,i=a.length;i>h;h++)d=(d+1)%256,e=(e+c[d])%256,c[e]=[c[d],c[d]=c[e]][0],b+=String.fromCharCode(a.charCodeAt(h)^g[(c[d]+c[e])%256]),h++,f=(f+g[d])%256,g[f]=[g[d],g[d]=g[f]][0],b+=String.fromCharCode(a.charCodeAt(h)^c[(g[d]+g[f])%256]);else for(var h=0,i=a.length;i>h;h++)d=(d+1)%256,e=(e+c[d])%256,c[e]=[c[d],c[d]=c[e]][0],b[h]=a[h]^g[(c[d]+c[e])%256],h++,f=(f+g[d])%256,g[f]=[g[d],g[d]=g[f]][0],b[h]=a[h]^c[(g[d]+g[e])%256];return b}function bodyVMPC(a,b,c){var d,e,f=0,g=0;if("string"==typeof b)for(var h=0,i=a.length;i>h;h++)d=c[f],g=c[(g+d)%256],e=c[g],b+=String.fromCharCode(a.charCodeAt(h)^c[c[e]+1]),c[g]=[d,c[f]=e][0],f=(f+1)%256;else for(var h=0,i=a.length;i>h;h++)d=c[f],g=c[(g+d)%256],e=c[g],b[h]=a[h]^c[c[e]+1],c[g]=[d,c[f]=e][0],f=(f+1)%256;return b}function bodyRC4P(a,b,c){var d,e,f,g=0,h=0;if("string"==typeof b)for(var i=0,j=a.length;j>i;i++)g=(g+1)%256,d=c[g],h=c[(h+d)%256],e=c[h],c[h]=[d,c[g]=e][0],f=(c[g<<5^h>>3]+c[h<<5^g>>3])%256,b+=String.fromCharCode(a.charCodeAt(i)^c[d+e]+c[170^f]^c[h+e]);else for(var i=0,j=a.length;j>i;i++)g=(g+1)%256,d=c[g],h=c[(h+d)%256],e=c[h],c[h]=[d,c[g]=e][0],f=(c[g<<5^h>>3]+c[h<<5^g>>3])%256,b[i]=a[i]^c[d+e]+c[170^f]^c[h+e];return b}function RC4(a){this.key,this.change(a)}module.exports=function(a){return new RC4(a)},RC4.prototype.change=function(a){if(this.key=new Array(a.legth),Array.isArray(a))this.key=a;else{if("string"!=typeof a&&!Buffer.isBuffer(a))throw new Error("Invalid data");a=new Buffer(a);for(var b=0,c=a.length;c>b;b++)this.key[b]=a[b]}},RC4.prototype.codeString=function(a){return body(a,"",gKsa(this.key))},RC4.prototype.codeArray=function(a){return body(a,new Array(a.length),gKsa(this.key))},RC4.prototype.codeBuffer=function(a){return body(a,new Buffer(a.length),gKsa(this.key))},RC4.prototype.code=function(a){if("string"==typeof a)return this.codeString(a);if(Array.isArray(a))return this.codeArray(a);if(Buffer.isBuffer(a))return this.codeBuffer(a);throw new Error("Invalid data")},RC4.prototype.codeStringRC4A=function(a){return bodyRC4A(a,"",gKsa(this.key))},RC4.prototype.codeArrayRC4A=function(a){return bodyRC4A(a,new Array(a.length),gKsa(this.key))},RC4.prototype.codeBufferRC4A=function(a){return bodyRC4A(a,new Buffer(a.length),gKsa(this.key))},RC4.prototype.codeRC4A=function(a){if("string"==typeof a)return this.codeStringRC4A(a);if(Array.isArray(a))return this.codeArrayRC4A(a);if(Buffer.isBuffer(a))return this.codeBufferRC4A(a);throw new Error("Invalid data")},RC4.prototype.codeStringVMPC=function(a){return bodyVMPC(a,"",gKsa(this.key))},RC4.prototype.codeArrayVMPC=function(a){return bodyVMPC(a,new Array(a.length),gKsa(this.key))},RC4.prototype.codeBufferVMPC=function(a){return bodyVMPC(a,new Buffer(a.length),gKsa(this.key))},RC4.prototype.codeVMPC=function(a){if("string"==typeof a)return this.codeStringVMPC(a);if(Array.isArray(a))return this.codeArrayVMPC(a);if(Buffer.isBuffer(a))return this.codeBufferVMPC(a);throw new Error("Invalid data")},RC4.prototype.codeStringRC4P=function(a){return bodyRC4P(a,"",gKsa(this.key))},RC4.prototype.codeArrayRC4P=function(a){return bodyRC4P(a,new Array(a.length),gKsa(this.key))},RC4.prototype.codeBufferRC4P=function(a){return bodyRC4P(a,new Buffer(a.length),gKsa(this.key))},RC4.prototype.codeRC4P=function(a){if("string"==typeof a)return this.codeStringRC4P(a);if(Array.isArray(a))return this.codeArrayRC4P(a);if(Buffer.isBuffer(a))return this.codeBufferRC4P(a);throw new Error("Invalid data")};
{
"version": "2.1.2",
"version": "2.1.3",
"name": "arc4",

@@ -12,3 +12,3 @@ "description": "rc4 stream cipher",

"preferGlobal": false,
"homepage": "https://github.com/hex7c0/arc4/",
"homepage": "http://supergiovane.tk/#/arc4",
"author": {

@@ -28,4 +28,3 @@ "name": "hex7c0",

"directories":{
"doc":"./doc",
"lib":"./lib"
"doc":"./doc"
},

@@ -36,7 +35,6 @@ "main": "index.min.js",

"devDependencies": {
"mocha": "~1.21.0",
"grunt": "~0.4.5",
"grunt-contrib-clean": "~0.5.0",
"mocha": "~1.21.3",
"grunt-contrib-clean": "0.5.0",
"grunt-contrib-uglify": "0.5.0",
"grunt-shell": "0.7.0"
"grunt-shell": "~0.7.0"
},

@@ -43,0 +41,0 @@ "engines": {

@@ -21,2 +21,6 @@ # [arc4](https://github.com/hex7c0/arc4)

```
or
```
http://supergiovane.tk/#/arc4
```

@@ -23,0 +27,0 @@ ## API

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc