Browse Source

Increased runtime performance with `rc4` `stringArrayEncoding`

sanex3339 8 years ago
parent
commit
2de0543d57

+ 1 - 0
CHANGELOG.md

@@ -7,6 +7,7 @@ v0.10.0
 * **New option:** `mangle` enables mangling of variable names.
 * **New option:** `mangle` enables mangling of variable names.
 * `escapeUnicodeSequence` option now disabled by default.
 * `escapeUnicodeSequence` option now disabled by default.
 * `controlFlowFlattening` now affects string literal nodes.
 * `controlFlowFlattening` now affects string literal nodes.
+* increased runtime performance with `rc4` `stringArrayEncoding`.
 
 
 v0.9.2
 v0.9.2
 ---
 ---

+ 29 - 27
dist/index.js

@@ -33,9 +33,9 @@ module.exports =
 /******/ 	function __webpack_require__(moduleId) {
 /******/ 	function __webpack_require__(moduleId) {
 /******/
 /******/
 /******/ 		// Check if module is in cache
 /******/ 		// Check if module is in cache
-/******/ 		if(installedModules[moduleId])
+/******/ 		if(installedModules[moduleId]) {
 /******/ 			return installedModules[moduleId].exports;
 /******/ 			return installedModules[moduleId].exports;
-/******/
+/******/ 		}
 /******/ 		// Create a new module (and put it into the cache)
 /******/ 		// Create a new module (and put it into the cache)
 /******/ 		var module = installedModules[moduleId] = {
 /******/ 		var module = installedModules[moduleId] = {
 /******/ 			i: moduleId,
 /******/ 			i: moduleId,
@@ -153,6 +153,7 @@ var _createClass = (function () { function defineProperties(target, props) { for
 
 
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var escodegen = __webpack_require__(23);
 var escodegen = __webpack_require__(23);
 var esprima = __webpack_require__(36);
 var esprima = __webpack_require__(36);
 var estraverse = __webpack_require__(11);
 var estraverse = __webpack_require__(11);
@@ -441,7 +442,6 @@ exports.RandomGeneratorUtils = RandomGeneratorUtils;
 "use strict";
 "use strict";
 
 
 
 
-var tslib_1 = __webpack_require__(1);
 function initializable() {
 function initializable() {
     var initializeMethodKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'initialize';
     var initializeMethodKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'initialize';
 
 
@@ -453,21 +453,21 @@ function initializable() {
         };
         };
         var initializeMethod = target[initializeMethodKey];
         var initializeMethod = target[initializeMethodKey];
         if (!initializeMethod || typeof initializeMethod !== 'function') {
         if (!initializeMethod || typeof initializeMethod !== 'function') {
-            throw new Error("`" + initializeMethodKey + "` method with initialization logic not found. `@" + decoratorName + "` decorator requires `" + initializeMethodKey + "` method");
+            throw new Error('`' + initializeMethodKey + '` method with initialization logic not found. `@' + decoratorName + '` decorator requires `' + initializeMethodKey + '` method');
         }
         }
-        var metadataPropertyKey = "_" + propertyKey;
+        var metadataPropertyKey = '_' + propertyKey;
         var propertyDescriptor = Object.getOwnPropertyDescriptor(target, metadataPropertyKey) || descriptor;
         var propertyDescriptor = Object.getOwnPropertyDescriptor(target, metadataPropertyKey) || descriptor;
         var methodDescriptor = Object.getOwnPropertyDescriptor(target, initializeMethodKey) || descriptor;
         var methodDescriptor = Object.getOwnPropertyDescriptor(target, initializeMethodKey) || descriptor;
         var originalMethod = methodDescriptor.value;
         var originalMethod = methodDescriptor.value;
-        Object.defineProperty(target, propertyKey, tslib_1.__assign({}, propertyDescriptor, { get: function get() {
+        Object.defineProperty(target, propertyKey, Object.assign({}, propertyDescriptor, { get: function get() {
                 if (this[metadataPropertyKey] === undefined) {
                 if (this[metadataPropertyKey] === undefined) {
-                    throw new Error("Property `" + propertyKey + "` is not initialized! Initialize it first!");
+                    throw new Error('Property `' + propertyKey + '` is not initialized! Initialize it first!');
                 }
                 }
                 return this[metadataPropertyKey];
                 return this[metadataPropertyKey];
             }, set: function set(newVal) {
             }, set: function set(newVal) {
                 this[metadataPropertyKey] = newVal;
                 this[metadataPropertyKey] = newVal;
             } }));
             } }));
-        Object.defineProperty(target, initializeMethodKey, tslib_1.__assign({}, methodDescriptor, { value: function value() {
+        Object.defineProperty(target, initializeMethodKey, Object.assign({}, methodDescriptor, { value: function value() {
                 originalMethod.apply(this, arguments);
                 originalMethod.apply(this, arguments);
                 if (this[propertyKey]) {}
                 if (this[propertyKey]) {}
             } }));
             } }));
@@ -1531,6 +1531,7 @@ exports.AbstractReplacer = AbstractReplacer;
 "use strict";
 "use strict";
 
 
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var SourceMapMode_1 = __webpack_require__(20);
 var SourceMapMode_1 = __webpack_require__(20);
 exports.NO_CUSTOM_NODES_PRESET = Object.freeze({
 exports.NO_CUSTOM_NODES_PRESET = Object.freeze({
     compact: true,
     compact: true,
@@ -1647,6 +1648,7 @@ var AbstractControlFlowReplacer_1;
 "use strict";
 "use strict";
 
 
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var SourceMapMode_1 = __webpack_require__(20);
 var SourceMapMode_1 = __webpack_require__(20);
 exports.DEFAULT_PRESET = Object.freeze({
 exports.DEFAULT_PRESET = Object.freeze({
     compact: true,
     compact: true,
@@ -2120,6 +2122,7 @@ var _createClass = (function () { function defineProperties(target, props) { for
 
 
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var tslib_1 = __webpack_require__(1);
 var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var ServiceIdentifiers_1 = __webpack_require__(2);
@@ -2239,6 +2242,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
 
 
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var tslib_1 = __webpack_require__(1);
 var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var ServiceIdentifiers_1 = __webpack_require__(2);
@@ -2354,6 +2358,7 @@ var _createClass = (function () { function defineProperties(target, props) { for
 
 
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var tslib_1 = __webpack_require__(1);
 var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var ServiceIdentifiers_1 = __webpack_require__(2);
@@ -2503,6 +2508,7 @@ var _createClass = (function () { function defineProperties(target, props) { for
 
 
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var commander = __webpack_require__(138);
 var commander = __webpack_require__(138);
 var path = __webpack_require__(37);
 var path = __webpack_require__(37);
 var SourceMapMode_1 = __webpack_require__(20);
 var SourceMapMode_1 = __webpack_require__(20);
@@ -4053,7 +4059,7 @@ var NodeCallsControllerFunctionNode = function (_AbstractCustomNode_) {
             if (this.appendEvent === ObfuscationEvents_1.ObfuscationEvents.AfterObfuscation) {
             if (this.appendEvent === ObfuscationEvents_1.ObfuscationEvents.AfterObfuscation) {
                 return JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
                 return JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
                     singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                     singleNodeCallControllerFunctionName: this.callsControllerFunctionName
-                }), tslib_1.__assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
+                }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
             }
             }
             return format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
             return format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
                 singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                 singleNodeCallControllerFunctionName: this.callsControllerFunctionName
@@ -4267,7 +4273,7 @@ var StringArrayCallsWrapper = function (_AbstractCustomNode_) {
                 decodeNodeTemplate: decodeNodeTemplate,
                 decodeNodeTemplate: decodeNodeTemplate,
                 stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
                 stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
                 stringArrayName: this.stringArrayName
                 stringArrayName: this.stringArrayName
-            }), tslib_1.__assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
+            }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
         }
         }
     }, {
     }, {
         key: "getDecodeStringArrayTemplate",
         key: "getDecodeStringArrayTemplate",
@@ -4448,7 +4454,7 @@ var StringArrayRotateFunctionNode = function (_AbstractCustomNode_) {
                 stringArrayName: this.stringArrayName,
                 stringArrayName: this.stringArrayName,
                 stringArrayRotateValue: Utils_1.Utils.decToHex(this.stringArrayRotateValue),
                 stringArrayRotateValue: Utils_1.Utils.decToHex(this.stringArrayRotateValue),
                 whileFunctionName: whileFunctionName
                 whileFunctionName: whileFunctionName
-            }), tslib_1.__assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
+            }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
         }
         }
     }]);
     }]);
 
 
@@ -5207,8 +5213,6 @@ var MethodDefinitionTransformer_1;
 "use strict";
 "use strict";
 
 
 
 
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
 var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
 var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
 
 
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -5265,17 +5269,11 @@ var TemplateLiteralTransformer = TemplateLiteralTransformer_1 = function (_Abstr
                 nodes.unshift(Nodes_1.Nodes.getLiteralNode(''));
                 nodes.unshift(Nodes_1.Nodes.getLiteralNode(''));
             }
             }
             if (nodes.length > 1) {
             if (nodes.length > 1) {
-                var _ret = function () {
-                    var root = Nodes_1.Nodes.getBinaryExpressionNode('+', nodes.shift(), nodes.shift());
-                    nodes.forEach(function (node) {
-                        root = Nodes_1.Nodes.getBinaryExpressionNode('+', root, node);
-                    });
-                    return {
-                        v: root
-                    };
-                }();
-
-                if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
+                var root = Nodes_1.Nodes.getBinaryExpressionNode('+', nodes.shift(), nodes.shift());
+                nodes.forEach(function (node) {
+                    root = Nodes_1.Nodes.getBinaryExpressionNode('+', root, node);
+                });
+                return root;
             }
             }
             return nodes[0];
             return nodes[0];
         }
         }
@@ -5307,6 +5305,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
 
 
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var tslib_1 = __webpack_require__(1);
 var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var ServiceIdentifiers_1 = __webpack_require__(2);
@@ -6370,6 +6369,7 @@ var StringLiteralReplacer_1;
 
 
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 var tslib_1 = __webpack_require__(1);
 var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var inversify_1 = __webpack_require__(0);
 var class_validator_1 = __webpack_require__(137);
 var class_validator_1 = __webpack_require__(137);
@@ -6861,7 +6861,7 @@ var StackTraceAnalyzer = StackTraceAnalyzer_1 = function () {
                 if (!calleeData) {
                 if (!calleeData) {
                     return;
                     return;
                 }
                 }
-                stackTraceData.push(tslib_1.__assign({}, calleeData, { stackTrace: _this2.analyzeRecursive(calleeData.callee.body) }));
+                stackTraceData.push(Object.assign({}, calleeData, { stackTrace: _this2.analyzeRecursive(calleeData.callee.body) }));
             });
             });
         }
         }
     }], [{
     }], [{
@@ -7535,8 +7535,9 @@ exports.SelfDefendingTemplate = SelfDefendingTemplate;
 "use strict";
 "use strict";
 
 
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 function StringArrayBase64DecodeNodeTemplate() {
 function StringArrayBase64DecodeNodeTemplate() {
-    return "      \n        if ({stringArrayCallsWrapperName}.initialized === undefined) {\n            {atobPolyfill}\n            \n            {stringArrayCallsWrapperName}.base64DecodeUnicode = function (str) {\n                var string = atob(str);\n                var newStringChars = [];\n                \n                for (var i = 0, length = string.length; i < length; i++) {\n                    newStringChars += '%' + ('00' + string.charCodeAt(i).toString(16)).slice(-2);\n                }\n                \n                return decodeURIComponent(newStringChars);\n            };\n            \n            {stringArrayCallsWrapperName}.data = {};\n            \n            {stringArrayCallsWrapperName}.initialized = true;\n        }\n                        \n        if ({stringArrayCallsWrapperName}.data[index] === undefined) {\n            {selfDefendingCode}\n            \n            value = {stringArrayCallsWrapperName}.base64DecodeUnicode(value);\n            {stringArrayCallsWrapperName}.data[index] = value;\n        } else {\n            value = {stringArrayCallsWrapperName}.data[index];\n        }  \n    ";
+    return "      \n        if ({stringArrayCallsWrapperName}.initialized === undefined) {\n            {atobPolyfill}\n            \n            {stringArrayCallsWrapperName}.base64DecodeUnicode = function (str) {\n                var string = atob(str);\n                var newStringChars = [];\n                \n                for (var i = 0, length = string.length; i < length; i++) {\n                    newStringChars += '%' + ('00' + string.charCodeAt(i).toString(16)).slice(-2);\n                }\n                \n                return decodeURIComponent(newStringChars);\n            };\n            \n            {stringArrayCallsWrapperName}.data = {};\n            \n            {stringArrayCallsWrapperName}.initialized = true;\n        }\n                  \n        var cachedValue = {stringArrayCallsWrapperName}.data[index];\n                        \n        if (cachedValue === undefined) {\n            {selfDefendingCode}\n            \n            value = {stringArrayCallsWrapperName}.base64DecodeUnicode(value);\n            {stringArrayCallsWrapperName}.data[index] = value;\n        } else {\n            value = cachedValue;\n        }  \n    ";
 }
 }
 exports.StringArrayBase64DecodeNodeTemplate = StringArrayBase64DecodeNodeTemplate;
 exports.StringArrayBase64DecodeNodeTemplate = StringArrayBase64DecodeNodeTemplate;
 
 
@@ -7559,8 +7560,9 @@ exports.StringArrayCallsWrapperTemplate = StringArrayCallsWrapperTemplate;
 "use strict";
 "use strict";
 
 
 
 
+Object.defineProperty(exports, "__esModule", { value: true });
 function StringArrayRc4DecodeNodeTemplate() {
 function StringArrayRc4DecodeNodeTemplate() {
-    return "\n        if ({stringArrayCallsWrapperName}.initialized === undefined) {\n            {atobPolyfill}\n            \n            {rc4Polyfill}\n            {stringArrayCallsWrapperName}.rc4 = rc4;\n            \n            {stringArrayCallsWrapperName}.data = {};\n            \n            {stringArrayCallsWrapperName}.initialized = true;\n        }\n        \n        index += key;\n\n        if ({stringArrayCallsWrapperName}.data[index] === undefined) {\n            if ({stringArrayCallsWrapperName}.once === undefined) {\n                {selfDefendingCode}\n                \n                {stringArrayCallsWrapperName}.once = true;\n            }\n            \n            value = {stringArrayCallsWrapperName}.rc4(value, key);\n            {stringArrayCallsWrapperName}.data[index] = value;\n        } else {\n            value = {stringArrayCallsWrapperName}.data[index];\n        }\n    ";
+    return "\n        if ({stringArrayCallsWrapperName}.initialized === undefined) {\n            {atobPolyfill}\n            \n            {rc4Polyfill}\n            {stringArrayCallsWrapperName}.rc4 = rc4;\n            \n            {stringArrayCallsWrapperName}.data = {};\n            \n            {stringArrayCallsWrapperName}.initialized = true;\n        }\n  \n        var cachedValue = {stringArrayCallsWrapperName}.data[index];\n\n        if (cachedValue === undefined) {\n            if ({stringArrayCallsWrapperName}.once === undefined) {\n                {selfDefendingCode}\n                \n                {stringArrayCallsWrapperName}.once = true;\n            }\n            \n            value = {stringArrayCallsWrapperName}.rc4(value, key);\n            {stringArrayCallsWrapperName}.data[index] = value;\n        } else {\n            value = cachedValue;\n        }\n    ";
 }
 }
 exports.StringArrayRc4DecodeNodeTemplate = StringArrayRc4DecodeNodeTemplate;
 exports.StringArrayRc4DecodeNodeTemplate = StringArrayRc4DecodeNodeTemplate;
 
 

+ 10 - 10
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "javascript-obfuscator",
   "name": "javascript-obfuscator",
-  "version": "0.10.0",
+  "version": "0.10.0-beta.2",
   "description": "JavaScript obfuscator",
   "description": "JavaScript obfuscator",
   "keywords": [
   "keywords": [
     "obfuscator",
     "obfuscator",
@@ -31,36 +31,36 @@
     "reflect-metadata": "0.1.10",
     "reflect-metadata": "0.1.10",
     "source-map-support": "0.4.14",
     "source-map-support": "0.4.14",
     "string-template": "1.0.0",
     "string-template": "1.0.0",
-    "tslib": "1.6.0"
+    "tslib": "1.6.1"
   },
   },
   "devDependencies": {
   "devDependencies": {
-    "@types/chai": "3.5.0",
+    "@types/chai": "3.5.1",
     "@types/chance": "0.7.32",
     "@types/chance": "0.7.32",
     "@types/commander": "2.3.31",
     "@types/commander": "2.3.31",
     "@types/escodegen": "0.0.6",
     "@types/escodegen": "0.0.6",
     "@types/esprima": "2.1.33",
     "@types/esprima": "2.1.33",
     "@types/estraverse": "0.0.6",
     "@types/estraverse": "0.0.6",
-    "@types/estree": "0.0.34",
+    "@types/estree": "0.0.35",
     "@types/mkdirp": "0.3.29",
     "@types/mkdirp": "0.3.29",
-    "@types/mocha": "2.2.40",
-    "@types/node": "7.0.12",
+    "@types/mocha": "2.2.41",
+    "@types/node": "7.0.13",
     "@types/sinon": "2.1.2",
     "@types/sinon": "2.1.2",
     "@types/string-template": "1.0.2",
     "@types/string-template": "1.0.2",
     "awesome-typescript-loader": "3.1.2",
     "awesome-typescript-loader": "3.1.2",
     "babel-cli": "6.24.1",
     "babel-cli": "6.24.1",
-    "babel-loader": "6.4.1",
+    "babel-loader": "7.0.0",
     "babel-plugin-array-includes": "2.0.3",
     "babel-plugin-array-includes": "2.0.3",
     "babel-preset-es2015": "6.24.1",
     "babel-preset-es2015": "6.24.1",
-    "chai": "4.0.0-canary.1",
+    "chai": "4.0.0-canary.2",
     "coveralls": "2.13.0",
     "coveralls": "2.13.0",
     "istanbul": "1.1.0-alpha.1",
     "istanbul": "1.1.0-alpha.1",
     "mocha": "3.2.0",
     "mocha": "3.2.0",
     "sinon": "2.1.0",
     "sinon": "2.1.0",
     "ts-node": "3.0.2",
     "ts-node": "3.0.2",
     "tslint": "5.1.0",
     "tslint": "5.1.0",
-    "tslint-loader": "3.5.2",
+    "tslint-loader": "3.5.3",
     "typescript": "2.3.0",
     "typescript": "2.3.0",
-    "webpack": "2.3.3",
+    "webpack": "2.4.1",
     "webpack-node-externals": "1.5.4"
     "webpack-node-externals": "1.5.4"
   },
   },
   "repository": {
   "repository": {

+ 4 - 2
src/templates/custom-nodes/string-array-nodes/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate.ts

@@ -21,14 +21,16 @@ export function StringArrayBase64DecodeNodeTemplate (): string {
             
             
             {stringArrayCallsWrapperName}.initialized = true;
             {stringArrayCallsWrapperName}.initialized = true;
         }
         }
+                  
+        var cachedValue = {stringArrayCallsWrapperName}.data[index];
                         
                         
-        if ({stringArrayCallsWrapperName}.data[index] === undefined) {
+        if (cachedValue === undefined) {
             {selfDefendingCode}
             {selfDefendingCode}
             
             
             value = {stringArrayCallsWrapperName}.base64DecodeUnicode(value);
             value = {stringArrayCallsWrapperName}.base64DecodeUnicode(value);
             {stringArrayCallsWrapperName}.data[index] = value;
             {stringArrayCallsWrapperName}.data[index] = value;
         } else {
         } else {
-            value = {stringArrayCallsWrapperName}.data[index];
+            value = cachedValue;
         }  
         }  
     `;
     `;
 }
 }

+ 4 - 4
src/templates/custom-nodes/string-array-nodes/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate.ts

@@ -13,10 +13,10 @@ export function StringArrayRc4DecodeNodeTemplate (): string {
             
             
             {stringArrayCallsWrapperName}.initialized = true;
             {stringArrayCallsWrapperName}.initialized = true;
         }
         }
-        
-        index += key;
+  
+        var cachedValue = {stringArrayCallsWrapperName}.data[index];
 
 
-        if ({stringArrayCallsWrapperName}.data[index] === undefined) {
+        if (cachedValue === undefined) {
             if ({stringArrayCallsWrapperName}.once === undefined) {
             if ({stringArrayCallsWrapperName}.once === undefined) {
                 {selfDefendingCode}
                 {selfDefendingCode}
                 
                 
@@ -26,7 +26,7 @@ export function StringArrayRc4DecodeNodeTemplate (): string {
             value = {stringArrayCallsWrapperName}.rc4(value, key);
             value = {stringArrayCallsWrapperName}.rc4(value, key);
             {stringArrayCallsWrapperName}.data[index] = value;
             {stringArrayCallsWrapperName}.data[index] = value;
         } else {
         } else {
-            value = {stringArrayCallsWrapperName}.data[index];
+            value = cachedValue;
         }
         }
     `;
     `;
 }
 }