1. A machine-readable storage medium having instructions stored therein, which when executed by a computer, cause the computer to perform a method comprising: providing rewriting code for program data statically embedded in a first code, wherein the program data is used in one or more instructions of the first code, the rewriting code to dynamically mask the program data; determining a code location in the first code for the rewriting code, wherein the code location is located in two or more execution paths of first code, each execution path including at least one of the instructions using the program data; and generating second code based on the first code inserted with the rewriting code at the code location, the second code including instructions using the program data dynamically masked by the rewriting code, wherein the second code when executed by a processor produces an identical result as the first code.