Java programs are often downloaded (distributed) to unknown environments, so protect Java code from malicious modification is an important issue. This paper presents a tamper-proofing software technology on basis paths for stack-machine based languages, such as Java, by improving
Oblivious Hashing
. Our approach is based on a new dynamic stack-tracing approach which inserts hash instructions to monitor the top of the stack to check whether the program running has been tampered with or not. A user can choose one or more methods in a class to tamper-proof program. The protective codes are added to basic blocks at the bytecode level. We developed a new approach to protect constants and variables by alternative hashing functions. The overhead is proportional to the number of Load and Push instructions to be protected.