
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