[Pkg-javascript-commits] [node-browserify-aes] 24/92: actually break up the strings like I thought I was

Bastien Roucariès rouca at moszumanska.debian.org
Sun Jun 4 09:35:17 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 91aa73189e7a5ef035af51ac0a00d7928bd4bc4d
Author: Calvin Metcalf <cmetcalf at appgeo.com>
Date:   Tue Oct 28 15:41:46 2014 -0400

    actually break up the strings like I thought I was
---
 test/index.js | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/test/index.js b/test/index.js
index 85fac24..5f173ed 100644
--- a/test/index.js
+++ b/test/index.js
@@ -5,22 +5,6 @@ var crypto = require('../');
 var modes = require('../modes');
 var types = Object.keys(modes);
 var ebtk = require('../EVP_BytesToKey');
-function decriptNoPadding(cipher, password, thing, code) {
-  var suite = _crypto.createDecipher(cipher, password);
-  var buf = new Buffer('');
-  suite.on('data', function (d) {
-    buf = Buffer.concat([buf, d]);
-  });
-  suite.on('error', function (e) {
-    console.log(e);
-  });
-  suite.on("finish", function () {
-    console.log(code, buf.toString('hex'));
-  });
-  suite.setAutoPadding(false);
-  suite.write(thing, 'hex');
-  suite.end();
-}
 fixtures.forEach(function (fixture, i) {
   //var ciphers = fixture.results.ciphers = {};
   types.forEach(function (cipher) {
@@ -50,7 +34,7 @@ fixtures.forEach(function (fixture, i) {
       var suite2 = _crypto.createCipher(cipher, new Buffer(fixture.password));
       var buf2 = new Buffer('');
       var inbuf = new Buffer(fixture.text);
-      var mid = ~~inbuf.length;
+      var mid = ~~(inbuf.length/2);
       buf = Buffer.concat([buf, suite.update(inbuf.slice(0, mid))]);
       buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(0, mid))]);
       t.equals(buf.toString('hex'), buf2.toString('hex'), 'intermediate');
@@ -87,7 +71,7 @@ fixtures.forEach(function (fixture, i) {
       var suite2 = _crypto.createDecipher(cipher, new Buffer(fixture.password));
       var buf2 = new Buffer('');
       var inbuf = new Buffer(fixture.results.ciphers[cipher], 'hex');
-      var mid = ~~inbuf.length;
+      var mid = ~~(inbuf.length/2);
       buf = Buffer.concat([buf, suite.update(inbuf.slice(0, mid))]);
       buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(0, mid))]);
       t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'intermediate');
@@ -127,7 +111,7 @@ fixtures.forEach(function (fixture, i) {
         var suite2 = _crypto.createCipheriv(cipher, ebtk(_crypto, fixture.password, modes[cipher].key).key, new Buffer(fixture.iv, 'hex'));
         var buf2 = new Buffer('');
         var inbuf = new Buffer(fixture.text);
-        var mid = ~~inbuf.length;
+        var mid = ~~(inbuf.length/2);
         buf = Buffer.concat([buf, suite.update(inbuf.slice(0, mid))]);
         buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(0, mid))]);
         t.equals(buf.toString('hex'), buf2.toString('hex'), 'intermediate');
@@ -162,7 +146,7 @@ fixtures.forEach(function (fixture, i) {
         var suite2 = _crypto.createDecipheriv(cipher, ebtk(_crypto, fixture.password, modes[cipher].key).key, new Buffer(fixture.iv, 'hex'));
         var buf2 = new Buffer('');
         var inbuf = new Buffer(fixture.results.cipherivs[cipher], 'hex');
-        var mid = ~~inbuf.length;
+        var mid = ~~(inbuf.length/2);
         buf = Buffer.concat([buf, suite.update(inbuf.slice(0, mid))]);
         buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(0, mid))]);
         t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'intermediate');

-- 
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