sanex3339 8 éve
szülő
commit
a23d7f1b6a

+ 77 - 20
dist/index.js

@@ -486,16 +486,16 @@ var NodeObfuscator = function () {
                 throw new ReferenceError('`unicodeArrayNode` node is not found in Map with custom nodes.');
                 throw new ReferenceError('`unicodeArrayNode` node is not found in Map with custom nodes.');
             }
             }
             var unicodeArray = unicodeArrayNode.getNodeData(),
             var unicodeArray = unicodeArrayNode.getNodeData(),
-                valueIndex = unicodeArray.indexOf(value),
-                literalValueCallIndex = void 0,
+                indexOfExistingValue = unicodeArray.getIndexOf(value),
+                indexOfValue = void 0,
                 hexadecimalIndex = void 0;
                 hexadecimalIndex = void 0;
-            if (valueIndex >= 0) {
-                literalValueCallIndex = valueIndex;
+            if (indexOfExistingValue >= 0) {
+                indexOfValue = indexOfExistingValue;
             } else {
             } else {
-                literalValueCallIndex = unicodeArray.length;
+                indexOfValue = unicodeArray.getLength();
                 unicodeArrayNode.updateNodeData(value);
                 unicodeArrayNode.updateNodeData(value);
             }
             }
-            hexadecimalIndex = this.replaceLiteralNumberWithHexadecimalValue(literalValueCallIndex);
+            hexadecimalIndex = this.replaceLiteralNumberWithHexadecimalValue(indexOfValue);
             if (this.options.wrapUnicodeArrayCalls) {
             if (this.options.wrapUnicodeArrayCalls) {
                 var unicodeArrayCallsWrapper = this.nodes.get('unicodeArrayCallsWrapper');
                 var unicodeArrayCallsWrapper = this.nodes.get('unicodeArrayCallsWrapper');
                 if (!unicodeArrayCallsWrapper) {
                 if (!unicodeArrayCallsWrapper) {
@@ -1687,7 +1687,7 @@ var UnicodeArrayCallsWrapper = function (_Node_1$Node) {
     _createClass(UnicodeArrayCallsWrapper, [{
     _createClass(UnicodeArrayCallsWrapper, [{
         key: "appendNode",
         key: "appendNode",
         value: function appendNode(blockScopeNode) {
         value: function appendNode(blockScopeNode) {
-            if (!this.unicodeArray.length) {
+            if (!this.unicodeArray.getLength()) {
                 return;
                 return;
             }
             }
             NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
             NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
@@ -1763,7 +1763,7 @@ var UnicodeArrayDecodeNode = function (_Node_1$Node) {
     _createClass(UnicodeArrayDecodeNode, [{
     _createClass(UnicodeArrayDecodeNode, [{
         key: "appendNode",
         key: "appendNode",
         value: function appendNode(blockScopeNode) {
         value: function appendNode(blockScopeNode) {
-            if (!this.unicodeArray.length) {
+            if (!this.unicodeArray.getLength()) {
                 return;
                 return;
             }
             }
             NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
             NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
@@ -1822,21 +1822,20 @@ var AppendState_1 = __webpack_require__(2);
 var UnicodeArrayTemplate_1 = __webpack_require__(58);
 var UnicodeArrayTemplate_1 = __webpack_require__(58);
 var Node_1 = __webpack_require__(3);
 var Node_1 = __webpack_require__(3);
 var NodeUtils_1 = __webpack_require__(1);
 var NodeUtils_1 = __webpack_require__(1);
-var Utils_1 = __webpack_require__(0);
 
 
 var UnicodeArrayNode = function (_Node_1$Node) {
 var UnicodeArrayNode = function (_Node_1$Node) {
     _inherits(UnicodeArrayNode, _Node_1$Node);
     _inherits(UnicodeArrayNode, _Node_1$Node);
 
 
-    function UnicodeArrayNode(unicodeArrayName) {
-        var unicodeArrayRotateValue = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
-        var options = arguments[2];
+    function UnicodeArrayNode(unicodeArray, unicodeArrayName) {
+        var unicodeArrayRotateValue = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
+        var options = arguments[3];
 
 
         _classCallCheck(this, UnicodeArrayNode);
         _classCallCheck(this, UnicodeArrayNode);
 
 
         var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayNode).call(this, options));
         var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayNode).call(this, options));
 
 
         _this.appendState = AppendState_1.AppendState.AfterObfuscation;
         _this.appendState = AppendState_1.AppendState.AfterObfuscation;
-        _this.unicodeArray = [];
+        _this.unicodeArray = unicodeArray;
         _this.unicodeArrayName = unicodeArrayName;
         _this.unicodeArrayName = unicodeArrayName;
         _this.unicodeArrayRotateValue = unicodeArrayRotateValue;
         _this.unicodeArrayRotateValue = unicodeArrayRotateValue;
         return _this;
         return _this;
@@ -1845,7 +1844,7 @@ var UnicodeArrayNode = function (_Node_1$Node) {
     _createClass(UnicodeArrayNode, [{
     _createClass(UnicodeArrayNode, [{
         key: 'appendNode',
         key: 'appendNode',
         value: function appendNode(blockScopeNode) {
         value: function appendNode(blockScopeNode) {
-            if (!this.unicodeArray.length) {
+            if (!this.unicodeArray.getLength()) {
                 return;
                 return;
             }
             }
             NodeUtils_1.NodeUtils.prependNode(blockScopeNode.body, this.getNode());
             NodeUtils_1.NodeUtils.prependNode(blockScopeNode.body, this.getNode());
@@ -1863,20 +1862,20 @@ var UnicodeArrayNode = function (_Node_1$Node) {
     }, {
     }, {
         key: 'getNode',
         key: 'getNode',
         value: function getNode() {
         value: function getNode() {
-            Utils_1.Utils.arrayRotate(this.unicodeArray, this.unicodeArrayRotateValue);
+            this.unicodeArray.rotateArray(this.unicodeArrayRotateValue);
             return _get(Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
             return _get(Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
         }
         }
     }, {
     }, {
         key: 'updateNodeData',
         key: 'updateNodeData',
         value: function updateNodeData(data) {
         value: function updateNodeData(data) {
-            this.unicodeArray.push(data);
+            this.unicodeArray.addToArray(data);
         }
         }
     }, {
     }, {
         key: 'getNodeStructure',
         key: 'getNodeStructure',
         value: function getNodeStructure() {
         value: function getNodeStructure() {
             return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayTemplate_1.UnicodeArrayTemplate().formatUnicorn({
             return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayTemplate_1.UnicodeArrayTemplate().formatUnicorn({
                 unicodeArrayName: this.unicodeArrayName,
                 unicodeArrayName: this.unicodeArrayName,
-                unicodeArray: this.unicodeArray.join(',')
+                unicodeArray: this.unicodeArray.toString()
             }));
             }));
         }
         }
     }]);
     }]);
@@ -1932,7 +1931,7 @@ var UnicodeArrayRotateFunctionNode = function (_Node_1$Node) {
     _createClass(UnicodeArrayRotateFunctionNode, [{
     _createClass(UnicodeArrayRotateFunctionNode, [{
         key: "appendNode",
         key: "appendNode",
         value: function appendNode(blockScopeNode) {
         value: function appendNode(blockScopeNode) {
-            if (!this.unicodeArray.length) {
+            if (!this.unicodeArray.getLength()) {
                 return;
                 return;
             }
             }
             NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
             NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
@@ -2101,6 +2100,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; }
 
 
 var NodesGroup_1 = __webpack_require__(12);
 var NodesGroup_1 = __webpack_require__(12);
+var UnicodeArray_1 = __webpack_require__(67);
 var UnicodeArrayCallsWrapper_1 = __webpack_require__(30);
 var UnicodeArrayCallsWrapper_1 = __webpack_require__(30);
 var UnicodeArrayDecodeNode_1 = __webpack_require__(31);
 var UnicodeArrayDecodeNode_1 = __webpack_require__(31);
 var UnicodeArrayNode_1 = __webpack_require__(32);
 var UnicodeArrayNode_1 = __webpack_require__(32);
@@ -2128,8 +2128,8 @@ var UnicodeArrayNodesGroup = function (_NodesGroup_1$NodesGr) {
         } else {
         } else {
             _this.unicodeArrayRotateValue = 0;
             _this.unicodeArrayRotateValue = 0;
         }
         }
-        var unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(_this.unicodeArrayName, _this.unicodeArrayRotateValue, _this.options),
-            unicodeArray = unicodeArrayNode.getNodeData();
+        var unicodeArray = new UnicodeArray_1.UnicodeArray(),
+            unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(unicodeArray, _this.unicodeArrayName, _this.unicodeArrayRotateValue, _this.options);
         _this.nodes.set('unicodeArrayNode', unicodeArrayNode);
         _this.nodes.set('unicodeArrayNode', unicodeArrayNode);
         if (_this.options.wrapUnicodeArrayCalls) {
         if (_this.options.wrapUnicodeArrayCalls) {
             _this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(_this.unicodeArrayTranslatorName, _this.unicodeArrayName, unicodeArray, _this.options));
             _this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(_this.unicodeArrayTranslatorName, _this.unicodeArrayName, unicodeArray, _this.options));
@@ -3185,6 +3185,63 @@ if (!global._babelPolyfill) {
 }
 }
 module.exports = JavaScriptObfuscator_1.JavaScriptObfuscator;
 module.exports = JavaScriptObfuscator_1.JavaScriptObfuscator;
 
 
+/***/ },
+/* 67 */
+/***/ function(module, exports, __webpack_require__) {
+
+"use strict";
+"use strict";
+
+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"); } }
+
+var Utils_1 = __webpack_require__(0);
+
+var UnicodeArray = function () {
+    function UnicodeArray() {
+        _classCallCheck(this, UnicodeArray);
+
+        this.array = [];
+    }
+
+    _createClass(UnicodeArray, [{
+        key: "addToArray",
+        value: function addToArray(value) {
+            this.array.push(value);
+        }
+    }, {
+        key: "getArray",
+        value: function getArray() {
+            return this.array;
+        }
+    }, {
+        key: "getIndexOf",
+        value: function getIndexOf(value) {
+            return this.array.indexOf(value);
+        }
+    }, {
+        key: "getLength",
+        value: function getLength() {
+            return this.array.length;
+        }
+    }, {
+        key: "rotateArray",
+        value: function rotateArray(rotationValue) {
+            this.array = Utils_1.Utils.arrayRotate(this.array, rotationValue);
+        }
+    }, {
+        key: "toString",
+        value: function toString() {
+            return this.array.toString();
+        }
+    }]);
+
+    return UnicodeArray;
+}();
+
+exports.UnicodeArray = UnicodeArray;
+
 /***/ }
 /***/ }
 /******/ ]);
 /******/ ]);
 //# sourceMappingURL=index.js.map
 //# sourceMappingURL=index.js.map

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "javascript-obfuscator",
   "name": "javascript-obfuscator",
-  "version": "0.7.0",
+  "version": "0.8.0-dev.0",
   "description": "JavaScript obfuscator",
   "description": "JavaScript obfuscator",
   "keywords": [
   "keywords": [
     "obfuscator",
     "obfuscator",

+ 51 - 0
src/UnicodeArray.ts

@@ -0,0 +1,51 @@
+import { Utils } from "./Utils";
+
+export class UnicodeArray {
+    /**
+     * @type {string[]}
+     */
+    private array: string[] = [];
+
+    /**
+     * @param value
+     */
+    public addToArray (value: string): void {
+        this.array.push(value);
+    }
+
+    /**
+     * @returns {string[]}
+     */
+    public getArray (): string[] {
+        return this.array;
+    }
+
+    /**
+     * @param value
+     * @returns {number}
+     */
+    public getIndexOf(value: string): number {
+        return this.array.indexOf(value);
+    }
+
+    /**
+     * @returns {number}
+     */
+    public getLength (): number {
+        return this.array.length;
+    }
+
+    /**
+     * @param rotationValue
+     */
+    public rotateArray (rotationValue: number): void {
+        this.array = Utils.arrayRotate(this.array, rotationValue);
+    }
+
+    /**
+     * @returns {string}
+     */
+    public toString (): string {
+        return this.array.toString();
+    }
+}

+ 5 - 4
src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts

@@ -11,6 +11,7 @@ import { UnicodeArrayCallsWrapperTemplate } from "../../templates/custom-nodes/u
 
 
 import { Node } from '../Node';
 import { Node } from '../Node';
 import { NodeUtils } from "../../NodeUtils";
 import { NodeUtils } from "../../NodeUtils";
+import { UnicodeArray } from "../../UnicodeArray";
 import { Utils } from "../../Utils";
 import { Utils } from "../../Utils";
 
 
 export class UnicodeArrayCallsWrapper extends Node {
 export class UnicodeArrayCallsWrapper extends Node {
@@ -20,9 +21,9 @@ export class UnicodeArrayCallsWrapper extends Node {
     protected appendState: AppendState = AppendState.AfterObfuscation;
     protected appendState: AppendState = AppendState.AfterObfuscation;
 
 
     /**
     /**
-     * @type {string[]}
+     * @type {UnicodeArray}
      */
      */
-    private unicodeArray: string[];
+    private unicodeArray: UnicodeArray;
 
 
     /**
     /**
      * @type {string}
      * @type {string}
@@ -43,7 +44,7 @@ export class UnicodeArrayCallsWrapper extends Node {
     constructor (
     constructor (
         unicodeArrayCallsWrapperName: string,
         unicodeArrayCallsWrapperName: string,
         unicodeArrayName: string,
         unicodeArrayName: string,
-        unicodeArray: string[],
+        unicodeArray: UnicodeArray,
         options: IOptions
         options: IOptions
     ) {
     ) {
         super(options);
         super(options);
@@ -57,7 +58,7 @@ export class UnicodeArrayCallsWrapper extends Node {
      * @param blockScopeNode
      * @param blockScopeNode
      */
      */
     public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
     public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
-        if (!this.unicodeArray.length) {
+        if (!this.unicodeArray.getLength()) {
             return;
             return;
         }
         }
 
 

+ 5 - 4
src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts

@@ -16,6 +16,7 @@ import { UnicodeArrayDecodeTemplate } from "../../templates/custom-nodes/unicode
 import { JavaScriptObfuscator } from '../../JavaScriptObfuscator';
 import { JavaScriptObfuscator } from '../../JavaScriptObfuscator';
 import { Node } from '../Node';
 import { Node } from '../Node';
 import { NodeUtils } from "../../NodeUtils";
 import { NodeUtils } from "../../NodeUtils";
+import { UnicodeArray } from "../../UnicodeArray";
 
 
 export class UnicodeArrayDecodeNode extends Node {
 export class UnicodeArrayDecodeNode extends Node {
     /**
     /**
@@ -24,9 +25,9 @@ export class UnicodeArrayDecodeNode extends Node {
     protected appendState: AppendState = AppendState.AfterObfuscation;
     protected appendState: AppendState = AppendState.AfterObfuscation;
 
 
     /**
     /**
-     * @type {string[]}
+     * @type {UnicodeArray}
      */
      */
-    private unicodeArray: string[];
+    private unicodeArray: UnicodeArray;
 
 
     /**
     /**
      * @type {string}
      * @type {string}
@@ -40,7 +41,7 @@ export class UnicodeArrayDecodeNode extends Node {
      */
      */
     constructor (
     constructor (
         unicodeArrayName: string,
         unicodeArrayName: string,
-        unicodeArray: string[],
+        unicodeArray: UnicodeArray,
         options: IOptions
         options: IOptions
     ) {
     ) {
         super(options);
         super(options);
@@ -53,7 +54,7 @@ export class UnicodeArrayDecodeNode extends Node {
      * @param blockScopeNode
      * @param blockScopeNode
      */
      */
     public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
     public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
-        if (!this.unicodeArray.length) {
+        if (!this.unicodeArray.getLength()) {
             return;
             return;
         }
         }
 
 

+ 13 - 9
src/custom-nodes/unicode-array-nodes/UnicodeArrayNode.ts

@@ -7,11 +7,12 @@ import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
 
 
 import { AppendState } from '../../enums/AppendState';
 import { AppendState } from '../../enums/AppendState';
 
 
+import { UnicodeArray } from '../../UnicodeArray';
+
 import { UnicodeArrayTemplate } from "../../templates/custom-nodes/unicode-array-nodes/unicode-array-node/UnicodeArrayTemplate";
 import { UnicodeArrayTemplate } from "../../templates/custom-nodes/unicode-array-nodes/unicode-array-node/UnicodeArrayTemplate";
 
 
 import { Node } from '../Node';
 import { Node } from '../Node';
 import { NodeUtils } from "../../NodeUtils";
 import { NodeUtils } from "../../NodeUtils";
-import { Utils } from '../../Utils';
 
 
 export class UnicodeArrayNode extends Node {
 export class UnicodeArrayNode extends Node {
     /**
     /**
@@ -25,9 +26,9 @@ export class UnicodeArrayNode extends Node {
     protected appendState: AppendState = AppendState.AfterObfuscation;
     protected appendState: AppendState = AppendState.AfterObfuscation;
 
 
     /**
     /**
-     * @type {string[]}
+     * @type {UnicodeArray}
      */
      */
-    private unicodeArray: string[] = [];
+    private unicodeArray: UnicodeArray;
 
 
     /**
     /**
      * @type {string}
      * @type {string}
@@ -40,17 +41,20 @@ export class UnicodeArrayNode extends Node {
     private unicodeArrayRotateValue: number;
     private unicodeArrayRotateValue: number;
 
 
     /**
     /**
+     * @param unicodeArray
      * @param unicodeArrayName
      * @param unicodeArrayName
      * @param unicodeArrayRotateValue
      * @param unicodeArrayRotateValue
      * @param options
      * @param options
      */
      */
     constructor (
     constructor (
+        unicodeArray: UnicodeArray,
         unicodeArrayName: string,
         unicodeArrayName: string,
         unicodeArrayRotateValue: number = 0,
         unicodeArrayRotateValue: number = 0,
         options: IOptions
         options: IOptions
     ) {
     ) {
         super(options);
         super(options);
 
 
+        this.unicodeArray = unicodeArray;
         this.unicodeArrayName = unicodeArrayName;
         this.unicodeArrayName = unicodeArrayName;
         this.unicodeArrayRotateValue = unicodeArrayRotateValue;
         this.unicodeArrayRotateValue = unicodeArrayRotateValue;
     }
     }
@@ -59,7 +63,7 @@ export class UnicodeArrayNode extends Node {
      * @param blockScopeNode
      * @param blockScopeNode
      */
      */
     public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
     public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
-        if (!this.unicodeArray.length) {
+        if (!this.unicodeArray.getLength()) {
             return;
             return;
         }
         }
 
 
@@ -74,9 +78,9 @@ export class UnicodeArrayNode extends Node {
     }
     }
 
 
     /**
     /**
-     * @returns {string[]}
+     * @returns {UnicodeArray}
      */
      */
-    public getNodeData (): string[] {
+    public getNodeData (): UnicodeArray {
         return this.unicodeArray;
         return this.unicodeArray;
     }
     }
 
 
@@ -84,7 +88,7 @@ export class UnicodeArrayNode extends Node {
      * @returns {INode}
      * @returns {INode}
      */
      */
     public getNode (): INode {
     public getNode (): INode {
-        Utils.arrayRotate <string> (this.unicodeArray, this.unicodeArrayRotateValue);
+        this.unicodeArray.rotateArray(this.unicodeArrayRotateValue);
 
 
         return super.getNode();
         return super.getNode();
     }
     }
@@ -93,7 +97,7 @@ export class UnicodeArrayNode extends Node {
      * @param data
      * @param data
      */
      */
     public updateNodeData (data: string): void {
     public updateNodeData (data: string): void {
-        this.unicodeArray.push(data);
+        this.unicodeArray.addToArray(data);
     }
     }
 
 
     /**
     /**
@@ -103,7 +107,7 @@ export class UnicodeArrayNode extends Node {
         return NodeUtils.convertCodeToStructure(
         return NodeUtils.convertCodeToStructure(
             UnicodeArrayTemplate().formatUnicorn({
             UnicodeArrayTemplate().formatUnicorn({
                 unicodeArrayName: this.unicodeArrayName,
                 unicodeArrayName: this.unicodeArrayName,
-                unicodeArray: this.unicodeArray.join(',')
+                unicodeArray: this.unicodeArray.toString()
             })
             })
         );
         );
     }
     }

+ 5 - 4
src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts

@@ -15,6 +15,7 @@ import { UnicodeArrayRotateFunctionTemplate } from "../../templates/custom-nodes
 import { JavaScriptObfuscator } from "../../JavaScriptObfuscator";
 import { JavaScriptObfuscator } from "../../JavaScriptObfuscator";
 import { Node } from '../Node';
 import { Node } from '../Node';
 import { NodeUtils } from "../../NodeUtils";
 import { NodeUtils } from "../../NodeUtils";
+import { UnicodeArray } from "../../UnicodeArray";
 import { Utils } from "../../Utils";
 import { Utils } from "../../Utils";
 
 
 export class UnicodeArrayRotateFunctionNode extends Node {
 export class UnicodeArrayRotateFunctionNode extends Node {
@@ -24,9 +25,9 @@ export class UnicodeArrayRotateFunctionNode extends Node {
     protected appendState: AppendState = AppendState.AfterObfuscation;
     protected appendState: AppendState = AppendState.AfterObfuscation;
 
 
     /**
     /**
-     * @type {string[]}
+     * @type {UnicodeArray}
      */
      */
-    private unicodeArray: string[];
+    private unicodeArray: UnicodeArray;
 
 
     /**
     /**
      * @type {string}
      * @type {string}
@@ -46,7 +47,7 @@ export class UnicodeArrayRotateFunctionNode extends Node {
      */
      */
     constructor (
     constructor (
         unicodeArrayName: string,
         unicodeArrayName: string,
-        unicodeArray: string[],
+        unicodeArray: UnicodeArray,
         unicodeArrayRotateValue: number,
         unicodeArrayRotateValue: number,
         options: IOptions
         options: IOptions
     ) {
     ) {
@@ -61,7 +62,7 @@ export class UnicodeArrayRotateFunctionNode extends Node {
      * @param blockScopeNode
      * @param blockScopeNode
      */
      */
     public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
     public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
-        if (!this.unicodeArray.length) {
+        if (!this.unicodeArray.getLength()) {
             return;
             return;
         }
         }
 
 

+ 5 - 3
src/node-groups/UnicodeArrayNodesGroup.ts

@@ -1,6 +1,7 @@
 import { IOptions } from "../interfaces/IOptions";
 import { IOptions } from "../interfaces/IOptions";
 
 
 import { NodesGroup } from './NodesGroup';
 import { NodesGroup } from './NodesGroup';
+import { UnicodeArray } from "../UnicodeArray";
 import { UnicodeArrayCallsWrapper } from "../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper";
 import { UnicodeArrayCallsWrapper } from "../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper";
 import { UnicodeArrayDecodeNode } from "../custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode";
 import { UnicodeArrayDecodeNode } from "../custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode";
 import { UnicodeArrayNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayNode';
 import { UnicodeArrayNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayNode';
@@ -42,12 +43,13 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
             this.unicodeArrayRotateValue = 0;
             this.unicodeArrayRotateValue = 0;
         }
         }
 
 
-        let unicodeArrayNode: UnicodeArrayNode = new UnicodeArrayNode(
+        let unicodeArray: UnicodeArray = new UnicodeArray(),
+            unicodeArrayNode: UnicodeArrayNode = new UnicodeArrayNode(
+                unicodeArray,
                 this.unicodeArrayName,
                 this.unicodeArrayName,
                 this.unicodeArrayRotateValue,
                 this.unicodeArrayRotateValue,
                 this.options
                 this.options
-            ),
-            unicodeArray: string [] = unicodeArrayNode.getNodeData();
+            );
 
 
         this.nodes.set(
         this.nodes.set(
             'unicodeArrayNode',
             'unicodeArrayNode',

+ 8 - 7
src/node-obfuscators/NodeObfuscator.ts

@@ -9,6 +9,7 @@ import { TUnicodeArrayNode } from "../types/custom-nodes/TUnicodeArrayNode";
 import { JSFuck } from "../enums/JSFuck";
 import { JSFuck } from "../enums/JSFuck";
 
 
 import { Nodes } from "../Nodes";
 import { Nodes } from "../Nodes";
+import { UnicodeArray } from "../UnicodeArray";
 import { Utils } from '../Utils';
 import { Utils } from '../Utils';
 
 
 export abstract class NodeObfuscator implements INodeObfuscator {
 export abstract class NodeObfuscator implements INodeObfuscator {
@@ -146,19 +147,19 @@ export abstract class NodeObfuscator implements INodeObfuscator {
             throw new ReferenceError('`unicodeArrayNode` node is not found in Map with custom nodes.');
             throw new ReferenceError('`unicodeArrayNode` node is not found in Map with custom nodes.');
         }
         }
 
 
-        let unicodeArray: string[] = unicodeArrayNode.getNodeData(),
-            valueIndex: number = unicodeArray.indexOf(value),
-            literalValueCallIndex: number,
+        let unicodeArray: UnicodeArray = unicodeArrayNode.getNodeData(),
+            indexOfExistingValue: number = unicodeArray.getIndexOf(value),
+            indexOfValue: number,
             hexadecimalIndex: string;
             hexadecimalIndex: string;
 
 
-        if (valueIndex >= 0) {
-            literalValueCallIndex = valueIndex;
+        if (indexOfExistingValue >= 0) {
+            indexOfValue = indexOfExistingValue;
         } else {
         } else {
-            literalValueCallIndex = unicodeArray.length;
+            indexOfValue = unicodeArray.getLength();
             unicodeArrayNode.updateNodeData(value);
             unicodeArrayNode.updateNodeData(value);
         }
         }
 
 
-        hexadecimalIndex = this.replaceLiteralNumberWithHexadecimalValue(literalValueCallIndex);
+        hexadecimalIndex = this.replaceLiteralNumberWithHexadecimalValue(indexOfValue);
 
 
         if (this.options.wrapUnicodeArrayCalls) {
         if (this.options.wrapUnicodeArrayCalls) {
             let unicodeArrayCallsWrapper: TUnicodeArrayCallsWrapper = <TUnicodeArrayCallsWrapper>this.nodes.get('unicodeArrayCallsWrapper');
             let unicodeArrayCallsWrapper: TUnicodeArrayCallsWrapper = <TUnicodeArrayCallsWrapper>this.nodes.get('unicodeArrayCallsWrapper');