gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Converting Assembler Source -> Data Array

#38606 - cosmic4z - Tue Mar 29, 2005 3:51 pm

I have some assembler files (ARM) ... that I want to convert to data arrays:

Data array would be something like:

AsmFunc[] = {0x33,0x46,0xc0,......};



Is there anything that can do this !?

(don't ask why I wanna do it!!!).
_________________
Qwak - www.qwak.co.uk | Forum - www.qwak.co.uk/forum/

#38618 - poslundc - Tue Mar 29, 2005 6:15 pm

cosmic4z wrote:
(don't ask why I wanna do it!!!).


... Even though you can refer to any symbols from assembled files (including functions) as data arrays inside of C anyway...?

Dan.

#38638 - cosmic4z - Tue Mar 29, 2005 8:37 pm

YEP!

I need to obscure source code for one reason or another ...

Is there anyway to do it ?

I guess if I create object files then use objdump ... I could get the raw data in a file ... then there must be a tool to convert this to a .c file / array.

Am I barking up the right tree here ?
_________________
Qwak - www.qwak.co.uk | Forum - www.qwak.co.uk/forum/

#38640 - poslundc - Tue Mar 29, 2005 8:45 pm

If you want to basically run an algorithm to process/encrypt your source code, you could use C or a scripting language (Python, PERL, PHP, etc.) to parse the .o file to find the function symbol and its code, then rearrange the data however you like into a new array (generated as plaintext C code, or plaintext assembly code if you want it to skip compilation and have it go an order of magnitude faster).

Dan.

Edit: I should comment that if your purpose is obfuscation of code to prevent hacking, with tools like VBA this won't stop a determined hacker. If your purpose is obfuscation to prevent other programmers from copying your code... well, unless you've got the algorithm to find the i'th prime in linear time, it probably ain't worth trying to build Fort Knox over.

#38739 - Steve++ - Thu Mar 31, 2005 2:59 am

Quote:
it probably ain't worth trying to build Fort Knox over.

It's security by obscurity; hardly Fort Knox!