I apologize cause this may be a bizarre question but I'm pretty confused. Would anyone know why someone would use what I believe to be "a hexadecimal approach" to javascript? i.e.) I see someone naming variables like
_0x2f8b, _0xcb6545,_0x893751, _0x1d2177, etc
Why would anyone ever do this? Also, I see code like
'to\x20bypass\x20this\x20link'
as well as hexadecimals for numbers such as 725392
0xb1190
So, how would anyone even get this kind of naming convention and why would they ever want to use this?
CodePudding user response:
Code like this has been, 99% of the time, automatically mangled/obfuscated from the original source code, in an attempt to make it more difficult to reverse engineer.
For example, if you start with
const foo = 'bar';
const somethingElse = 5;
you might use an obfuscation tool to come up with
var _0x2f8b, _0xcb6545;
_0x2f8b = 'bar';
_0xcb6545 = 5;
and serve that to clients. Reading 200 lines of obfuscated code is a lot harder than reading 200 lines of the original source code.
as well as hexadecimals for numbers such as 725392
Same thing - it's easier for a human to make sense of 725392 (which may be a magic number important for the application) than 0xb1190.
This isn't something that would be present in source code.