[Pkg-javascript-commits] [node-browserify-aes] 07/92: script for populating fixtures

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 96ddbf2e3197585032241452d70e2d9dad1b2cc4
Author: Calvin Metcalf <cmetcalf at appgeo.com>
Date:   Thu Oct 16 14:25:23 2014 -0400

    script for populating fixtures
---
 populateFixtures.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/populateFixtures.js b/populateFixtures.js
new file mode 100644
index 0000000..2b21736
--- /dev/null
+++ b/populateFixtures.js
@@ -0,0 +1,22 @@
+var types = ['aes-128-ofb','aes-192-ofb','aes-256-ofb'];
+var fixtures = require('./test/fixtures.json');
+var crypto = require('crypto');
+var modes = require('./modes');
+var ebtk = require('./EVP_BytesToKey');
+var fs = require('fs');
+fixtures.forEach(function (fixture) {
+  //var ciphers = fixture.results.ciphers = {};
+  types.forEach(function (cipher) {
+      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()]);
+      fixture.results.ciphers[cipher] = buf.toString('hex');
+      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()]);
+      fixture.results.cipherivs[cipher] = buf2.toString('hex');
+    });
+});
+fs.writeFileSync('./test/fixturesNew.json', JSON.stringify(fixtures, false, 4));
\ No newline at end of file

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