[Pkg-javascript-commits] [node-browserify-aes] 17/92: final and update on prototype
Bastien Roucariès
rouca at moszumanska.debian.org
Sun Jun 4 09:35:16 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 76fbe31d82a9e30be64b625d949edcae1c792458
Author: Calvin Metcalf <cmetcalf at appgeo.com>
Date: Fri Oct 17 08:23:22 2014 -0400
final and update on prototype
---
decrypter.js | 53 ++++++++++++++++++++++++++---------------------------
encrypter.js | 54 +++++++++++++++++++++++++++---------------------------
2 files changed, 53 insertions(+), 54 deletions(-)
diff --git a/decrypter.js b/decrypter.js
index 63ad418..21f38ec 100644
--- a/decrypter.js
+++ b/decrypter.js
@@ -45,6 +45,31 @@ Decipher.prototype._flush = function (next) {
}
next();
};
+Decipher.prototype.update = function (data, inputEnd, outputEnc) {
+ this.write(data, inputEnd);
+ var outData = new Buffer('');
+ var chunk;
+ while ((chunk = this.read())) {
+ outData = Buffer.concat([outData, chunk]);
+ }
+ if (outputEnc) {
+ outData = outData.toString(outputEnc);
+ }
+ return outData;
+};
+Decipher.prototype.final = function (outputEnc) {
+ this.end();
+ var outData = new Buffer('');
+ var chunk;
+ while ((chunk = this.read())) {
+ outData = Buffer.concat([outData, chunk]);
+ }
+ if (outputEnc) {
+ outData = outData.toString(outputEnc);
+ }
+ return outData;
+};
+
function Splitter() {
if (!(this instanceof Splitter)) {
return new Splitter();
@@ -102,33 +127,7 @@ module.exports = function (crypto) {
if (iv.length !== config.iv) {
throw new TypeError('invalid iv length ' + iv.length);
}
- var decipher = new Decipher(config.padding, modelist[config.mode], password, iv);
-
- decipher.update = function (data, inputEnd, outputEnc) {
- decipher.write(data, inputEnd);
- var outData = new Buffer('');
- var chunk;
- while ((chunk = decipher.read())) {
- outData = Buffer.concat([outData, chunk]);
- }
- if (outputEnc) {
- outData = outData.toString(outputEnc);
- }
- return outData;
- };
- decipher.final = function (outputEnc) {
- decipher.end();
- var outData = new Buffer('');
- var chunk;
- while ((chunk = decipher.read())) {
- outData = Buffer.concat([outData, chunk]);
- }
- if (outputEnc) {
- outData = outData.toString(outputEnc);
- }
- return outData;
- };
- return decipher;
+ return new Decipher(config.padding, modelist[config.mode], password, iv);
}
function createDecipher (suite, password) {
diff --git a/encrypter.js b/encrypter.js
index 2f01eb1..d14ebac 100644
--- a/encrypter.js
+++ b/encrypter.js
@@ -31,6 +31,32 @@ Cipher.prototype._flush = function (next) {
this._cipher.scrub();
next();
};
+
+Cipher.prototype.update = function (data, inputEnd, outputEnc) {
+ this.write(data, inputEnd);
+ var outData = new Buffer('');
+ var chunk;
+ while ((chunk = this.read())) {
+ outData = Buffer.concat([outData, chunk]);
+ }
+ if (outputEnc) {
+ outData = outData.toString(outputEnc);
+ }
+ return outData;
+};
+Cipher.prototype.final = function (outputEnc) {
+ this.end();
+ var outData = new Buffer('');
+ var chunk;
+ while ((chunk = this.read())) {
+ outData = Buffer.concat([outData, chunk]);
+ }
+ if (outputEnc) {
+ outData = outData.toString(outputEnc);
+ }
+ return outData;
+};
+
function Splitter(padding) {
if (!(this instanceof Splitter)) {
return new Splitter(padding);
@@ -93,33 +119,7 @@ module.exports = function (crypto) {
if (iv.length !== config.iv) {
throw new TypeError('invalid iv length ' + iv.length);
}
- var cipher = new Cipher(config.padding, modelist[config.mode], password, iv);
-
- cipher.update = function (data, inputEnd, outputEnc) {
- cipher.write(data, inputEnd);
- var outData = new Buffer('');
- var chunk;
- while ((chunk = cipher.read())) {
- outData = Buffer.concat([outData, chunk]);
- }
- if (outputEnc) {
- outData = outData.toString(outputEnc);
- }
- return outData;
- };
- cipher.final = function (outputEnc) {
- cipher.end();
- var outData = new Buffer('');
- var chunk;
- while ((chunk = cipher.read())) {
- outData = Buffer.concat([outData, chunk]);
- }
- if (outputEnc) {
- outData = outData.toString(outputEnc);
- }
- return outData;
- };
- return cipher;
+ return new Cipher(config.padding, modelist[config.mode], password, iv);
}
function createCipher (suite, password) {
var config = modes[suite];
--
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