1. A computer-implemented method of obfuscating code, the method comprising: identifying in a program a routine for replacement, wherein in response to a received input the routine produces a corresponding output; selecting a function from a pool of functions to replace the identified routine, each function in the pool of functions being semantically equivalent to the identified routine, wherein each semantically equivalent function uses a unique sequence of instructions to produce the corresponding output in response to the received input, the unique sequence of instructions different from a sequence of instructions in the identified routine and different from a sequence of instructions in each other function in the pool of functions; and replacing the identified routine with the selected function to generate a modified program.