Good ways to obfuscate/mangle strings? 
Author Message
 Good ways to obfuscate/mangle strings?

Howdy..

 I'm trying to hide about 50 strings (with < 100 characters each) so
that the ASCII data isn't viewable in a hex editor, and was curious to
see if there's already a method folks here would recommend for doing it.
The strings change frequently between compiles (they're being passed
to a script interpreter), so I'm wondering if I should just make an
external string parser that converts them all into strings of ASCII
values and embeds them in the code.

Thanks for any ideas..

-Bill



Sun, 10 Dec 2000 03:00:00 GMT  
 Good ways to obfuscate/mangle strings?


Read their FAQ.

--
C-FAQ ftp sites: ftp://ftp.eskimo.com ftp://rtfm.mit.edu
Hypertext C-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-FAQ Book: ISBN 0-201-84519-9.
Want Software?  Algorithms?  Pubs? http://www.infoseek.com



Sun, 10 Dec 2000 03:00:00 GMT  
 Good ways to obfuscate/mangle strings?


Quote:

> I'm trying to hide about 50 strings (with < 100 characters each) so
>that the ASCII data isn't viewable in a hex editor, and was curious to
>see if there's already a method folks here would recommend for doing it.

It depends whether you just want to hide the strings from a casual
observer, or protect them from a concerted attack.  If the former then
the simplest approach is probably just to xor each character with a
fixed value.  If the latter then, as Dann has already commented, you're
into the domain of cryptography and you'd probably do best to ask in
sci.crypt.

Quote:
>The strings change frequently between compiles (they're being passed
>to a script interpreter), so I'm wondering if I should just make an
>external string parser that converts them all into strings of ASCII
>values and embeds them in the code.

That sounds like the simplest approach to getting the munged strings
into your program -- it shouldn't be too hard to write a little program
which converts the strings and generates a .c file containing, say, an
array of the results.  Your program could then unscramble the strings
when it starts running, and subsequently access the plain versions by
indexing into the array.

Cheers,
Richard
--
Richard Stamp
Churchill College, Cambridge



Sun, 10 Dec 2000 03:00:00 GMT  
 Good ways to obfuscate/mangle strings?

: Howdy..

:  I'm trying to hide about 50 strings (with < 100 characters each) so
: that the ASCII data isn't viewable in a hex editor, and was curious to
: see if there's already a method folks here would recommend for doing it.
: The strings change frequently between compiles (they're being passed
: to a script interpreter), so I'm wondering if I should just make an
: external string parser that converts them all into strings of ASCII
: values and embeds them in the code.

I've mostly seen NAND used for this.  It seems pretty simple to
convert to and from the encrypted version, but anyone who can
use a hex editor is probably smart enough to figure it out.  If
it's just to avoid messing up a game, not a problem; otherwise
you probably need to use real encryption.

Will



Sun, 10 Dec 2000 03:00:00 GMT  
 Good ways to obfuscate/mangle strings?


Quote:

>That sounds like the simplest approach to getting the munged strings
>into your program -- it shouldn't be too hard to write a little program
>which converts the strings and generates a .c file containing, say, an
>array of the results.  Your program could then unscramble the strings
>when it starts running, and subsequently access the plain versions by
>indexing into the array.

It'll never get to the point of accessing them, because right after the
unscrambling is when I print the results and exit the de{*filter*}.


Mon, 11 Dec 2000 03:00:00 GMT  
 Good ways to obfuscate/mangle strings?


Quote:


>>Your program could then unscramble the strings
>>when it starts running, and subsequently access the plain versions by
>>indexing into the array.

>It'll never get to the point of accessing them, because right after the
>unscrambling is when I print the results and exit the de{*filter*}.

As I said, Alan, it depends on whether you're just trying to hide the
strings from a casual observer or make them secure against a serious
attack.  If the latter, I think my advice to XOR the characters with
a fixed pattern is much dodgier than the bit you've quoted above.  :-)

Cheers,
Richard
--
Richard Stamp
Churchill College, Cambridge



Mon, 11 Dec 2000 03:00:00 GMT  
 Good ways to obfuscate/mangle strings?

Quote:

> >>Your program could then unscramble the strings
> >>when it starts running, and subsequently access the plain versions by
> >>indexing into the array.

> >It'll never get to the point of accessing them, because right after the
> >unscrambling is when I print the results and exit the de{*filter*}.

> As I said, Alan, it depends on whether you're just trying to hide the
> strings from a casual observer or make them secure against a serious
> attack.  If the latter, I think my advice to XOR the characters with
> a fixed pattern is much dodgier than the bit you've quoted above.  :-)

The goal is just to make it harder than cutting&pasting the strings
from a hex editor, like I can now with the binary. With the current
code, pumping the characters through an XOR or NAND definitely seems
like the best way to go about it.

Thanks for the feedback!

-Bill



Mon, 11 Dec 2000 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Help with ideas, best ways etc...

2. Any good ways to trace memory leaks?

3. are there better ways to read config file?

4. Valid ways to pass strings

5. Example of DLL for strings without mangled name

6. mangled string

7. OOP (Obfuscated Obfuscating Program)

8. better way to use strings in managed and unmanaged code

9. A better temp string?

10. Question: What is the best way to see if a string contains a number

11. Best way to compaire values in two strings

12. Best way to compaire values in two strings

 

 
Powered by phpBB® Forum Software