JavaScript Reverse Basics

miAlism

miAlism / December 20, 2021

1 min read

String obfuscation

String to Hex

function hexEnc(code){
for(var hexStr=[], i=0, s; i<code.length; i++){
s = code.charCodeAt(i).toString(16)
hexStr += "\\x" + s
}
return hexStr
}

String to unicode

function unicodeEnc(str) {
var value = '';
for (var i = 0; i < str.length; i++) {
value = "\\u" + ("0000" + parseInt(str.charCodeAt(i)).toString(16)).substr(-4);
}
return value
}

String ASCII