Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31072

Re: decode hex string

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: decode hex string
Date 2016-08-05 08:06 +0200
Organization PointedEars Software (PES)
Message-ID <2022555.8LXgB8ZqXR@PointedEars.de> (permalink)
References <xNidnc-IINPnRj7KnZ2dnUU7-fPNnZ2d@westnet.com.au> <2543619.e9J7NaK4W3@PointedEars.de>

Show all headers | View raw


Thomas 'PointedEars' Lahn wrote:

> Andrew Poulos wrote:
>> I have some code I need to edit and the previous programmer has used
>> variable names like _0x29aexe, _0x29aexf, _0x29aex10, _0x29aex11,
>> _0x29aex12, _0x29aex13, _0x29aex14, _0x29aex15...
>> 
>> My guess was that it's hex with a leading underscore but when I convert
>> I get "?)®?" and the like.
>> 
>> Did I convert it wrongly or did the person obfuscate the variable names
>> even further?
> 
> Impossible to say for certain without seeing the source codes (theirs and
> yours).
> 
> However, hexadecimal numbers do not contain the letter “x”, so if you used
> parseInt(…, 16) on anything but the “_”, then you converted it wrongly;
> parseInt(…, 16) would recognize and ignore the “0x” as a hexadecimal
> number
> prefix, but it would stop parsing before the second “x”.  But
> String.fromCharCode(parseInt("0x29aexfoo", 16)) returns "⦮", not "?", so
> you might not have attempted to convert them this way.

You have probably attempted to convert the number as octets: 
String.fromCharCode(0x29, 0xAE) returns ")®".
 
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

decode hex string Andrew Poulos <ap_prog@hotmail.com> - 2016-08-05 10:19 +1000
  Re: decode hex string $Bill <news@todbe.com> - 2016-08-04 21:28 -0700
  Re: decode hex string Andreas Bergmaier <andber93@web.de> - 2016-08-05 06:44 +0200
  Re: decode hex string Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-05 07:53 +0200
    Re: decode hex string Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-05 08:06 +0200

csiph-web