Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserify-aes

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-aes - npm Package Compare versions

Comparing version 0.0.0 to 0.1.0

.travis.yml

117

decrypter.js

@@ -9,6 +9,18 @@ var aes = require('./aes');

inherits(Splitter, Transform);
function Splitter() {
function unpad(last) {
var padded = last[15];
if (padded === 16) {
return;
}
return last.slice(0, 16 - padded);
}
function Splitter(padding) {
if (!(this instanceof Splitter)) {
return new Splitter();
return new Splitter(padding);
}
if (padding === false) {
this._padding = false;
} else {
this._padding = true;
}
Transform.call(this);

@@ -31,2 +43,8 @@ this.cache = new Buffer('');

};
Splitter.prototype._flush = function (next) {
if (this._padding === false) {
this.push(this.cache);
}
next();
};

@@ -41,2 +59,3 @@ inherits(ECB, Transform);

this._last = void 0;
this._pad = true;
}

@@ -56,9 +75,12 @@

this._cipher.scrub();
var last = this._last;
var padded = last[15];
if (padded === 16) {
if (this._pad === false) {
if (this._last) {
this.push(this._last);
}
return next();
}
var out = last.slice(0, 16 - padded);
this.push(out);
var depadded = unpad(this._last);
if (depadded) {
this.push(depadded);
}
next();

@@ -85,2 +107,3 @@ };

this._prev = indata;
this._pad = true;
next();

@@ -90,14 +113,38 @@ };

this._cipher.scrub();
var last = this._last;
var padded = last[15];
if (padded === 16) {
if (this._pad === false) {
if (this._last) {
this.push(this._last);
}
return next();
}
var out = last.slice(0, 16 - padded);
this.push(out);
var depadded = unpad(this._last);
if (depadded) {
this.push(depadded);
}
next();
};
inherits(CFB, Transform);
function CFB(key, iv) {
if (!(this instanceof CFB)) {
return new CFB(key, iv);
}
Transform.call(this);
this._cipher = new aes.AES(key);
this._prev = iv;
}
CFB.prototype._transform = function (data, _, next) {
// yes encrypt
var pad = this._cipher.encryptBlock(this._prev);
this._prev = data;
next(null, xor(pad, data));
};
CFB.prototype._flush = function (next) {
this._cipher.scrub();
next();
};
var modeStreams = {
ECB: ECB,
CBC: CBC
CBC: CBC,
CFB: CFB
};

@@ -123,6 +170,44 @@

}
var splitter = new Splitter();
var splitter = new Splitter(config.padding);
var stream = new modeStreams[config.mode](password, iv);
splitter.pipe(stream);
return duplexer(splitter, stream);
splitter.on('data', function (d) {
stream.write(d);
});
splitter.on('finish', function () {
stream.end();
});
var out = duplexer(splitter, stream);
out.setAutoPadding = function (padding) {
stream._padding = padding;
};
out._legacy = false;
var outData = new Buffer('');
out.update = function (data, inputEnd, outputEnc) {
if (out._legacy === false) {
out._legacy = true;
stream.on('data', function (chunk) {
outData = Buffer.concat([outData, chunk]);
});
stream.pause = function (){
// else it will stall out
};
}
splitter.write(data, inputEnd);
var ourData = outData;
outData = new Buffer('');
if (outputEnc) {
ourData = ourData.toString(outputEnc);
}
return ourData;
};
out.final = function (outputEnc) {
splitter.end();
var ourData = outData;
outData = null;
if (outputEnc) {
ourData = ourData.toString(outputEnc);
}
return ourData;
};
return out;
}

@@ -129,0 +214,0 @@ function createDecipher (suite, password) {

@@ -9,6 +9,11 @@ var aes = require('./aes');

inherits(Splitter, Transform);
function Splitter() {
function Splitter(padding) {
if (!(this instanceof Splitter)) {
return new Splitter();
return new Splitter(padding);
}
if (padding === false) {
this._padding = false;
} else {
this._padding = true;
}
Transform.call(this);

@@ -33,2 +38,6 @@ this.cache = new Buffer('');

Splitter.prototype._flush = function (next) {
if (!this._padding) {
this.push(this.cache);
return next();
}
var len = 16 - this.cache.length;

@@ -83,6 +92,25 @@ var padBuff = new Buffer(len);

};
inherits(CFB, Transform);
function CFB(key, iv) {
if (!(this instanceof CFB)) {
return new CFB(key, iv);
}
Transform.call(this);
this._cipher = new aes.AES(key);
this._prev = iv;
}
CFB.prototype._transform = function (data, _, next) {
var pad = this._cipher.encryptBlock(this._prev);
this._prev = xor(data, pad);
next(null, this._prev);
};
CFB.prototype._flush = function (next) {
this._cipher.scrub();
next();
};
var modeStreams = {
ECB: ECB,
CBC: CBC
CBC: CBC,
CFB: CFB
};

@@ -107,6 +135,44 @@ module.exports = function (crypto) {

}
var splitter = new Splitter();
var splitter = new Splitter(config.padding);
var stream = new modeStreams[config.mode](password, iv);
splitter.pipe(stream);
return duplexer(splitter, stream);
splitter.on('data', function (d) {
stream.write(d);
});
splitter.on('finish', function () {
stream.end();
});
var out = duplexer(splitter, stream);
out.setAutoPadding = function (padding) {
splitter._padding = padding;
};
out._legacy = false;
var outData = new Buffer('');
out.update = function (data, inputEnd, outputEnc) {
if (out._legacy === false) {
out._legacy = true;
stream.on('data', function (chunk) {
outData = Buffer.concat([outData, chunk]);
});
stream.pause = function (){
// else it will stall out
};
}
splitter.write(data, inputEnd);
var ourData = outData;
outData = new Buffer('');
if (outputEnc) {
ourData = ourData.toString(outputEnc);
}
return ourData;
};
out.final = function (outputEnc) {
splitter.end();
var ourData = outData;
outData = null;
if (outputEnc) {
ourData = ourData.toString(outputEnc);
}
return ourData;
};
return out;
}

@@ -113,0 +179,0 @@ function createCipher (suite, password) {

@@ -39,2 +39,23 @@ exports['aes-128-ecb'] = {

exports['aes192'] = exports['aes-192-cbc'];
exports['aes256'] = exports['aes-256-cbc'];
exports['aes256'] = exports['aes-256-cbc'];
exports['aes-128-cfb'] = {
cipher: 'AES',
key: 128,
iv: 16,
mode: 'CFB',
padding: false
};
exports['aes-192-cfb'] = {
cipher: 'AES',
key: 192,
iv: 16,
mode: 'CFB',
padding: false
};
exports['aes-256-cfb'] = {
cipher: 'AES',
key: 256,
iv: 16,
mode: 'CFB',
padding: false
};

2

package.json
{
"name": "browserify-aes",
"version": "0.0.0",
"version": "0.1.0",
"description": "aes, for browserify",

@@ -5,0 +5,0 @@ "main": "index.js",

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

browserify-aes
browserify-aes [![Build Status](https://travis-ci.org/calvinmetcalf/browserify-aes.svg)](https://travis-ci.org/calvinmetcalf/browserify-aes)
====
much of this taken from the aes implimentation in [triplesec](https://github.com/keybase/triplesec), they are just normal streams for now, no fancy stuff.
much of this taken from the aes implimentation in [triplesec](https://github.com/keybase/triplesec), they are just normal streams for now, no fancy stuff.
EVP_BytesToKey is a strait up port of the same function from openssl as there is literally no documenation on it beyond it using 'undocumented extentions' for longer keys.

@@ -16,3 +16,6 @@ [

"aes192": "83fb920306c2d7f0c5ceb5dc7272357e",
"aes256": "138839b0499e9bce8731bf0b9861b60c"
"aes256": "138839b0499e9bce8731bf0b9861b60c",
"aes-128-cfb": "6f60e632",
"aes-192-cfb": "7e595268",
"aes-256-cfb": "df60cff2"
},

@@ -25,3 +28,6 @@ "cipherivs": {

"aes192": "87ed62214972949ed913b612a319ee1f",
"aes256": "ad3e265d8c7375c2941850fcf59337e9"
"aes256": "ad3e265d8c7375c2941850fcf59337e9",
"aes-128-cfb": "e914ee82",
"aes-192-cfb": "3620077c",
"aes-256-cfb": "9e495087"
}

@@ -44,3 +50,6 @@ }

"aes192": "9a79675d33a12c5fd5144d89752cf8591f0b595165b023800679b10ab59035b9df70f29e76e399ec30b2264178c3777c14550edad5860e1ef8f96ce3202f5208eb4316b066d911e4c89d1473cbe349a4aab7c87fb27f3e79a50925bc253aeacf61537fecf915d0b86558646d3beebb2e01eeb0a4d2d7152fef36a788c062453bd413bde5a5c5570f7b78721314699728f602e7e01397cbf8acf04c0a40df1a4a5e66ee42fba9a965bee4e2af3c92bef47dd6e330099263eba40cffc0717c37aeefa07ccbed4d3f6ce2e08c4c32146c8b072f887344a27cc92170d9ba9adc8528877b9a8909d818ae5d72d75c285eeba6bc9a5e03c5a776d5d3a6715782a3d15276adb30c7e2aec601eac8e93c82e4cc203c077c96b57a4c9b0d1aaf2ee12172f85de69c2445e7201278e2769a77d5903cb25c5811ae389675816f8666f49b94ac09c2a5130ad23359fd7023b41b488e401a86beab1fa4ad78a3bbde7b67fb78d59c4fd696e7e2170dd02d39253378c205639541b48f8ab4da29b09a58d4cc1c3eb9edcc99d54005957d7e2785159d16fc71846cc2dcfaf595ca451bb122d5b21e1bb08234b6997f345534cdc7240123401650db5a41638d8601a2a7b6bd7ee12303c050668b0a6f1dc91a2f006a4e0ab5c89c7785d8a541793fbf2566928165ae693c70a8295e460e7580dca60242882004d540aa845e86d3c1534d3aedfb508ae91d97e31656615eb72c5dca78fa7d449867e3ef5eadf2bc74dfe1613d08e67ba7ab0e1c50d7f7caaa65b9009e93d21eda34bb688a56f756fbbb88eb0252061",
"aes256": "e61484b76c26d646d10783110cad453244353988d80f0fe34e9c5991b75acccc08863d2f6ea0c9c9a69362566dfbeb98fea8029681bb8698895a02ed9887a90786ba168f594552805d41a8616aaef0a5b50c259a23b803f7cd24b2ad97e5f4b745f46643074818d946dc42fa0a9d6e1da1256818be90118a643b281971bbc12260de04d3256ceb11e87917712c1bdc0512f104a00ff5d5e2bdc532ba42035787c83b64ecbdb1b860058938241efdcc43ef62be6cbae85e582d9d5e846603909d9a9bf1019909c15d4cf36ebdfb7dd4666ae84c06568e531f50e59ba9b924cca3d46f76ab1d88324d0cecd25589d73d2488f434bc56e0abd8c6e0e389bbea3a88c8990ddf830106f746b4f6916667e3ade50267ed1a543239ad3fa75906c1fc4509147893517798acd3f15eef97b590cb67d0f8322398ce7371aca5247b7d0079897eeb8273604663152843cdae06f6c38ead2a60dfe86287489eb1a6a9cb48e9cb8abe0885b84dc276d3405e0528c49b14461ab2797d0cc0da6ee9aeef69e7ee585abccf4493d6a180454d29ec78790d513b430393a22793092efd63d58d684a6f429ed43a9ae72e8489d793bcd8d821a7bc693c2e75493a51788482f73030579c6f04c6f54e7ffee6b1f3d4b64379e89670530cbf16ad0b2b21afeafda636105edb94f9e6075665bb6f012d566bf468ed3372bf0e1f13917ac3c33cbc8979e559056b870b474c65cbd5aea2a1947b2b8f5719d2366da5ca91c82aa371d8f5c0e849dbf56ab7f4a69049ac8b118990da7a6394e1b7113b89f8f262681d063160"
"aes256": "e61484b76c26d646d10783110cad453244353988d80f0fe34e9c5991b75acccc08863d2f6ea0c9c9a69362566dfbeb98fea8029681bb8698895a02ed9887a90786ba168f594552805d41a8616aaef0a5b50c259a23b803f7cd24b2ad97e5f4b745f46643074818d946dc42fa0a9d6e1da1256818be90118a643b281971bbc12260de04d3256ceb11e87917712c1bdc0512f104a00ff5d5e2bdc532ba42035787c83b64ecbdb1b860058938241efdcc43ef62be6cbae85e582d9d5e846603909d9a9bf1019909c15d4cf36ebdfb7dd4666ae84c06568e531f50e59ba9b924cca3d46f76ab1d88324d0cecd25589d73d2488f434bc56e0abd8c6e0e389bbea3a88c8990ddf830106f746b4f6916667e3ade50267ed1a543239ad3fa75906c1fc4509147893517798acd3f15eef97b590cb67d0f8322398ce7371aca5247b7d0079897eeb8273604663152843cdae06f6c38ead2a60dfe86287489eb1a6a9cb48e9cb8abe0885b84dc276d3405e0528c49b14461ab2797d0cc0da6ee9aeef69e7ee585abccf4493d6a180454d29ec78790d513b430393a22793092efd63d58d684a6f429ed43a9ae72e8489d793bcd8d821a7bc693c2e75493a51788482f73030579c6f04c6f54e7ffee6b1f3d4b64379e89670530cbf16ad0b2b21afeafda636105edb94f9e6075665bb6f012d566bf468ed3372bf0e1f13917ac3c33cbc8979e559056b870b474c65cbd5aea2a1947b2b8f5719d2366da5ca91c82aa371d8f5c0e849dbf56ab7f4a69049ac8b118990da7a6394e1b7113b89f8f262681d063160",
"aes-128-cfb": "5225ff2b15584561697dcf84b17f68b72018561895e734cccedafb3c03929f4a1bc2d201e6b990f8debdc4b1228d43e4b89ab30797aa1b28dddf658bdc31ac2ba79229db43db926abdd94c50b6fd7b168ac4ab9ddde316cbe3e659de632bc9db56beff0f6c6b19e73c675ce9101ae2a6e86644dc66661b3f2253a6e6571d905a11971bce0f83877c0406d678cbce7f0876412bbac6faedcce9b95dcbfb5aa94fc610c4307e9d43f7a2c4ebbdce72d272ba8b7bc78f202bf376acf26d3557dd990c56ff80be5e0e8459f558d0b069ee569ea75287a1ebe74f11e912ea2d9cb68d9d72bacd4313e44602f7b8a514866df628f1b91dea859ce5f02a1388e7d1ae4047c2d94d6e64ae2a155c20cfc9720b000ae4885abc9d4b982c15f6a35a743c760bc757426d760e343fbec1f949d5ae8f84ca424ff8807a6e36ee43beb355394ec6a6174bc40d6bc0e9469c895c7d2beb7fa496b6c73ea8c2e943ee6dda983d1215a0009506bd917946536cfba285706682aaed8b476b54230c22c797ce30e86585026cffd58cd92df6772551a26e35fcd4ca1d9ab3ac99dedc6957da9666d5486b58365c0358eab9178bddf88c81d8c4d65192e5332bad0b6eeed079511b035588309511fd0fe2c30bb0c539864faca48a1d0d44768b394aa1a2787a33b954072c39b675437e720a86d4b007a0e73b088548a866dfd66da8c37d7664b8ef0d4ba80d60a3c96cce138f4953310a9d404788d57ab4f9523d3396122b948d33a44778ec1c63fc6c0671772a08394c0b96eb45c77769da137b",
"aes-192-cfb": "431c4b713428cfc419ea2917b318efb47ccd70c259bfa69d6b6e591e12a811626722ef3ee2bf3215a74004a47395e09c62e4e58e9bba52765cf17814ea8e17545db49ef6a99b347b31a87fbabdd3a5d6266b5e567cd39f32e03f70d004c08e07f68e1057a7e230217b502b1c957ff2568f1dc6ebd957e514f77b120b2df4a3eb082c0f5492d76c57543aee46955658404c641438edc25d9a41ceb1e9e4bc3c952358b776ad696e51bb18451394c106455599933e50ac17d8011b37853535385a8e9dfe9dde74b83c2980511a31e02106e41aff550229afa242c7ea4dc1b251b0983de149ed3dbcf7ff33cc56352f38beb2498580a3f6afdf7ec32fe389a9703d37dba751bde8ea5fe6d4d5a8e1c9185130783880a5329462daed84e9b828ad1e3cbb9869aa882d24aa21f9e73a4ad67222b283be52bd83de7d850060fb973d18964ad6890bc797563d94aee463c79d3278e5c0babdfa3c08fa069d45729a7b22d2a5b84196ee42006eb33f2fb70273ed0c761f12a0601278ccc4f58975dfccb359fcca18471a5067c2b59dd7dc16107c03a2a4c2781210eff68fded527816e00c6090d3847c10316cc8f937c82f35d5f01b6b8bbfd90f7a6e13d14363d193c40a62eb32cf054953502dfe3196ab2adae91ee07c5e08de4f7d69252deed38bf064a32ac6ce24ddb3db46c39aedce5b26bed42890858ce10ca5481bb7c8e78fb8701836fc7fb5997203436e9c5ea6edc0b6770b42d2247582bbd7d5422df46e45d37e3b140e2cdb1a2dc75f78eef2f60f47e08027ce1e424",
"aes-256-cfb": "e225d6eb312195de58f18d155953985d9abcda4baa27503ff1963ee8aa733781a9f8bd10480af779eb637c6248c5e35929c39e75d2fa0ecfb993c6eb6c3ad339d9145079e77e9f809ceffaaada4d8992ee74a86835ef2cf6a1cfbe2389414b880d39b940a486b8937897c17f87cb80e3411a5478a6e51a593fe74fd9ff64a6376f10d259e27e2a2d7a0835abf6a240587665c5172bb19f0635e0d7918b1c8420785f03ee4835bae213a16ed6719e41ac9273ae1e94105e7dbad369acb14441e1cc2ab94d3f0eb210ac19dd6fbb84396672d92322b483ba482263ecd153f42894735c08fb03cb0512e1bfe361798ab032fa9b55f0d274fb3389187a5183de86037e4f11fd595d817ac3c6ff066a9e152e43cf0d24ee6fac12898119411423657d2bc7ee3c20946854ad3f3fba6ca0f503139a345f085641747fd31328778058c6a0624de2e109e5a0e6c3b1a94cf23ed7c5726a0849c3cabb929ef9b2a45aa5f98b4f9ae085a9239206bccf0ffd0d3c1c6ac34ad0d07b77cef4bc6e2fb1c0077dd7efb09f43bc054d9e0ade1746ebf97719ba85ed56afbbb87df6bb5080c50a3a4424d40f25d8576388122498dedbf193c5b9f0f841d3888597349a27394d09d5b49c205eecd6a3971cd42937468be4e2d76f53f42cfb794b94b0b55afdab35cea5fd233808fd815322209be13668bf98ac9127d5118240feed5673f05d1f17d0e100c3497e5bfa50d39e83cca3bc263fef65925414d4e76875d6601cf9514624ec3441fa14be3814c7d1649558add6bab7d7577c225a26"
},

@@ -53,3 +62,6 @@ "cipherivs": {

"aes192": "ba1d241268647886d3b9103013959edd378dccdc1f158f84ed560ca88c0c4a7863c13c914b0059d217ab32482168745225f78879c6d658653bd17277b6d9bac6cdce37dcd8dcb94b01fdebe358c33277f32d2989eb2970e434f653fc28e60dbb4fb9a14e14d5f38c30081c2e9d1a8ab145551257c448e24c91dd1adb99fc46ebcb633d4c8b3f91835bbbf9085cfb1a2f034a51c609f095c1a813fca49192e7f64cb959c664e24759f77c21c05faa90ce4c222ae6d87bf51b770c2888b7e0f059a7f06c4622e104dde2b8ffd447e6c0cff1a44cb9d54a1a16f5a90e97e4dccb5a7e135406ad0632f61a6b1750a335ba5b187c032750d41ab98f75e1327267092a6fc594e1971690d5c63b867d61236f432284079ec79899afac2564fad047937cb270fcae1d0dced5a9665044814109a27bd0d35b6dd7f0177ef8580ba3078cb1b706e553ff08e0ed47d4b2930ae918ce4747ccc0bf74e8a6a6811f1e1b29c3e658a5dc497f65ffdb3733ac009e7a15ce74a8c5d404ff8912190e8b1f03f13ecc304ce1904165d90177674ad2410e1d925b4319396940e961f507952788eace2e184d822e9818a1e776e3ea49a50bcbe60e9883d4c538eed3a3a584999f7ec0108207f26826b2a4dbcfdd64901d9173bf8199dd13227902af561447aa12037e875ed47d0e0518c1836c2f676d5c454862f525183f9ca50bce15de150ac12e3168882767ce5a2f2f431d3021ec21122c3e900b53ec9949c5c254d9ee8f86ed5eb6347e65b495367ca11c471ee2f9f02e73674861ce55f889675534d6fb57459135",
"aes256": "4bd525802cd2ed487bbfad28a81764d381b7c83291edb366c73cca3167e19760a5023fa52821dfd44d22e314583c842659aba2d23e3118756a302426699415d88d6cf7eac4ea53a01e7ba1e9251ecc62d5ded26bf4b5420b19d1e96bce7453122ace17cc0621995429436693c584cfffc66d27a0d00419b499e672b2813730cbf97d142c68ac5f52e08632c4f76c6f8b9a0140429d731e996c17e3dca3d6b07af330c4189ed6eecd338b28c989736011cd2b8704ad43e5604f3655e86cfb6a3788a508f01896cb468926cf79be1a665e435d2d54844597575292b989a81f424a4f2190bcb829aadfbeddecc97d18b595c87d534706d3e5c3d5e76eb59bc2815fd55e70b1672ae510d1011f613671d4303e36668aeaa3ea4ee42f1c14018b5f70ca455d6a1bc5231f5afccab64a147af2a175ea16d54b2f789243186f9e0be9d29cd29e5fbcd8f1ec32453e2df77b387ce4a833df580cdd158276d48f4c2e7e18ca6ef0e447f79c7877e3bbc0661512c93e004cdc93e94458cd78f0e1b96d910abf35955c073c2d84a3ad32d6de24d6d4071dc609acbcc8aecb3912f15991a1c89c1a75a75ad53016191050ddb0cce49752fa426a346016c36fc8790fe803496a23876bd36e970786d949ee87df1f34644d8d1318603e4637e3b4a922f3e4249958cc3a741a8003fec74719d35cf184617593356e083ca4a27c30f5b388089e0a858984c4152f3030b9f0a6c25c7388cc22db210798dc5d00230081e465a1c88a8fae186f3ef7aa9c5c2b9e472c1622ba9958ed85fe94160ac071da3b285cdfe0"
"aes256": "4bd525802cd2ed487bbfad28a81764d381b7c83291edb366c73cca3167e19760a5023fa52821dfd44d22e314583c842659aba2d23e3118756a302426699415d88d6cf7eac4ea53a01e7ba1e9251ecc62d5ded26bf4b5420b19d1e96bce7453122ace17cc0621995429436693c584cfffc66d27a0d00419b499e672b2813730cbf97d142c68ac5f52e08632c4f76c6f8b9a0140429d731e996c17e3dca3d6b07af330c4189ed6eecd338b28c989736011cd2b8704ad43e5604f3655e86cfb6a3788a508f01896cb468926cf79be1a665e435d2d54844597575292b989a81f424a4f2190bcb829aadfbeddecc97d18b595c87d534706d3e5c3d5e76eb59bc2815fd55e70b1672ae510d1011f613671d4303e36668aeaa3ea4ee42f1c14018b5f70ca455d6a1bc5231f5afccab64a147af2a175ea16d54b2f789243186f9e0be9d29cd29e5fbcd8f1ec32453e2df77b387ce4a833df580cdd158276d48f4c2e7e18ca6ef0e447f79c7877e3bbc0661512c93e004cdc93e94458cd78f0e1b96d910abf35955c073c2d84a3ad32d6de24d6d4071dc609acbcc8aecb3912f15991a1c89c1a75a75ad53016191050ddb0cce49752fa426a346016c36fc8790fe803496a23876bd36e970786d949ee87df1f34644d8d1318603e4637e3b4a922f3e4249958cc3a741a8003fec74719d35cf184617593356e083ca4a27c30f5b388089e0a858984c4152f3030b9f0a6c25c7388cc22db210798dc5d00230081e465a1c88a8fae186f3ef7aa9c5c2b9e472c1622ba9958ed85fe94160ac071da3b285cdfe0",
"aes-128-cfb": "0304a8ae497c46305a87df178b39538be455205fd10d1828ecaad1939fdb385352c904b5b18fd89fe5a18ecd09ac677fbad2261d4693e4dd9e6d880d390f1eadb4bee741b9616c24f0b5aad321e26f0164829411db3e4da23eebe6f2e2aff49b2b62719bbbbdc6b9b8f03093b1ed4b35b3d1bf2f51b1b7859fb6f31b1e8bf722900ead0497594a96c8686da60100c349caa3a814a322c775604875d2d6fb0db51a539d4d0d52b312fa5c9d6e8816b78b16c0a8909c80096e2744d54d7505e7d375d3373d007bdbf2ecc60d9b0fe70ffd1937ae32c59925770530778c96bbbb198ccb5d526d47b775a3882c52f06901280bd79c42adf7aa6a8b2a2128ed6d5f792b61ab08c3037e5a6d19863ed4a84ce061ef9b0da5eefbb91feffbea775016deb9fa3e956c670a81891e8a337af201a308356e906625bdc57367e9cde5b228db26c5c305bd35b299aa8ee6b23dad128fd57dd33fe5e9c2665cd12d3475b30ceab7f25c8c7d3c1f926550ad37f1082b14002ea5a85783fb2f7acbfb7700b6dc2ee1c44233f29942fff2e1771fd0892a8197664c48716a1d4f4ea2f4540f76356e61ebb088acda8a3f3ec1c21aa6fb3197fb1693ce6208e519c9cfbb4a84804c7045b088fb5cd9eb596674e817a361eb7268e3fcbbe6d16d2dd5283b07fb874f5c7625cde806d66b6a59847d2ca40fedce04aab70599f870fa4238d77da8f4140a1679376a92ee7949bf8e42858882d4b04a15f0c84a2591f244889b8278e79259f21434f402950465f1b2882a11511ebb95e10d941431bd",
"aes-192-cfb": "35f1e120808e87537835e1cce77e65736fd163fc25dca73c86a9e1a7d49a66be47d2fc9c307faac6691cf12816a8166f2053a5728007a85535694b4dc9f0337e9b17e4c1e9ced6c5c58a1b747e2765a54141e864a2c9500b3d96d7f861b2259f777cd74dffe2f5def6cae7969384a163b7adf61fd6cdb05cf9d10bda269c91f5cfcbc325cc50f1fb3424af848d4308b3103223e4757b01b87f1408c6608fd4a401da33d1c1199271d757f8d9b7a5e58924ef76914c34f2fb35a86b2707b50bae259f3fb7bad9991cb2dd3e33ade251ac52052d87fb9415921d35a5d223a4385d384a33b27276307b35795c3de1b14be81001373c0a2a0ee6c52a5c70e695e30a2cb46ba8363beda90181e6010ab5426f663feecbc94f57869cdb6f75299f696deb2471019379db29fd67065db9c557a0880862fcb2c7418a1804289be9bf01cba6a3562731dd7c15b473359009df4bcc367c85d44dbefd6e5d585377b71f6f27b90556a75afe19b575eb3b2f329dca7ea3a48ce3f848f35aa4c5977924fa0ee76d2140d43e0918093f17728983880c83bc4aa23f2710ac4671de83734b0a904acc0df93718ad74017eca9cac94ef2f23a44e7be169366d5de44992af57275fe2e73b8ac05f9fe551635b99afeb6aea7cb551cf7c5ab0ed3d88e1a340f8e505dc64a91c9ffd04820daaf2ceaf8b876400256d1cc82ee18ae6b1f05b6ae27ba311009623bfe190a98e226263cf11ee35b1b64095b845ad50517e597fa590efef70a82cb99546d6037302c5cc6a1b325877a1bc898b91bae4",
"aes-256-cfb": "831ec789aecaa6fd45e28074bea498ffb82b9c36faf042949fda04f02cee48f0a4a3e0db27e6fa4297c4d715885dc54bcb341d13de8a20985eaaad64fff240e068cc62dbacb9698e98d33b6a3d22ce16e6c178f6999441f55f434f95a988e5db92a96ecb1815e68f1b26f777faa98b95fcd91905ee8a26efe62a4069080eec24a82eaf22f2256cb4a2d714309e0bc69f580e20d8ddabcd67a3c859531c9b9190b23068e4729d5647c2b959084ae976c9bf284d0b9299e638c3afa5cf3b97c03a78cc9bde27ea1107513fd7b9cbe085726a06fa301cc63a3aa30ba962fc63ff00199899500f20d59f0f2b0eb5e8948497f74348cf899824bcee19c2e60b6f75e0b9733e19574f011d5480ff2eb0fa5501246fe2d55db83767397037988b9c1d530588e2e61153cf919e80167a869a24c060d7ed868c0e8ef88b5ce815ce6bd441012365f0db6a48177cc7e908dce11790ca3a599ecd4516ba4fffe8df82d88b332b281025ca9f11b12b8f47f40b7efc272b711140141fbef0ee49f9abf12e7f1d3df516b649f7af5641f2320b57450ec1b73c574ea025402e7df26d60b4cf9e9a6ed1496cd06e0b5dc39e45b42698cf6fbc76f4957c7d03eee50275ee53a78b8bb5e52b914450a0fc61343f6aad71f115a872295c4b1345b58b83df239fa7313cd4ca5b3db3ed6042bf8306e7c76fbdad5b10305f03878cfc7c1e5340465283984f1744be9a3454f101709f7e5a60d74af3161af50345502c6011ebb5dc7be7487098179d7281ea07dd9e1e9baf1f528e0810ca02688761"
}

@@ -72,3 +84,6 @@ }

"aes192": "6e5696c139c01d69773a5391310de2ff",
"aes256": "185a9f2225cb2319e862aa7b4720fed5"
"aes256": "185a9f2225cb2319e862aa7b4720fed5",
"aes-128-cfb": "5afc1eadf2fb",
"aes-192-cfb": "30a3f27b7709",
"aes-256-cfb": "9266e13911f6"
},

@@ -81,3 +96,6 @@ "cipherivs": {

"aes192": "6e70ebaaff28349608f56498fd959ce5",
"aes256": "d6a6ee4a29a679aca37d6b3e2f0be7e8"
"aes256": "d6a6ee4a29a679aca37d6b3e2f0be7e8",
"aes-128-cfb": "5b5d3c47f2ac",
"aes-192-cfb": "64809bc44b10",
"aes-256-cfb": "9205f2d6c23b"
}

@@ -100,3 +118,6 @@ }

"aes192": "421f392130c54bbefd158ebf7a2dfbdfe4e3a60bc1d6ca7938572dcb566bf138",
"aes256": "664d1b94ece9c943085d5ea4a30cbe339838f3b675dc6b6ba5f8023738d9e144"
"aes256": "664d1b94ece9c943085d5ea4a30cbe339838f3b675dc6b6ba5f8023738d9e144",
"aes-128-cfb": "7e09b31f9ac9adea39976b33fdac6abd",
"aes-192-cfb": "4d8ded889a7b6188942c253a68b7af09",
"aes-256-cfb": "ad31744277697cdddfc361ecb2233d6d"
},

@@ -109,3 +130,6 @@ "cipherivs": {

"aes192": "615eab15470e067b3cb1d34c1d0ac670371abd52c6d24b7114a04231d6846b63",
"aes256": "7fce06852a9f19a946833b950d2e0f7fb89dd1889581165c350ccbe1f2360685"
"aes256": "7fce06852a9f19a946833b950d2e0f7fb89dd1889581165c350ccbe1f2360685",
"aes-128-cfb": "34adb0e5b44d764af0808eff9745d704",
"aes-192-cfb": "957ea1bcb6d9a139d5153623813db192",
"aes-256-cfb": "7ce64552d7320552347e2d3af0830ca0"
}

@@ -128,3 +152,6 @@ }

"aes192": "555c521eb3f309be1130cb92e0601e8239bd49b20ddb868bda3c13c04ee5b082",
"aes256": "161455bf919792f95ac914496f47784c590d42ed00e25414720ecc77fc094fe6"
"aes256": "161455bf919792f95ac914496f47784c590d42ed00e25414720ecc77fc094fe6",
"aes-128-cfb": "facb6cdc767f419c4ea03c256bac19979b",
"aes-192-cfb": "34aafbec0b57819744ba53b5d481a9b52a",
"aes-256-cfb": "13b4a117b97c730cd4195cd447005c6d3f"
},

@@ -137,3 +164,6 @@ "cipherivs": {

"aes192": "c3a33e105583fe7efd2302c6e79355108a9507ef487dff92a3eb18fef7dade5b",
"aes256": "4ba2f481b6f30a74268d08ae153f39ad3dbfa4ece13ea16e8a56b0efc5df026e"
"aes256": "4ba2f481b6f30a74268d08ae153f39ad3dbfa4ece13ea16e8a56b0efc5df026e",
"aes-128-cfb": "7af8f9e6715c1a95f27021ca5e43fe7e96",
"aes-192-cfb": "4c3a98af7e03e16563c1636a26d3508eda",
"aes-256-cfb": "6892cdc900665063523fb9b4940b2c111a"
}

@@ -156,3 +186,6 @@ }

"aes192": "7d937c3182ce33b51f9f7d34482042de",
"aes256": "8f25a9f28db8f672adc91354652306cc"
"aes256": "8f25a9f28db8f672adc91354652306cc",
"aes-128-cfb": "e51979ccd953c85c1c62cd3e064197",
"aes-192-cfb": "4e7906adbde09e88c2ea4ee5e6e645",
"aes-256-cfb": "f39fb153dead5bac4926ac4c1f69a9"
},

@@ -165,3 +198,6 @@ "cipherivs": {

"aes192": "c767360bcd75d774a4b89719fc2589b5",
"aes256": "8bfb71ae015f795c20c41d403b2ba973"
"aes256": "8bfb71ae015f795c20c41d403b2ba973",
"aes-128-cfb": "a0f218d4ca8260b99c321ce17cee51",
"aes-192-cfb": "59206a4c437279d2bb397f55d23236",
"aes-256-cfb": "24fcfa77fd9ab62df106f9ad36d62b"
}

@@ -168,0 +204,0 @@ }

@@ -46,4 +46,16 @@ var test = require('tape');

});
test(cipher + '-derypt', function (t) {
test(cipher + '-legacy', function (t) {
t.plan(1);
var suite = crypto.createCipher(cipher, new Buffer(fixture.password));
var buf = new Buffer('');
buf = Buffer.concat([buf, suite.update(new Buffer(fixture.text))]);
buf = Buffer.concat([buf, suite.final()]);
var suite2 = _crypto.createCipher(cipher, new Buffer(fixture.password));
var buf2 = new Buffer('');
buf2 = Buffer.concat([buf2, suite2.update(new Buffer(fixture.text))]);
buf2 = Buffer.concat([buf2, suite2.final()]);
t.equals(buf.toString('hex'), buf2.toString('hex'));
});
test(cipher + '-decrypt', function (t) {
t.plan(1);
var suite = crypto.createDecipher(cipher, new Buffer(fixture.password));

@@ -66,2 +78,15 @@ var buf = new Buffer('');

});
test(cipher + '-decrypt-legacy', function (t) {
t.plan(2);
var suite = crypto.createDecipher(cipher, new Buffer(fixture.password));
var buf = new Buffer('');
buf = Buffer.concat([buf, suite.update(new Buffer(fixture.results.ciphers[cipher], 'hex'))]);
buf = Buffer.concat([buf, suite.final()]);
var suite2 = _crypto.createDecipher(cipher, new Buffer(fixture.password));
var buf2 = new Buffer('');
buf2 = Buffer.concat([buf2, suite2.update(new Buffer(fixture.results.ciphers[cipher], 'hex'))]);
buf2 = Buffer.concat([buf2, suite2.final()]);
t.equals(buf.toString('utf8'), fixture.text);
t.equals(buf.toString('utf8'), buf2.toString('utf8'));
});
//var cipherivs = fixture.results.cipherivs = {};

@@ -88,2 +113,15 @@ types.forEach(function (cipher) {

});
test(cipher + '-legacy-iv', function (t) {
t.plan(2);
var suite = crypto.createCipheriv(cipher, ebtk(_crypto, fixture.password, modes[cipher].key).key, new Buffer(fixture.iv, 'hex'));
var buf = new Buffer('');
buf = Buffer.concat([buf, suite.update(new Buffer(fixture.text))]);
buf = Buffer.concat([buf, suite.final()]);
var suite2 = _crypto.createCipheriv(cipher, ebtk(_crypto, fixture.password, modes[cipher].key).key, new Buffer(fixture.iv, 'hex'));
var buf2 = new Buffer('');
buf2 = Buffer.concat([buf2, suite2.update(new Buffer(fixture.text))]);
buf2 = Buffer.concat([buf2, suite2.final()]);
t.equals(buf.toString('hex'), fixture.results.cipherivs[cipher]);
t.equals(buf.toString('hex'), buf2.toString('hex'));
});
test(cipher + '-iv-decrypt', function (t) {

@@ -105,4 +143,17 @@ t.plan(1);

});
test(cipher + '-decrypt-legacy', function (t) {
t.plan(2);
var suite = crypto.createDecipheriv(cipher, ebtk(_crypto, fixture.password, modes[cipher].key).key, new Buffer(fixture.iv, 'hex'));
var buf = new Buffer('');
buf = Buffer.concat([buf, suite.update(new Buffer(fixture.results.cipherivs[cipher], 'hex'))]);
buf = Buffer.concat([buf, suite.final()]);
var suite2 = _crypto.createDecipheriv(cipher, ebtk(_crypto, fixture.password, modes[cipher].key).key, new Buffer(fixture.iv, 'hex'));
var buf2 = new Buffer('');
buf2 = Buffer.concat([buf2, suite2.update(new Buffer(fixture.results.cipherivs[cipher], 'hex'))]);
buf2 = Buffer.concat([buf2, suite2.final()]);
t.equals(buf.toString('utf8'), fixture.text);
t.equals(buf.toString('utf8'), buf2.toString('utf8'));
});
});
});
});
module.exports = xor;
function xor(a, b) {
if (a.length !== b.length) {
throw new TypeError('must be same length');
}
var len = a.length;
var len = Math.min(a.length, b.length);
var out = new Buffer(len);

@@ -8,0 +5,0 @@ var i = -1;

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