literal int number values to hex convert

This commit is contained in:
sanex3339
2016-05-21 15:27:55 +03:00
parent 3230804d5f
commit 74aea01aaa
2 changed files with 8 additions and 4 deletions
+3 -2
View File
@@ -22,7 +22,7 @@ class NodeObfuscator {
return `${prefix}${Utils_1.Utils.decToHex(nodeValue)}`;
}
replaceLiteralStringByArrayElement(nodeValue) {
let value = Utils_1.Utils.stringToUnicode(nodeValue), unicodeArray = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex = unicodeArray.indexOf(value), index;
let value = Utils_1.Utils.stringToUnicode(nodeValue), unicodeArray = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex = unicodeArray.indexOf(value), index, hexadecimalIndex;
if (sameIndex < 0) {
index = unicodeArray.length;
unicodeArray.push(Utils_1.Utils.stringToUnicode(nodeValue));
@@ -30,7 +30,8 @@ class NodeObfuscator {
else {
index = sameIndex;
}
return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${index}]`;
hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${hexadecimalIndex}]`;
}
}
exports.NodeObfuscator = NodeObfuscator;
+5 -2
View File
@@ -64,7 +64,8 @@ export abstract class NodeObfuscator implements INodeObfuscator {
let value: string = Utils.stringToUnicode(nodeValue),
unicodeArray: string[] = this.nodes.get('unicodeArrayNode').getNodeData(),
sameIndex: number = unicodeArray.indexOf(value),
index: number;
index: number,
hexadecimalIndex: string;
if (sameIndex < 0) {
index = unicodeArray.length;
@@ -73,6 +74,8 @@ export abstract class NodeObfuscator implements INodeObfuscator {
index = sameIndex;
}
return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${index}]`;
hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${hexadecimalIndex}]`;
}
}