There are many situations in which it is desirable to protect a piece of software from illegitimate tampering once it gets distributed to the users. Protecting the software code means some level of assurance that the program will execute as expected even if it encounters the illegitimated modifications. We provide the method of protecting software from unauthorized modification. One important technique is an integrity-based encryption, by which a program, while running, checks itself to verify that it has not been modified and conceals some privacy sensitive parts of program.