mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
literal int number values to hex convert
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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}]`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user