JavaScript Bytecode Loading for Source Code Protection
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for protecting JAVASCRIPT source code, such as obfuscation, encryption, and compilation, are inadequate in preventing reverse engineering and maintaining execution efficiency.
Innovation Solution
A method involving compiling JAVASCRIPT source code into bytecode using a bytecode compiler, generating a bytecode loader, and deploying it in a target runtime environment to convert the bytecode into executable form, thereby increasing the difficulty of reverse engineering.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Difficulty of detecting and measuring
If source code is compiled into bytecode using V8 compiler, then reverse engineering difficulty is improved, but execution efficiency deteriorates
Solution Approach 1:
The patent segments the bytecode execution process into two distinct phases: a compilation phase where source code is compiled into bytecode with protection measures, and an execution phase where the bytecode is loaded and executed by the runtime environment. This segmentation allows the bytecode to serve dual purposes: protecting the source code while maintaining execution efficiency through optimized runtime execution.
Solution Approach 2:
The patent introduces a bytecode loader as an intermediary component between the bytecode compiler and the runtime environment. The loader acts as a mediator that loads bytecode into memory and manages its execution, enabling the bytecode to function as both a protection mechanism and an efficient execution format. The loader ensures that bytecode is properly initialized and executed without compromising performance.
2Reliability
If source code is obfuscated to reduce readability, then protection effect is improved, but ease of code restoration deteriorates
Solution Approach 1:
The patent changes the fundamental parameter of code representation by transforming source code into bytecode format. This parameter change fundamentally alters the structure and executability of the code, making it impossible to restore the original source code through simple formatting tools while maintaining full execution functionality. The bytecode representation is a complete transformation rather than a superficial modification.
3Reliability
If encryption is applied to protect source code, then protection effect is improved, but execution efficiency deteriorates due to decryption requirements
Solution Approach 1:
The patent substitutes the encryption/decryption mechanism with a compilation/execution mechanism. Instead of encrypting source code and requiring decryption before execution, the source code is compiled into bytecode that can be directly executed by the runtime environment. This substitution eliminates the overhead of encryption and decryption operations while maintaining protection through the bytecode format itself.
Data Source
AI summary
A source code protection method includes loading a bytecode compiler; obtaining a source code file of a program that is to be run in a target runtime environment; analyzing the source code file of the program via the bytecode compiler, to obtain a syntax tree corresponding to the source code file of the program; converting, via the bytecode compiler, the syntax tree into a target bytecode file corresponding to the source code file of the program; generating, via the bytecode compiler, a target bytecode loader corresponding to the target bytecode file, where the target bytecode loader is configured to load the target bytecode file; and deploying the target bytecode file and the target bytecode loader into the target runtime environment.


