Code processing method and device, equipment, medium and product

By compressing, parsing, mapping, and concatenating the source code, difficult-to-read target code is generated, which solves the problem of insufficient code security in existing technologies and achieves both code conciseness and improved security.

CN121833028APending Publication Date: 2026-04-10LINGSHU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing code obfuscation methods cannot effectively protect code security, as they do not obfuscate comment information or strings, resulting in low source code security.

Method used

By compressing and parsing the source code, a code list and execution order are generated. The mapping table between code and fields is used for mapping and concatenation to generate the target code, ensuring that the code semantics are consistent with the original logic while increasing readability.

Benefits of technology

While maintaining the semantics and logic of the code, it improves the readability and conciseness of the code, enhances the security of the code, and reduces the risk of being cracked.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833028A_ABST
    Figure CN121833028A_ABST
Patent Text Reader

Abstract

The invention discloses a code processing method, device and equipment, a medium and a product, and relates to the technical field of computers. Performing compression analysis processing on the obtained source code to obtain at least one code list and a code execution sequence; performing mapping processing on the at least one code list based on a mapping table between codes and fields to obtain at least one mapping list; and splicing the at least one mapping list based on the code execution sequence to obtain a target code. By adopting the technical scheme, through compression processing and based on structured reconstruction of the mapping table between the code and the field, simplification of the code is realized and the problem that the current code is easy to crack is solved on the premise of ensuring that code semantics are completely consistent with original logic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a code processing method, apparatus, device, medium, and product. Background Technology

[0002] The rapid development of internet technology, with PC (Personal Computer) and mobile internet applications experiencing exponential growth, has brought about the problem of leaked critical technology code. Most web (World Wide Web) projects can be divided into independent front-end and back-end components. Back-end code is typically obfuscated before execution, preventing users from directly seeing the source code implementation and thus protecting code security.

[0003] Existing code obfuscation methods cannot obfuscate only variable names when obfuscating source code, but do not obfuscate comment information or strings. This makes it possible for the specific function of the code to be inferred, resulting in low source code security.

[0004] Therefore, there is an urgent need for a code processing method that ensures the semantics of the code are completely consistent with the original logic, while simultaneously achieving both readability and conciseness. Summary of the Invention

[0005] This invention provides a code processing method, apparatus, device, medium, and product that solves the problem of easily cracked code. By compression processing and structural reconstruction based on the mapping table between code and fields, the invention achieves code simplification while ensuring that the semantics of the code are completely consistent with the original logic.

[0006] According to one aspect of the present invention, a code processing method is provided, comprising:

[0007] The obtained source code is compressed and parsed to obtain at least one code list and code execution order;

[0008] The at least one code list is mapped based on the mapping table between codes and fields to obtain at least one mapping list;

[0009] The target code is obtained by concatenating the at least one mapping list based on the code execution order.

[0010] According to another aspect of the present invention, a code processing apparatus is provided, comprising:

[0011] The compression and parsing module is used to compress and parse the acquired source code to obtain at least one code list and code execution order;

[0012] A mapping module is used to map the at least one code list based on a mapping table between codes and fields to obtain at least one mapping list;

[0013] The concatenation module is used to concatenate the at least one mapping list based on the code execution order to obtain the target code.

[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0015] At least one processor; and

[0016] A memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the code processing method described in any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the code processing method described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the code processing method according to any embodiment of the present invention.

[0020] The technical solution of this invention solves the problem of easy code cracking by compression processing and structural reconstruction based on the mapping table between code and fields. It achieves code simplification while ensuring that the semantics of the code are completely consistent with the original logic.

[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1This is a flowchart of a code processing method provided according to an embodiment of the present invention;

[0024] Figure 2 This is a flowchart of a code processing method provided according to an embodiment of the present invention;

[0025] Figure 3 This is a flowchart of a method for determining a code list according to an embodiment of the present invention;

[0026] Figure 4 This is a schematic diagram of the structure of a code processing device according to an embodiment of the present invention;

[0027] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the code processing method of the present invention. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product or device.

[0030] Furthermore, it should be noted that the information collected in the technical solution of this invention is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data all comply with the relevant laws, regulations and standards of relevant countries and regions, necessary confidentiality measures have been taken, and public order and good morals are not violated. Corresponding operation entry points are provided for users to choose to authorize or refuse.

[0031] Figure 1 This invention provides a flowchart of a code processing method, applicable to situations requiring code obfuscation. The method can be executed by a code processing device, which can be implemented in hardware and / or software and configured in a server. Figure 1 As shown, the method includes:

[0032] S110. Compress and parse the obtained source code to obtain at least one code list and code execution order.

[0033] The source code is the code to be obfuscated and compressed, such as Java code; the compression and parsing process can be to parse the source code into a syntax tree; the code list is the code package corresponding to each core in the code, such as a code package that encapsulates package information, import information or code blocks in the source code according to categories; the code execution order is the execution order of the source code.

[0034] Specifically, the obtained source code is compressed and parsed, converted into structured code based on its syntax structure, and then the structured code is encapsulated according to its code category to obtain at least one code list and code execution order.

[0035] S120. Based on the mapping table between codes and fields, perform mapping processing on at least one code list to obtain at least one mapping list.

[0036] The mapping table between codes and fields can include a mapping relationship between a newly generated identifier (using an algorithm to randomly generate strings of variable length) and an existing identifier in the replacement code; the mapping list consists of the code packages corresponding to each category after obfuscation and replacement processing.

[0037] Specifically, based on the mapping table between codes and fields, the code identifiers to be replaced in the code list are found, the code is replaced based on the mapping relationship, and the list of replaced codes is used as the mapping list.

[0038] Optionally, at least one code list is mapped based on a mapping table between codes and fields to obtain at least one mapping list, including:

[0039] Read the name field of the class body list in the code list; the name field includes the class name, field name, and method name;

[0040] The name field is replaced based on the mapping table between codes and fields to obtain a list of replacement codes;

[0041] By inserting fixed code into the method list in the replacement code list, a mapping list is obtained.

[0042] The class body list is the code package corresponding to the class body in the code; the class name, field name, and method name are the names corresponding to each field in the class body list; the replacement code list is the code list with name obfuscation; the fixed code can be redundant code, for example, generating redundant and non-executed code at 10% (rounded up) of the total number of lines of method body code; the mapping list is the code list after obfuscating the source code.

[0043] Specifically, the class name, field name, and method name of the class body list in the code list are read; according to the mapping table between code and field, a randomly generated string is found as the replacement code, and the name field in the class body list is replaced to obtain the replacement code list; and fixed code is inserted into the method list in the replacement code list to obtain the mapping list.

[0044] In an optional embodiment of the present invention, the mapping table between code and fields can also obfuscate and replace interface names or method body fields, such as traversing the interface list in the code list, querying the corresponding replacement code based on the mapping table between code and fields, and replacing the interface list in the code list with the replacement code.

[0045] Understandably, using an algorithm to randomly generate strings of variable length to create entirely new identifiers and replace existing identifiers in the code reduces code readability; and redundant but logically correct code snippets are inserted into function bodies. This type of code is not actually executed, but only increases the difficulty of reverse engineering and effectively prevents the code from being cracked.

[0046] S130. Concatenate at least one mapping list based on the code execution order to obtain the target code.

[0047] The target code is the source code after obfuscation and compression.

[0048] Specifically, the mapping list is concatenated according to the code execution order to obtain the target code.

[0049] In an optional embodiment of the present invention, the mapping list can be traversed, and code to be concatenated can be generated based on code attributes and code syntax rules. All concatenated code can then be concatenated according to the code execution order. For example, an ordered set can be defined first to store code fragments sequentially. The mapping list can be traversed, package information code can be found based on the JPackage node, a package statement can be added to the package information code, and it can be added to the ordered set. Import code can be found based on the JPackage node, an import statement can be added to the import code, and it can be added to the ordered set. Class code can be found based on Jclass, and the class code can be traversed. `nitBlockList` finds the initialization statements and concatenates them; it iterates through `fieldList`, concatenating the declaration statements of all fields; it iterates through `methodList`, concatenating the complete code of all methods; it concatenates the enumeration constant code: iterates through `enumConstList`, concatenating the declaration statements of all enumeration constants; it integrates the class modifiers, class name, parent class / interface list, and the concatenated content to generate the complete class body code and adds it to the ordered set; it concatenates the code fragments in the ordered set according to the code execution order to obtain the target code.

[0050] This invention compresses and parses the acquired source code to obtain at least one code list and code execution order; maps the at least one code list based on a mapping table between code and fields to obtain at least one mapping list; and concatenates the at least one mapping list based on the code execution order to obtain the target code. This technical solution, through compression and structured reconstruction based on the mapping table between code and fields, ensures that the code semantics remain completely consistent with the original logic while simultaneously achieving code conciseness, thus solving the problem of easily cracked code in current systems.

[0051] Figure 2 This is a flowchart of code processing according to an embodiment of the present invention. The embodiments of the present invention supplement the method for determining the code list based on the above embodiments. It should be noted that for parts not described in detail in the embodiments of the present invention, please refer to the relevant descriptions in other embodiments. For example... Figure 2 As shown, the method includes:

[0052] S210. Perform syntax transformation on the source code to obtain the structure code.

[0053] The structural code is the code for the syntax tree structure.

[0054] Specifically, the Java code is parsed into an abstract syntax tree, and the code corresponding to package attributes is used as package nodes; the code corresponding to import attributes is used as import nodes; the code corresponding to class attributes is used as class nodes; the code corresponding to parent class / interface attributes is used as parent class / interface nodes; the code corresponding to class body attributes is used as class body nodes; the code corresponding to field attributes is used as field nodes; the code corresponding to method attributes is used as method nodes; the code corresponding to code block attributes is used as code block nodes; the code corresponding to statement attributes is used as statement nodes; the code corresponding to enumeration attributes is used as enumeration nodes; and the code corresponding to parameter attributes is used as parameter nodes. Based on these nodes, the code is integrated into a structured code.

[0055] S220. Determine the code execution order of the source code based on the structural code.

[0056] Specifically, the code execution order of the source code is found based on the path of each node in the structure code.

[0057] S230. Compress the structure code to obtain compressed code.

[0058] Compression is equivalent to deletion.

[0059] Specifically, comments, blank lines, and redundant line breaks in the structure code are deleted and compressed to obtain compressed code.

[0060] Understandably, the compression rules first remove redundant content such as comments and blank lines, simplify the code format, reduce unnecessary size usage, and prepare for subsequent parsing.

[0061] S240. Extract compressed code in layers based on keywords to obtain at least one key line of code.

[0062] Among them, key lines of code are the code lines corresponding to each node; such as the `package` keyword in package information; the `import` statement in import information; keywords such as `class`, `interface`, `enum`, `@interface`, `extends`, and `implements` corresponding to class information; and ordinary code blocks (`{}`) or static code blocks (`static{}`) as key characters for initialization code.

[0063] Specifically, the compressed code is extracted in layers based on the keywords corresponding to each node, and the code lines under each node are taken as key code lines.

[0064] Optionally, the compressed code can be extracted layer by layer based on keywords to obtain at least one key line of code, including:

[0065] The compressed code is parsed layer by layer to obtain the structured code;

[0066] Scan the structured code line by line to obtain at least one line of code;

[0067] Keyword extraction is performed on lines of code based on keywords to obtain key lines of code; key lines of code include package information lines of code, import information lines of code, and class information lines of code.

[0068] Specifically, the compressed code is parsed layer by layer to obtain the structure code; the structure code is scanned line by line to obtain at least one line of code; the line of code is extracted according to preset keywords to obtain the key code line containing the keyword; such as the package information code line containing the package information keyword, the import information code line containing the import information keyword, and the class information code line containing the class information keyword.

[0069] S250. Encapsulate at least one critical line of code according to the encapsulation method to obtain a code list.

[0070] The encapsulation method involves encapsulating lines of code as instances.

[0071] Specifically, at least one key line of code is instanced to obtain a list of code corresponding to each key line of code.

[0072] Optional, such as Figure 3The method shown describes a code list determination method. The code list includes a package information code list, an import information code list, and a class information code list. Accordingly, at least one key line of code is encapsulated according to the encapsulation method to obtain the code list, which includes:

[0073] S251. Encapsulate the package information code line and import information code line in the key code line respectively to obtain the package information code list and the import information code list.

[0074] The package information code list can be a JPackage instance; the import information code list can be a JImport instance list.

[0075] Specifically, the package information code line and import information code line in the key code line are encapsulated into instances to obtain the package information code list corresponding to the package information code line and the import information code list corresponding to the import information code line. For example, the content after the keyword "package" is extracted and package "com.xx.yy.zz" is encapsulated into the package information code list JPackage(name="com.xx.yy.zz")). For example, for all import statements in the import information code line, the imported content is extracted as the name attribute, and the presence of "" is checked to determine the onDemand value. The import information code line import "xx.yy.zz" is encapsulated into the import information code list JImport(name="xx.yy.zz.*",onDemand=true)).

[0076] S252. Parse the class information code lines in the key code lines to obtain class nodes, class interfaces, and class bodies.

[0077] Among them, class information code lines are lines of code containing keywords such as class, interface, enum, @interface, extends, and implements; class nodes are code fields for class modifiers and class names; class interfaces are parent classes / interfaces; and class bodies are initialization code and method fields.

[0078] Specifically, the class information code lines in the key code lines are parsed to obtain the class nodes, class interfaces, and class bodies corresponding to each type of information code line.

[0079] S253. Encapsulate the class nodes and class interfaces respectively to obtain the class node list and class interface list.

[0080] Both the class node list and the class interface list are instances of class information.

[0081] Specifically, the class nodes and class interfaces in the class information code lines are encapsulated and extracted to obtain the class modifier, class name, class type, and parent class / interface list; for example, class, interface, enum, @interface, extends, and implements are encapsulated into a class node list and a class interface list: JClass(modifier="public", name="Aa", type=1, superList=[JSuperClass(name="Bb", type=1), JSuperClass(name="Cc", type=2)], body=null)).

[0082] S254. Encapsulate the class body based on the encapsulation method to obtain a class body list; the class body list includes an initialization list, a field list, a method list, and an enumeration list.

[0083] The initialization list is a JBlock instance; the field list is a JField instance; the method list is a JMethod instance; and the enumeration list is a JEnumConst instance.

[0084] Specifically, based on the encapsulation method of the class body keywords in each type of body, the class body code is encapsulated to obtain JBlock instances, JField instances, and JEnumConst instances.

[0085] Optionally, the class body can be encapsulated based on the encapsulation method to obtain a list of class bodies, including:

[0086] Perform type analysis on the class body to obtain the class body type;

[0087] If the class body type is an enumeration class, then the class body code corresponding to the class body is encapsulated into an enumeration list;

[0088] If the class body type is not an enumeration class, the class body is extracted based on the distinguishing fields to obtain the field codes and non-field codes;

[0089] Based on the class body keyword, the field code is encapsulated into a field list and a method list respectively;

[0090] Non-field codes are encapsulated as initialization lists.

[0091] Among them, the class body type is an enumeration class or a non-enumeration class; the field code is a code snippet that is not a code block, which can include fields and methods, and the non-field code is a regular code block or a static code block.

[0092] Specifically, type analysis is performed on the class body. If the class body type is an enumeration class, the corresponding class body code is encapsulated into an enumeration list. If the class body type is not an enumeration class, the class body is extracted based on distinguishing fields to obtain field code and non-field code. Based on the class body keywords, the field code is encapsulated into a field list and a method list respectively. Non-field code is encapsulated into an initialization list. For example, class body code A("a",1), B("b",2) is encapsulated into JEnumConst(name="A("a",1)",index=0), JEnumConst(name="B("b",2)",index=1)). For non-field code such as the content of ordinary code blocks ({}) or static code blocks (static{}), it is encapsulated into JBlock instances. The field keywords of the field code are found, such as modifier + type + name, with no parentheses after the name, and their priority is set. The `privateStringname` is encapsulated into a field list `JField(modifier="private", classType="String", name="name", block=null)`; and the remaining code snippet containing the keyword `privateStringgetName(){returnthis.name;}` is encapsulated into a method list `JMethod(modifier="private", returnClassType="String", name="getName", parameterList=null, thrExList=null, methodBody=JBlock(statementList=["returnthis.name;"]))`.

[0093] S255. Use the class node list, class interface list, and class body list as the class information code list.

[0094] Specifically, the node list, class interface list, and class body list are assembled into a class information code list.

[0095] In an optional embodiment of the present invention, the class information code list may further include a body instance list; for example, by traversing the class body code lines by keyword, assigning initBlockList, fieldList, methodList, and enumConstList to the corresponding fields, and then assigning the instance to the body field in the class information code list.

[0096] It is understandable that by extracting keywords and encapsulating instances, the source code is converted into structured code, and each node is encapsulated in a list based on the structured code. This structured refactoring ensures that the semantics of the code are completely consistent with the original logic when obfuscating and replacing it later.

[0097] S260. Based on the mapping table between codes and fields, perform mapping processing on at least one code list to obtain at least one mapping list.

[0098] S270. Concatenate at least one mapping list based on the code execution order to obtain the target code.

[0099] This invention transforms the source code structure and encapsulates the structured code based on syntax rules and keyword extraction. It only modifies the code's appearance without changing its core logic, ensuring that the obfuscated and compressed code can run normally.

[0100] Figure 4 This invention provides a schematic diagram of a code processing device according to an embodiment of the present invention. This embodiment is applicable to situations requiring code obfuscation. The code processing device can be implemented in hardware and / or software and can be configured in a server. Figure 4 As shown, the code processing device 300 includes a compression and parsing module 310, a mapping module 320, and a splicing module 330:

[0101] The compression and parsing module 310 is used to compress and parse the acquired source code to obtain at least one code list and code execution order;

[0102] Mapping module 320 is used to map at least one code list based on a mapping table between codes and fields to obtain at least one mapping list;

[0103] The splicing module 330 is used to splice at least one mapping list based on the code execution order to obtain the target code.

[0104] This invention compresses and parses the acquired source code to obtain at least one code list and code execution order; maps the at least one code list based on a mapping table between code and fields to obtain at least one mapping list; and concatenates the at least one mapping list based on the code execution order to obtain the target code. This technical solution, through compression and structured reconstruction based on the mapping table between code and fields, ensures that the code semantics remain completely consistent with the original logic while simultaneously achieving code conciseness, thus solving the problem of easily cracked code in current systems.

[0105] Optionally, the compression and parsing module 310 includes a conversion unit, a code execution order determination unit, a compression unit, an extraction unit, and a packaging unit;

[0106] The transformation unit is used to perform syntax transformation on the source code to obtain structured code;

[0107] The code execution order determination unit is used to determine the code execution order of the source code based on the structure code.

[0108] Compression unit, used to compress the structure code to obtain compressed code;

[0109] The extraction unit is used to extract compressed code in layers based on keywords, and obtain at least one key line of code;

[0110] The encapsulation unit is used to encapsulate at least one key line of code according to the encapsulation method to obtain a code list.

[0111] Optionally, the extracted units are also used to perform layered parsing of the compressed code to obtain the structured code;

[0112] Scan the structured code line by line to obtain at least one line of code;

[0113] Keyword extraction is performed on lines of code based on keywords to obtain key lines of code; key lines of code include package information lines of code, import information lines of code, and class information lines of code.

[0114] Optionally, the code list includes a package information code list, an import information code list, and a class information code list. Accordingly, the encapsulation unit is also used to encapsulate the package information code line and the import information code line in the key code line respectively to obtain the package information code list and the import information code list.

[0115] Parse the class information lines in the key code lines to obtain class nodes, class interfaces, and class bodies;

[0116] Encapsulate class nodes and class interfaces separately to obtain a list of class nodes and a list of class interfaces;

[0117] The class body is encapsulated based on the encapsulation method to obtain a class body list; the class body list includes an initialization list, a field list, a method list, and an enumeration list;

[0118] The list of class nodes, the list of class interfaces, and the list of class bodies are used as the class information code list.

[0119] Optionally, the encapsulation unit can also be used to perform type analysis on the class body to obtain the class body type;

[0120] If the class body type is an enumeration class, then the class body code corresponding to the class body is encapsulated into an enumeration list;

[0121] If the class body type is not an enumeration class, the class body is extracted based on the distinguishing fields to obtain the field codes and non-field codes;

[0122] Based on the class body keyword, the field code is encapsulated into a field list and a method list respectively;

[0123] Non-field codes are encapsulated as initialization lists.

[0124] Optionally, the mapping module 320 is also used to read the name field of the class body list in the code list; the name field includes the class name, field name, and method name;

[0125] The name field is replaced based on the mapping table between codes and fields to obtain a list of replacement codes;

[0126] By inserting fixed code into the method list in the replacement code list, a mapping list is obtained.

[0127] The code processing apparatus provided in the embodiments of the present invention can execute the code processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0128] According to embodiments of the present invention, the present invention also provides an electronic device, a readable storage medium, and a computer program product.

[0129] Figure 5 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0130] like Figure 5As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0131] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0132] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as code processing methods.

[0133] In some embodiments, the code processing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the code processing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the code processing method by any other suitable means (e.g., by means of firmware).

[0134] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0135] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0136] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0137] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0138] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0139] A computing system can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product within the cloud computing service system. This addresses the shortcomings of traditional physical hosts and dedicated virtual services, such as high management difficulty and weak business scalability.

[0140] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0141] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method of code processing, characterized by, The method comprises the following steps: performing compression and analysis on the obtained source code to obtain at least one code list and a code execution sequence; performing mapping processing on the at least one code list based on a mapping table between codes and fields to obtain at least one mapping list; performing splicing on the at least one mapping list based on the code execution sequence to obtain target code.

2. The method of claim 1, wherein, The method of performing compression and analysis on the obtained source code to obtain at least one code list and a code execution sequence comprises the following steps: performing syntax conversion on the source code to obtain a structure code; determining the code execution sequence of the source code according to the structure code; performing compression processing on the structure code to obtain a compressed code; performing hierarchical extraction on the compressed code based on a keyword to obtain at least one key code line; performing encapsulation on the at least one key code line according to an encapsulation mode to obtain a code list.

3. The method of claim 2, wherein, The method of performing hierarchical extraction on the compressed code based on a keyword to obtain at least one key code line comprises the following steps: performing hierarchical analysis on the compressed code to obtain the structure code; performing line-by-line scanning on the structure code to obtain at least one line code; performing keyword extraction on the line code based on a keyword to obtain a key code line; the key code line comprises a package information code line, an import information code line and a class information code line.

4. The method of claim 2, wherein, The code list comprises a package information code list, an import information code list and a class information code list, and correspondingly, the method of performing encapsulation on the at least one key code line according to an encapsulation mode to obtain a code list comprises the following steps: performing encapsulation on the package information code line and the import information code line in the key code line respectively to obtain a package information code list and an import information code list; performing analysis on the class information code line in the key code line to obtain a class node, a class interface and a class body; performing encapsulation on the class node and the class interface respectively to obtain a class node list and a class interface list; performing encapsulation on the class body based on an encapsulation mode to obtain a class body list; the class body list comprises an initialization list, a field list, a method list and an enumeration list; taking the class node list, the class interface list and the class body list as the class information code list.

5. The method of claim 4, wherein, The method of performing encapsulation on the class body based on an encapsulation mode to obtain a class body list comprises the following steps: performing type analysis on the class body to obtain a class body type; if the class body type is an enumeration class, encapsulating the class body code corresponding to the class body as an enumeration list; if the class body type is not an enumeration class, performing extraction on the class body based on a field distinguishing mode to obtain field code and non-field code; encapsulating the field code as a field list and a method list based on a class body keyword; encapsulating the non-field code as an initialization list.

6. The method of claim 1, wherein, The method of performing mapping processing on the at least one code list based on a mapping table between codes and fields to obtain at least one mapping list comprises the following steps: reading a name field of a class body list in the code list; the name field comprises a class name, a field name and a method name; performing replacement on the name field based on a mapping table between codes and fields to obtain a replacement code list; The method list in the replacement code list is subjected to fixed code insertion to obtain a mapping list.

7. A code processing apparatus, characterized by comprising: The method comprises the following steps: The compressed analysis module is configured to perform compressed analysis on the obtained source code to obtain at least one code list and a code execution sequence. The mapping module is configured to perform mapping processing on the at least one code list based on a mapping table between codes and fields to obtain at least one mapping list. The splicing module is configured to splice the at least one mapping list based on the code execution sequence to obtain target code.

8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected to the at least one processor in communication; wherein The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the code processing method of any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to execute the code processing method of any one of claims 1-6 when executed.

10. A computer program product, characterised in that, The computer program product comprises a computer program that, when executed by a processor, implements the code processing method according to any one of claims 1-6. The computer program product comprises a computer program that, when executed by a processor, implements the code processing method according to any one of claims 1-6.