As others commented / answered, you have an incorrect problem along with very little-known information about an unknown function (well, in the end, it is unknown :). Although you can try to guess a function using Genetic Programming, you cannot rely on the assurance that it actually represents an unknown function, not just 50 inputs -> .
But, as a dummy experiment, I played with Genetic Programming and found the following program for your three given examples:
def guess(a, key=0xbeef):
Which gives the following results:
Input Output (guess) Actual output Diff 0x7d04e214 0x4a49 0x4a49 0 0x7d048dc3 0xa0e7 0xa0e7 0 0x7d04db2e 0x4191 0x4191 0
Thus, the resulting program has a total error of 0 units for these inputs, so the function is correct for these examples, but it does not mean anything. To create a program that did not give errors for examples, it took several runs, thousands of generations, etc. Now, the immediate problem that needs to be noted here is that I assumed that the unknown function takes the key parameter along with the input - which may or may not be. Also, I just guessed that the key could be 0xbeef mainly because it is a good hex value. The consequence of these decisions is that the program will try to create a program to accommodate these options, which may be completely wrong with what the unknown function does. This means that you need to somehow make this unknown function more famous than it is now, in order to expect any relevant results.
source share