New to programming - hex decode / convert

Viewed 29

As I mentioned Im new to programming. My goal is that I would like to modify a game's exe (change some parameters in it) For first I would like to get a code I can "read". What I see: https://freeimage.host/i/iWh4KQ

Game developer is Japanese, so maybe the text behind hex is too. Any idea what should I do?

Thanks and apologize if the question is too noob. David

1 Answers

Unfortunately it may not be as easy as it seems: The .exe contains assembly code and not any form of easy to read code like python (or any other high-level programming language).
Assembly code is the most basic form of a programming language and is notoriously difficult to understand due to its limited set of instructions.

However, if you want to convert it to a text (ascii) form then you can do something like the following (for python 3):

def hex_to_string(string):
    byte_array = bytearray.fromhex(string)
    return byte_array.decode()

If you wanted to try and do it all at once (although I can't recommend it as I don't know the size of the exe file) you could convert it to .txt and then load it it in that way:

def hex_to_string():
    with open("hex_code.txt","r") as f:
        byte_array = bytearray.fromhex(''.join(f.readlines()))
        return byte_array.decode()
print(hex_to_string())

However, this at best (assuming the conversion is correct) will only get the hex into assembly code which would still be very difficult to read and understand as it is for this reason that other programming languages exist in the first place.

Related