[Pkg-javascript-commits] [node-browserify-aes] 04/92: cfb mode
Bastien Roucariès
rouca at moszumanska.debian.org
Sun Jun 4 09:35:15 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-browserify-aes.
commit 3c34efcdf43868f038a46af19081ba3af529987f
Author: Calvin Metcalf <cmetcalf at appgeo.com>
Date: Thu Oct 16 09:40:16 2014 -0400
cfb mode
---
decrypter.js | 40 ++++++++++++++++++++++++++++++++----
encrypter.js | 23 +++++++++++++++++++--
modes.js | 23 ++++++++++++++++++++-
test/fixtures.json | 60 +++++++++++++++++++++++++++++++++++++++++++-----------
xor.js | 5 +----
5 files changed, 128 insertions(+), 23 deletions(-)
diff --git a/decrypter.js b/decrypter.js
index 47df209..aec8ad0 100644
--- a/decrypter.js
+++ b/decrypter.js
@@ -13,9 +13,14 @@ function unpad(last) {
}
return last.slice(0, 16 - padded);
}
-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);
this.cache = new Buffer('');
@@ -34,6 +39,12 @@ Splitter.prototype._transform = function (data, _, next) {
}
next();
};
+Splitter.prototype._flush = function (next) {
+ if (this._padding === false) {
+ this.push(this.cache);
+ }
+ next();
+};
inherits(ECB, Transform);
function ECB(key) {
@@ -106,9 +117,30 @@ CBC.prototype._flush = function (next) {
}
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
};
module.exports = function (crypto) {
@@ -129,7 +161,7 @@ module.exports = function (crypto) {
if (iv.length !== config.iv) {
throw new TypeError('invalid iv length ' + iv.length);
}
- var splitter = new Splitter();
+ var splitter = new Splitter(config.padding);
var stream = new modeStreams[config.mode](password, iv);
splitter.on('data', function (d) {
stream.write(d);
diff --git a/encrypter.js b/encrypter.js
index 186087a..96b73ff 100644
--- a/encrypter.js
+++ b/encrypter.js
@@ -87,10 +87,29 @@ CBC.prototype._flush = function (next) {
this._cipher.scrub();
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) {
+ 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
};
module.exports = function (crypto) {
function createCipheriv(suite, password, iv) {
@@ -110,7 +129,7 @@ module.exports = function (crypto) {
if (iv.length !== config.iv) {
throw new TypeError('invalid iv length ' + iv.length);
}
- var splitter = new Splitter();
+ var splitter = new Splitter(config.padding);
var stream = new modeStreams[config.mode](password, iv);
splitter.on('data', function (d) {
stream.write(d);
diff --git a/modes.js b/modes.js
index 0ffbeba..9a364bf 100644
--- a/modes.js
+++ b/modes.js
@@ -36,4 +36,25 @@ exports['aes-256-cbc'] = {
};
exports['aes128'] = exports['aes-128-cbc'];
exports['aes192'] = exports['aes-192-cbc'];
-exports['aes256'] = exports['aes-256-cbc'];
\ No newline at end of file
+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
+};
\ No newline at end of file
diff --git a/test/fixtures.json b/test/fixtures.json
index 1dc28cd..6905318 100644
--- a/test/fixtures.json
+++ b/test/fixtures.json
@@ -13,7 +13,10 @@
"aes-256-cbc": "138839b0499e9bce8731bf0b9861b60c",
"aes128": "ab6d044a021986b9cb2ab2d11641b23f",
"aes192": "83fb920306c2d7f0c5ceb5dc7272357e",
- "aes256": "138839b0499e9bce8731bf0b9861b60c"
+ "aes256": "138839b0499e9bce8731bf0b9861b60c",
+ "aes-128-cfb": "6f60e632",
+ "aes-192-cfb": "7e595268",
+ "aes-256-cfb": "df60cff2"
},
"cipherivs": {
"aes-128-cbc": "f7407490d4cc14c7a0c026cbe19fb350",
@@ -21,7 +24,10 @@
"aes-256-cbc": "ad3e265d8c7375c2941850fcf59337e9",
"aes128": "f7407490d4cc14c7a0c026cbe19fb350",
"aes192": "87ed62214972949ed913b612a319ee1f",
- "aes256": "ad3e265d8c7375c2941850fcf59337e9"
+ "aes256": "ad3e265d8c7375c2941850fcf59337e9",
+ "aes-128-cfb": "e914ee82",
+ "aes-192-cfb": "3620077c",
+ "aes-256-cfb": "9e495087"
}
}
},
@@ -39,7 +45,10 @@
"aes-256-cbc": "e61484b76c26d646d10783110cad453244353988d80f0fe34e9c5991b75acccc08863d2f6ea0c9c9a69362566dfbeb98fea8029681bb8698895a02ed9887a90786ba168f594552805d41a8616aaef0a5b50c259a23b803f7cd24b2ad97e5f4b745f46643074818d946dc42fa0a9d6e1da1256818be90118a643b281971bbc12260de04d3256ceb11e87917712c1bdc0512f104a00ff5d5e2bdc532ba42035787c83b64ecbdb1b860058938241efdcc43ef62be6cbae85e582d9d5e846603909d9a9bf1019909c15d4cf36ebdfb7dd4666ae84c06568e531f50e59ba9b924cca3d46f76ab1d88 [...]
"aes128": "17403e6b8b30dc3dfe833edaf2af3cc20493766db8adee6a6775fd66b69acdd8d42c32fef9f8cf401ca6876bf7d2b36ebced41f58f9655c434a03162547e4998551de77a34dc7184bdb49b04fa672ec07ab9d843c9c58575c2637fe236973657f97a45075cb1ff8d18c87b5044c0f62d7962c559daab347da875ed21a87f73df4f2b3586ef21c1e068b8edd8727b139fa78fb86c43f25f9eedce21462fd2abba36179c1b29ce82b7f925e81f4c4138a309aa8adaa4f0f07a3749c2da4bb05b0ad9d56920771369ba32850c311f42ea0cc90e4dd087958d7cd53f3e631b7086357cc33169e337db699 [...]
"aes192": "9a79675d33a12c5fd5144d89752cf8591f0b595165b023800679b10ab59035b9df70f29e76e399ec30b2264178c3777c14550edad5860e1ef8f96ce3202f5208eb4316b066d911e4c89d1473cbe349a4aab7c87fb27f3e79a50925bc253aeacf61537fecf915d0b86558646d3beebb2e01eeb0a4d2d7152fef36a788c062453bd413bde5a5c5570f7b78721314699728f602e7e01397cbf8acf04c0a40df1a4a5e66ee42fba9a965bee4e2af3c92bef47dd6e330099263eba40cffc0717c37aeefa07ccbed4d3f6ce2e08c4c32146c8b072f887344a27cc92170d9ba9adc8528877b9a8909d818ae5 [...]
- "aes256": "e61484b76c26d646d10783110cad453244353988d80f0fe34e9c5991b75acccc08863d2f6ea0c9c9a69362566dfbeb98fea8029681bb8698895a02ed9887a90786ba168f594552805d41a8616aaef0a5b50c259a23b803f7cd24b2ad97e5f4b745f46643074818d946dc42fa0a9d6e1da1256818be90118a643b281971bbc12260de04d3256ceb11e87917712c1bdc0512f104a00ff5d5e2bdc532ba42035787c83b64ecbdb1b860058938241efdcc43ef62be6cbae85e582d9d5e846603909d9a9bf1019909c15d4cf36ebdfb7dd4666ae84c06568e531f50e59ba9b924cca3d46f76ab1d88324d0 [...]
+ "aes256": "e61484b76c26d646d10783110cad453244353988d80f0fe34e9c5991b75acccc08863d2f6ea0c9c9a69362566dfbeb98fea8029681bb8698895a02ed9887a90786ba168f594552805d41a8616aaef0a5b50c259a23b803f7cd24b2ad97e5f4b745f46643074818d946dc42fa0a9d6e1da1256818be90118a643b281971bbc12260de04d3256ceb11e87917712c1bdc0512f104a00ff5d5e2bdc532ba42035787c83b64ecbdb1b860058938241efdcc43ef62be6cbae85e582d9d5e846603909d9a9bf1019909c15d4cf36ebdfb7dd4666ae84c06568e531f50e59ba9b924cca3d46f76ab1d88324d0 [...]
+ "aes-128-cfb": "5225ff2b15584561697dcf84b17f68b72018561895e734cccedafb3c03929f4a1bc2d201e6b990f8debdc4b1228d43e4b89ab30797aa1b28dddf658bdc31ac2ba79229db43db926abdd94c50b6fd7b168ac4ab9ddde316cbe3e659de632bc9db56beff0f6c6b19e73c675ce9101ae2a6e86644dc66661b3f2253a6e6571d905a11971bce0f83877c0406d678cbce7f0876412bbac6faedcce9b95dcbfb5aa94fc610c4307e9d43f7a2c4ebbdce72d272ba8b7bc78f202bf376acf26d3557dd990c56ff80be5e0e8459f558d0b069ee569ea75287a1ebe74f11e912ea2d9cb68d9d72bacd4313 [...]
+ "aes-192-cfb": "431c4b713428cfc419ea2917b318efb47ccd70c259bfa69d6b6e591e12a811626722ef3ee2bf3215a74004a47395e09c62e4e58e9bba52765cf17814ea8e17545db49ef6a99b347b31a87fbabdd3a5d6266b5e567cd39f32e03f70d004c08e07f68e1057a7e230217b502b1c957ff2568f1dc6ebd957e514f77b120b2df4a3eb082c0f5492d76c57543aee46955658404c641438edc25d9a41ceb1e9e4bc3c952358b776ad696e51bb18451394c106455599933e50ac17d8011b37853535385a8e9dfe9dde74b83c2980511a31e02106e41aff550229afa242c7ea4dc1b251b0983de149ed3d [...]
+ "aes-256-cfb": "e225d6eb312195de58f18d155953985d9abcda4baa27503ff1963ee8aa733781a9f8bd10480af779eb637c6248c5e35929c39e75d2fa0ecfb993c6eb6c3ad339d9145079e77e9f809ceffaaada4d8992ee74a86835ef2cf6a1cfbe2389414b880d39b940a486b8937897c17f87cb80e3411a5478a6e51a593fe74fd9ff64a6376f10d259e27e2a2d7a0835abf6a240587665c5172bb19f0635e0d7918b1c8420785f03ee4835bae213a16ed6719e41ac9273ae1e94105e7dbad369acb14441e1cc2ab94d3f0eb210ac19dd6fbb84396672d92322b483ba482263ecd153f42894735c08fb03cb [...]
},
"cipherivs": {
"aes-128-cbc": "772b4d8e20a224a6ec0392b1fc6569693accb2709509ba265ddf5aafaecc11d77016a69e70255b7d7a5ddf7ad4d87511aa12ab987115ca157f1b9d9c3583339576e81f66cd716dfe0c561bfdff14eb842f05859c69da073759c5706da8afffc951b7dfd3c689e6cb8cc32426846f375043fe519872ec27796f6ad9cd588b800206ff4115198341c321198689f5d83e5f8e60c7c6e9dfe06dc17697dc058888a1180601ae2932ff8cfa9e15546422db6b74b05fb7e79ccc143b41cb7e8b4ede73a1f11da476bf89f106e655171848ec0ccf9c94ae3e858d06acc06712d54ab8a3791a67fb61c6 [...]
@@ -47,7 +56,10 @@
"aes-256-cbc": "4bd525802cd2ed487bbfad28a81764d381b7c83291edb366c73cca3167e19760a5023fa52821dfd44d22e314583c842659aba2d23e3118756a302426699415d88d6cf7eac4ea53a01e7ba1e9251ecc62d5ded26bf4b5420b19d1e96bce7453122ace17cc0621995429436693c584cfffc66d27a0d00419b499e672b2813730cbf97d142c68ac5f52e08632c4f76c6f8b9a0140429d731e996c17e3dca3d6b07af330c4189ed6eecd338b28c989736011cd2b8704ad43e5604f3655e86cfb6a3788a508f01896cb468926cf79be1a665e435d2d54844597575292b989a81f424a4f2190bcb829 [...]
"aes128": "772b4d8e20a224a6ec0392b1fc6569693accb2709509ba265ddf5aafaecc11d77016a69e70255b7d7a5ddf7ad4d87511aa12ab987115ca157f1b9d9c3583339576e81f66cd716dfe0c561bfdff14eb842f05859c69da073759c5706da8afffc951b7dfd3c689e6cb8cc32426846f375043fe519872ec27796f6ad9cd588b800206ff4115198341c321198689f5d83e5f8e60c7c6e9dfe06dc17697dc058888a1180601ae2932ff8cfa9e15546422db6b74b05fb7e79ccc143b41cb7e8b4ede73a1f11da476bf89f106e655171848ec0ccf9c94ae3e858d06acc06712d54ab8a3791a67fb61c6a8562 [...]
"aes192": "ba1d241268647886d3b9103013959edd378dccdc1f158f84ed560ca88c0c4a7863c13c914b0059d217ab32482168745225f78879c6d658653bd17277b6d9bac6cdce37dcd8dcb94b01fdebe358c33277f32d2989eb2970e434f653fc28e60dbb4fb9a14e14d5f38c30081c2e9d1a8ab145551257c448e24c91dd1adb99fc46ebcb633d4c8b3f91835bbbf9085cfb1a2f034a51c609f095c1a813fca49192e7f64cb959c664e24759f77c21c05faa90ce4c222ae6d87bf51b770c2888b7e0f059a7f06c4622e104dde2b8ffd447e6c0cff1a44cb9d54a1a16f5a90e97e4dccb5a7e135406ad0632f61 [...]
- "aes256": "4bd525802cd2ed487bbfad28a81764d381b7c83291edb366c73cca3167e19760a5023fa52821dfd44d22e314583c842659aba2d23e3118756a302426699415d88d6cf7eac4ea53a01e7ba1e9251ecc62d5ded26bf4b5420b19d1e96bce7453122ace17cc0621995429436693c584cfffc66d27a0d00419b499e672b2813730cbf97d142c68ac5f52e08632c4f76c6f8b9a0140429d731e996c17e3dca3d6b07af330c4189ed6eecd338b28c989736011cd2b8704ad43e5604f3655e86cfb6a3788a508f01896cb468926cf79be1a665e435d2d54844597575292b989a81f424a4f2190bcb829aadfb [...]
+ "aes256": "4bd525802cd2ed487bbfad28a81764d381b7c83291edb366c73cca3167e19760a5023fa52821dfd44d22e314583c842659aba2d23e3118756a302426699415d88d6cf7eac4ea53a01e7ba1e9251ecc62d5ded26bf4b5420b19d1e96bce7453122ace17cc0621995429436693c584cfffc66d27a0d00419b499e672b2813730cbf97d142c68ac5f52e08632c4f76c6f8b9a0140429d731e996c17e3dca3d6b07af330c4189ed6eecd338b28c989736011cd2b8704ad43e5604f3655e86cfb6a3788a508f01896cb468926cf79be1a665e435d2d54844597575292b989a81f424a4f2190bcb829aadfb [...]
+ "aes-128-cfb": "0304a8ae497c46305a87df178b39538be455205fd10d1828ecaad1939fdb385352c904b5b18fd89fe5a18ecd09ac677fbad2261d4693e4dd9e6d880d390f1eadb4bee741b9616c24f0b5aad321e26f0164829411db3e4da23eebe6f2e2aff49b2b62719bbbbdc6b9b8f03093b1ed4b35b3d1bf2f51b1b7859fb6f31b1e8bf722900ead0497594a96c8686da60100c349caa3a814a322c775604875d2d6fb0db51a539d4d0d52b312fa5c9d6e8816b78b16c0a8909c80096e2744d54d7505e7d375d3373d007bdbf2ecc60d9b0fe70ffd1937ae32c59925770530778c96bbbb198ccb5d526d47 [...]
+ "aes-192-cfb": "35f1e120808e87537835e1cce77e65736fd163fc25dca73c86a9e1a7d49a66be47d2fc9c307faac6691cf12816a8166f2053a5728007a85535694b4dc9f0337e9b17e4c1e9ced6c5c58a1b747e2765a54141e864a2c9500b3d96d7f861b2259f777cd74dffe2f5def6cae7969384a163b7adf61fd6cdb05cf9d10bda269c91f5cfcbc325cc50f1fb3424af848d4308b3103223e4757b01b87f1408c6608fd4a401da33d1c1199271d757f8d9b7a5e58924ef76914c34f2fb35a86b2707b50bae259f3fb7bad9991cb2dd3e33ade251ac52052d87fb9415921d35a5d223a4385d384a33b27276 [...]
+ "aes-256-cfb": "831ec789aecaa6fd45e28074bea498ffb82b9c36faf042949fda04f02cee48f0a4a3e0db27e6fa4297c4d715885dc54bcb341d13de8a20985eaaad64fff240e068cc62dbacb9698e98d33b6a3d22ce16e6c178f6999441f55f434f95a988e5db92a96ecb1815e68f1b26f777faa98b95fcd91905ee8a26efe62a4069080eec24a82eaf22f2256cb4a2d714309e0bc69f580e20d8ddabcd67a3c859531c9b9190b23068e4729d5647c2b959084ae976c9bf284d0b9299e638c3afa5cf3b97c03a78cc9bde27ea1107513fd7b9cbe085726a06fa301cc63a3aa30ba962fc63ff00199899500f20 [...]
}
}
},
@@ -65,7 +77,10 @@
"aes-256-cbc": "185a9f2225cb2319e862aa7b4720fed5",
"aes128": "3141a23b60758eec9e6bda24cad914ae",
"aes192": "6e5696c139c01d69773a5391310de2ff",
- "aes256": "185a9f2225cb2319e862aa7b4720fed5"
+ "aes256": "185a9f2225cb2319e862aa7b4720fed5",
+ "aes-128-cfb": "5afc1eadf2fb",
+ "aes-192-cfb": "30a3f27b7709",
+ "aes-256-cfb": "9266e13911f6"
},
"cipherivs": {
"aes-128-cbc": "c9f85747bd44921917d9266f7d7253b3",
@@ -73,7 +88,10 @@
"aes-256-cbc": "d6a6ee4a29a679aca37d6b3e2f0be7e8",
"aes128": "c9f85747bd44921917d9266f7d7253b3",
"aes192": "6e70ebaaff28349608f56498fd959ce5",
- "aes256": "d6a6ee4a29a679aca37d6b3e2f0be7e8"
+ "aes256": "d6a6ee4a29a679aca37d6b3e2f0be7e8",
+ "aes-128-cfb": "5b5d3c47f2ac",
+ "aes-192-cfb": "64809bc44b10",
+ "aes-256-cfb": "9205f2d6c23b"
}
}
},
@@ -91,7 +109,10 @@
"aes-256-cbc": "664d1b94ece9c943085d5ea4a30cbe339838f3b675dc6b6ba5f8023738d9e144",
"aes128": "69260f6a155f0aa159248533425308108cfcf3322b079495337bfba733edaaf9",
"aes192": "421f392130c54bbefd158ebf7a2dfbdfe4e3a60bc1d6ca7938572dcb566bf138",
- "aes256": "664d1b94ece9c943085d5ea4a30cbe339838f3b675dc6b6ba5f8023738d9e144"
+ "aes256": "664d1b94ece9c943085d5ea4a30cbe339838f3b675dc6b6ba5f8023738d9e144",
+ "aes-128-cfb": "7e09b31f9ac9adea39976b33fdac6abd",
+ "aes-192-cfb": "4d8ded889a7b6188942c253a68b7af09",
+ "aes-256-cfb": "ad31744277697cdddfc361ecb2233d6d"
},
"cipherivs": {
"aes-128-cbc": "98e1b648e99996a2dff688b8418cd173fc2d2b809ff8659e45291ed92f7741f2",
@@ -99,7 +120,10 @@
"aes-256-cbc": "7fce06852a9f19a946833b950d2e0f7fb89dd1889581165c350ccbe1f2360685",
"aes128": "98e1b648e99996a2dff688b8418cd173fc2d2b809ff8659e45291ed92f7741f2",
"aes192": "615eab15470e067b3cb1d34c1d0ac670371abd52c6d24b7114a04231d6846b63",
- "aes256": "7fce06852a9f19a946833b950d2e0f7fb89dd1889581165c350ccbe1f2360685"
+ "aes256": "7fce06852a9f19a946833b950d2e0f7fb89dd1889581165c350ccbe1f2360685",
+ "aes-128-cfb": "34adb0e5b44d764af0808eff9745d704",
+ "aes-192-cfb": "957ea1bcb6d9a139d5153623813db192",
+ "aes-256-cfb": "7ce64552d7320552347e2d3af0830ca0"
}
}
},
@@ -117,7 +141,10 @@
"aes-256-cbc": "161455bf919792f95ac914496f47784c590d42ed00e25414720ecc77fc094fe6",
"aes128": "3294feaaef04a0fa15bf2485301594fb1de6c201f936fc9308070ccf69f30fcd",
"aes192": "555c521eb3f309be1130cb92e0601e8239bd49b20ddb868bda3c13c04ee5b082",
- "aes256": "161455bf919792f95ac914496f47784c590d42ed00e25414720ecc77fc094fe6"
+ "aes256": "161455bf919792f95ac914496f47784c590d42ed00e25414720ecc77fc094fe6",
+ "aes-128-cfb": "facb6cdc767f419c4ea03c256bac19979b",
+ "aes-192-cfb": "34aafbec0b57819744ba53b5d481a9b52a",
+ "aes-256-cfb": "13b4a117b97c730cd4195cd447005c6d3f"
},
"cipherivs": {
"aes-128-cbc": "ca7451a2b66305ea1a1793d5417b0b3c4d477abb2a42e08bbcc3ecae51cc1e1a",
@@ -125,7 +152,10 @@
"aes-256-cbc": "4ba2f481b6f30a74268d08ae153f39ad3dbfa4ece13ea16e8a56b0efc5df026e",
"aes128": "ca7451a2b66305ea1a1793d5417b0b3c4d477abb2a42e08bbcc3ecae51cc1e1a",
"aes192": "c3a33e105583fe7efd2302c6e79355108a9507ef487dff92a3eb18fef7dade5b",
- "aes256": "4ba2f481b6f30a74268d08ae153f39ad3dbfa4ece13ea16e8a56b0efc5df026e"
+ "aes256": "4ba2f481b6f30a74268d08ae153f39ad3dbfa4ece13ea16e8a56b0efc5df026e",
+ "aes-128-cfb": "7af8f9e6715c1a95f27021ca5e43fe7e96",
+ "aes-192-cfb": "4c3a98af7e03e16563c1636a26d3508eda",
+ "aes-256-cfb": "6892cdc900665063523fb9b4940b2c111a"
}
}
},
@@ -143,7 +173,10 @@
"aes-256-cbc": "8f25a9f28db8f672adc91354652306cc",
"aes128": "aa1822f4394c2121014d77544682395c",
"aes192": "7d937c3182ce33b51f9f7d34482042de",
- "aes256": "8f25a9f28db8f672adc91354652306cc"
+ "aes256": "8f25a9f28db8f672adc91354652306cc",
+ "aes-128-cfb": "e51979ccd953c85c1c62cd3e064197",
+ "aes-192-cfb": "4e7906adbde09e88c2ea4ee5e6e645",
+ "aes-256-cfb": "f39fb153dead5bac4926ac4c1f69a9"
},
"cipherivs": {
"aes-128-cbc": "af45c639b04747b2eaf310b52c51dfeb",
@@ -151,7 +184,10 @@
"aes-256-cbc": "8bfb71ae015f795c20c41d403b2ba973",
"aes128": "af45c639b04747b2eaf310b52c51dfeb",
"aes192": "c767360bcd75d774a4b89719fc2589b5",
- "aes256": "8bfb71ae015f795c20c41d403b2ba973"
+ "aes256": "8bfb71ae015f795c20c41d403b2ba973",
+ "aes-128-cfb": "a0f218d4ca8260b99c321ce17cee51",
+ "aes-192-cfb": "59206a4c437279d2bb397f55d23236",
+ "aes-256-cfb": "24fcfa77fd9ab62df106f9ad36d62b"
}
}
}
diff --git a/xor.js b/xor.js
index b78a2c2..f504ea8 100644
--- a/xor.js
+++ b/xor.js
@@ -1,9 +1,6 @@
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);
var i = -1;
while (++i < len) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browserify-aes.git
More information about the Pkg-javascript-commits
mailing list