File processing method, computer readable storage medium and electronic device
By constructing a file header structure to randomly corrupt and encrypt the AI model, the problem of high computational cost in encryption and decryption is solved, thus improving the model's security and deployment efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FUZHOU ROCKCHIP SEMICON
- Filing Date
- 2022-08-22
- Publication Date
- 2026-07-07
Smart Images

Figure CN115455374B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence (AI) technology, and in particular to the field of AI model file processing technology. Background Technology
[0002] In the field of AI, once an AI model is built and trained, it can be deployed and released. Without protection, any third party who obtains the model can analyze it using model visualization tools (such as Netron), and even run and use it directly. To protect their AI algorithm models from unauthorized use, current technology uses encryption algorithms to encrypt the entire AI model before deployment and release, and then decrypts it before inference to obtain the original model for inference. However, encrypting the entire AI model becomes computationally intensive when the model is large, especially on edge devices where computing power is limited, hindering the deployment and implementation of AI models on edge devices. Summary of the Invention
[0003] In view of the problems of the prior art described above, the purpose of this application is to provide a file processing method, a computer-readable storage medium, and an electronic device to solve the technical problem of large encryption and decryption computation caused by encrypting the entire file when protecting files in the prior art.
[0004] To achieve the above and other related objectives, this application provides a file processing method. The method includes: creating an empty first protected file for a source file; constructing a file header structure, the file header structure including processing rules to be performed on the source file; encrypting the file header structure; and forming a second protected file based on the encrypted file header structure and the first protected file; and processing the source file according to the file header structure; and forming a third protected file based on the processed source file and the second protected file.
[0005] In one embodiment of this application, the processing rules include random destruction rules, and processing the source file according to the file header structure includes: randomly destroying the source file according to the random destruction rules.
[0006] In one embodiment of this application, forming a second protected file based on the encrypted file header structure and the first protected file includes: writing the encrypted file header structure into the header of the first protected file to form the second protected file.
[0007] In one embodiment of this application, forming a third protection file based on the processed source file and the second protection file includes: writing the processed source file to the end of the second protection file to form the third protection file.
[0008] In one embodiment of this application, the method further includes: obtaining the source file, the source file including an artificial intelligence source model file.
[0009] In one embodiment of this application, the method further includes: performing publication and deployment based on the third protected file.
[0010] To achieve the above and other related objectives, this application also provides a file processing method. The method includes: receiving a protected file, the protected file including first information associated with an encrypted file header structure and second information associated with a processed source file obtained by processing a source file according to the file header structure, the file header structure including processing rules to be performed on the source file; verifying the first information of the protected file based on a preset file header structure; and, in response to the first information of the protected file passing the verification, deriving the source file based on the second information of the protected file.
[0011] In one embodiment of this application, the processing rule includes a random destruction rule, and the processed source file includes a source file after the source file has been randomly destroyed according to the random destruction rule.
[0012] In one embodiment of this application, verifying the first information of the protected file based on a preset file header structure includes: deriving the encrypted file header structure from the header of the protected file; decrypting the encrypted file header structure using a preset symmetric encryption algorithm and key; and verifying the decrypted file header structure based on the preset file header structure.
[0013] In one embodiment of this application, deriving the source file based on the second information of the protected file includes: deriving the processed source file from the end of the protected file; and decoding the source file from the processed source file according to the file header structure, and storing the source file in a target buffer.
[0014] To achieve the above and other related objectives, this application also provides a computer-readable storage medium having computer-readable program instructions stored thereon, which, when executed, implement the file processing method described above.
[0015] To achieve the above and other related objectives, this application also provides an electronic device, including: a memory configured to store program instructions; and a processor configured to execute the program instructions to implement the file processing method.
[0016] As described above, according to the embodiments of this disclosure, instead of encrypting the entire source file (e.g., an AI model), the source file is randomly corrupted through a constructed file header structure. The random corruption rules are then encrypted and written into the source file header. Because the source file is randomly corrupted, the corrupted content is different each time for the same source file, resulting in different protected files. This maximizes the confidentiality and security of the source file protection. Furthermore, since the entire source file is not encrypted, the demand for computing resources is reduced while protecting the source file. This is particularly beneficial for devices with limited computing resources, improving the speed of deprotection before inference. The method of this application is applicable to protecting AI models and various application documents, without limitations on software and hardware environments or scenarios, and has strong versatility. Attached Figure Description
[0017] Figure 1 The diagram shown is a flowchart of a document processing method according to an embodiment of this application.
[0018] Figure 2 The diagram shown is another flowchart of a document processing method according to an embodiment of this application;
[0019] Figure 3 The flowchart shown is a document processing method according to an embodiment of this application, in which the first information of a protected document is verified.
[0020] Figure 4 The flowchart shown is a document processing method according to an embodiment of this application, in which the source file is derived based on the second information of the protected file.
[0021] Figure 5 The flowchart shown is an application example of a file processing method according to an embodiment of this application.
[0022] Figure 6 The diagram shown is a schematic diagram of the principle structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0023] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.
[0024] In existing technologies, the entire AI model is encrypted before deployment and release, and then decrypted before inference to obtain the original model for inference. However, encrypting the entire AI model can be computationally intensive, which is detrimental to the deployment and implementation of AI models on edge devices.
[0025] To address at least the aforementioned problems, this disclosure provides a file processing method that does not require encrypting the entire source file. Instead, it constructs a file header structure, randomly processes or corrupts the source file based on this header structure, and then encrypts the random processing or corruption rules and writes them into the source file header. This approach solves the technical problem of the high computational cost of encryption and decryption caused by encrypting the entire file during file protection.
[0026] Hereinafter, specific embodiments of the present disclosure will be described with reference to the accompanying drawings through exemplary embodiments.
[0027] Figure 1 This is a flowchart illustrating a file processing method according to an embodiment of the present disclosure. Figure 1 As shown, the file processing method includes the following steps S110 to S140.
[0028] In step S110, an empty first protected file is created for the source file. In some embodiments, the source file is an AI model file. In some embodiments, the file extension of the empty protected file is the same as that of the source file. For example, an empty AI protected model file, such as protected_model.pb, is created, and the file extension must be consistent with that of the AI source file, such as .pb or .onnx.
[0029] In addition, in some embodiments, the size of the source file can be determined, for example, the size of the AI source file, in preparation for the implementation of subsequent steps S120 to S140.
[0030] In step S120, a file header structure is constructed, which includes the processing rules to be performed on the source file. In some embodiments, the processing rules include random destruction rules. Random destruction rules will be described in detail later.
[0031] In step S130, the file header structure is encrypted, and a second protected file is formed based on the encrypted file header structure and the first protected file. In some embodiments, forming the second protected file based on the encrypted file header structure and the first protected file includes: writing the encrypted file header structure into the header of the first protected file to form the second protected file.
[0032] In some embodiments, the second protected file can be created in either of the following two ways.
[0033] As a first method, an encryption algorithm is used to encrypt the constructed file header structure; it is determined whether the size of the encrypted file header structure is equal to the size of the file header structure before encryption. If so, the encrypted file header structure is written into the header of the empty protected file; if not, an auxiliary header of a preset size is constructed, and then the auxiliary header is written into the header of the empty protected file. The encrypted file header structure is then written into the current tail of the empty protected file. The auxiliary header includes a preset magic number and the size of the encrypted file header structure.
[0034] As a second approach, an encryption algorithm is used to encrypt the constructed basic header. When the size of the encrypted basic header is equal to the size of the original basic header, and the size of the encrypted overlay operation unit list is equal to the size of the original overlay operation unit list, the encrypted basic header is written to the header of the empty protected file, and the encrypted overlay operation unit list is written to the current tail of the empty protected file. When the size of the encrypted basic header is not equal to the original basic header, or the size of the encrypted overlay operation unit list is equal to the size of the original overlay operation unit list, a pre-defined auxiliary header is constructed, and then the auxiliary header is written to the header of the empty protected file, and the encrypted basic header is written to the current tail of the empty protected file. The auxiliary header includes a pre-defined magic number, the size of the encrypted basic header, and the size of the encrypted overlay operation unit list.
[0035] In step S140, the source file is processed according to the file header structure, and a third protected file is formed based on the processed source file and the second protected file. In some embodiments, processing the source file according to the file header structure includes randomly destroying the source file according to the random destruction rules. In some embodiments, forming the third protected file based on the processed source file and the second protected file includes writing the processed source file to the end of the second protected file to form the third protected file.
[0036] In some embodiments, the file processing method may further include obtaining the source file, which includes an artificial intelligence source model file.
[0037] In some embodiments, after the third protection file is generated, the file processing method may further include performing publishing and deployment based on the third protection file.
[0038] The file processing method according to embodiments of this disclosure does not encrypt the entire source file (e.g., an AI model). Instead, it randomly corrupts the source file by constructing a file header structure and encrypts the random corruption rules before writing them into the source file header. Because the source file is randomly corrupted, the corrupted content is different each time for the same source file, resulting in different protected files, thus maximizing the confidentiality and security of the source file protection. Simultaneously, since the entire source file is not encrypted, the demand for computing resources is reduced while protecting the source file.
[0039] The random destruction rules will be described in detail below with reference to exemplary embodiments.
[0040] In some embodiments, the random destruction rules include, but are not limited to, the following first to fourth random destruction rules.
[0041] 1) First type of random violation rule
[0042] A first set of random numbers and a second set of random numbers are randomly generated, wherein the first set of random numbers corresponds to the offset address of the operation area in the source file, and the second set of random numbers corresponds to the target offset address of the operation area in the source file; a third set of random numbers is inserted after the offset address of each operation area as the operation length, wherein the starting position of the third set of random numbers is determined by the target offset address of the operation area.
[0043] In the first random destruction rule, the file header structure consists of a preset protection magic number and a preset number of operation area lists.
[0044] Each operation area in the operation area list consists of an offset address, a target offset address, and an operation length.
[0045] In the first random destruction rule, the process of constructing the file header structure is as follows:
[0046] (1) Set the protection magic number of the file header structure to the preset magic number.
[0047] (2) Set the operation area for the file header structure. The specific process is as follows:
[0048] (a) Generate two sets of predetermined numbers of random integers. The generated random integers must be greater than the predetermined minimum value (e.g., 0) and less than the size of the source file (in bytes). Additionally, the elements within each set of random numbers must be distinct.
[0049] a-1: Arrange one set of random numbers in ascending order and use them as the offset address of the preset number of operation areas.
[0050] a-2: Use another set of random numbers in the order they were generated as the target offset address of the preset number of operation areas.
[0051] (b) Generate another set of a preset number of random integers, requiring that the generated random integers be greater than the preset minimum value (such as 0) and less than the "size of the source file" multiplied by the "preset ratio", wherein the preset ratio is greater than 0 and less than 1.
[0052] The generated random numbers are used as the operation length of the preset number operation area according to the generation order.
[0053] (c) Traverse all preset number of operation areas. For each operation area:
[0054] Determine if the "target offset address + operation length" of the operation area exceeds the size of the source file. If it does, subtract the "target offset address of the operation area" from the "source file size" to obtain the operation length of the operation area.
[0055] 2) Second type of random disruption rule
[0056] A set of predetermined random numbers is generated as a list of swap offset addresses; the generated random numbers are paired according to predetermined rules, and the swap offset addresses in the list of swap offset addresses are divided into multiple pairing areas, each pairing area consisting of two swap addresses.
[0057] In the second type of random corruption rule, the file header structure consists of a preset protection magic number, swap type (e.g., swap_type), swap operation mode (e.g., swap_op_mode), pairing mode (e.g., swap_match_mode), swap area length (e.g., swap_len), actual number of pairs (e.g., match_number), a list of odd swap offset addresses, a list of even swap offset addresses, a list of odd pairing areas, and a list of even pairing areas.
[0058] Each pairing element in the odd-numbered pairing list and the even-numbered pairing list consists of swap address one and swap address two.
[0059] Specifically, in this embodiment, a set of predetermined random numbers (i.e., an "odd-number swap offset address list" or an "even-number swap offset address list") is generated. Based on the generated set of random numbers (e.g., a1, a2, a3, a4), they are paired according to predetermined rules (e.g., a1 and a4 are paired, a2 and a3 are paired). The final number of paired numbers is the "actual pairing number" (e.g., a1 and a4 are paired, a2 and a3 are paired, so the actual pairing number here is 2). This pairing corresponds to the concept of a "pairing area" in the header structure (multiple "pairing areas" constitute the concept of a "pairing area list"). Each "pairing area" contains two corresponding addresses, called "swap address one" and "swap address two" (e.g., a1 and a4 are paired, so a1 and a4 constitute a pairing area, and swap addresses one and two within it correspond to a1 and a4). Finally, the contents of the source file corresponding to "swap address one" and "swap address two" in the pairing area are swapped. The length of the swapped data (i.e., the "swap area length") is determined according to predetermined rules.
[0060] The "Swap Type" field determines whether the number of random numbers to be generated is odd or even. Different "Swap Types" correspond to different "Swap Operation Modes," with two corresponding "Swap Operation Modes" for both odd and even "Swap Types." Regardless of the "Swap Type" and "Swap Operation Mode," the final "Pairing Mode" rule remains consistent.
[0061] After determining whether the number is odd or even by the "swap type", odd numbers are represented by the "odd swap offset address list" and the "odd pairing area list", while even numbers are represented by the "even swap offset address list" and the "even pairing area list".
[0062] In this embodiment, the "pairing according to preset rules" is determined by the "exchange type", "exchange operation mode" and "pairing mode".
[0063] In the second random destruction rule, the process of constructing the file header structure is as follows:
[0064] (1) Set the protection magic number of the file header structure to the preset magic number.
[0065] (2) Randomly generate a positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the swap type (such as swap_type) of the file header structure, where 0 indicates that the swap type is even and 1 indicates that the swap type is odd.
[0066] (3) Randomly generate a positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the swap operation mode (such as swap_op_mode) of the file header structure, where 0 represents swap operation mode one and 1 represents swap operation mode two.
[0067] (4) Randomly generate a positive integer, perform a modulo operation between the integer and 3, and use the resulting value as the pairing mode (such as swap_match_mode) of the file header structure, where 0 represents pairing mode one, 1 represents pairing mode two, and 2 represents pairing mode three.
[0068] (5) If the swap type (e.g., swap_type) is odd, a set of random integers of a preset odd number is generated as the odd swap offset address list for the file header structure. Otherwise, if the swap type is even, a set of random integers of a preset even number is generated as the even swap offset address list for the file header structure.
[0069] a) The generated random number must be greater than the preset minimum value (e.g., 0) and less than the size of the source file (in bytes).
[0070] b) The elements in the generated list of swapped offset addresses must be distinct from each other.
[0071] c) Arrange the elements in the generated list of swapped offset addresses in ascending order.
[0072] (6) Settings for swap length (e.g., swap_len), actual number of pairs (e.g., match_number), odd-numbered pairing list, and even-numbered pairing list. Specifically:
[0073] 6-1) If the swap type (e.g., swap_type) is odd:
[0074] a) Construct a temporary swap offset address list:
[0075] a-1) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode one:
[0076] The temporary swap offset address list consists of an odd-numbered swap offset address list.
[0077] a-2) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode two:
[0078] The temporary swap offset list is constructed by adding one element to the beginning and one to the end of the odd swap offset list. Therefore, the length of the temporary swap offset list is: odd swap offset list + 2. Furthermore, the first element (the first element) of the temporary swap offset list is 0, indicating the start of the source file. The last element (the last element) of the temporary swap offset list is: source file size (in bytes) - 1.
[0079] b) Subtract each pair of directly adjacent swap offset addresses in the temporary swap offset address list in sequence to obtain a set of adjacent differences. The length of this set of adjacent differences is: the length of the temporary swap offset address list - 1.
[0080] c) Use the minimum value of the obtained adjacent differences as the length of the swap area in the file header structure (e.g., swap_len).
[0081] d) Divide the length of the resulting adjacent difference by 2 and round down to get the actual number of pairs in the file header structure (e.g., match_number).
[0082] e) The odd-numbered pairing list is set according to the following rules:
[0083] e-1) If the pairing mode (e.g., swap_match_mode) is pairing mode one:
[0084] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0085] Set the swap address of the paired area element to the value of the "traversal index (e.g., index)" element in the temporary swap offset address list.
[0086] Set the swap address of the paired area element to the value of the element in the temporary swap offset address list that is "(index of the last element in the temporary swap offset address list)-1-traversal index".
[0087] e-2) If the pairing mode (e.g., swap_match_mode) is pairing mode two:
[0088] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0089] Set the swap address of the paired area element to the value of the element at the second traversal index (e.g., index) in the temporary swap offset address list.
[0090] Set the swap address of the paired area element to the value of the "2nd traversal index (e.g., index) + 1" element in the temporary swap offset address list.
[0091] e-3) If the pairing mode (e.g., swap_match_mode) is pairing mode three:
[0092] The initial value of the random selection list is set to: a temporary swap offset address list after removing the last element. Therefore, the initial length of this random selection list is: the length of the temporary swap offset address list - 1.
[0093] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0094] Set the swap address of the paired elements to the value of the first element in the list randomly selected.
[0095] Generate a random positive integer. Take the modulo operation between this integer and the length of the random selection list, and use the result as the random selection index. If the random selection index is 0 (i.e., the first element), increment the random selection index by 1.
[0096] The second swap address for the paired elements is set to a value at a randomly selected index position from the list.
[0097] Update the random selection list and its length: Take all elements from the current random selection list except the first element and the element at the random selection index, and construct a new random selection list in order. Use this new random selection list as the new value of the random selection list. Simultaneously, set the length of the new random selection list to "the length of the random selection list - 2".
[0098] 6-2) If the swap type (e.g., swap_type) is even:
[0099] a) Construct a temporary swap offset address list:
[0100] a-1) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode one:
[0101] The temporary swap offset list is formed by adding one element to the beginning of the even-numbered swap offset list. Therefore, the length of the temporary swap offset list is: even-numbered swap offset list + 1. And the first element (the first element) of the temporary swap offset list is 0, indicating the starting position of the source file.
[0102] a-2) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode two:
[0103] The temporary swap offset list is formed by adding an element to the end of the even-numbered swap offset list. Therefore, the length of the temporary swap offset list is: even-numbered swap offset list + 1. And the last element of the temporary swap offset list is: source file size (in bytes) - 1.
[0104] b) Subtract each pair of directly adjacent swap offset addresses in the temporary swap offset address list in sequence to obtain a set of adjacent differences. The length of this set of adjacent differences is: the length of the temporary swap offset address list - 1.
[0105] c) Use the minimum value of the obtained adjacent differences as the length of the swap area in the file header structure (e.g., swap_len).
[0106] d) Divide the length of the resulting adjacent difference by 2 and round down to get the actual number of pairs in the file header structure (e.g., match_number).
[0107] e) The even-numbered pairing list is set according to the following rules:
[0108] e-1) If the pairing mode (e.g., swap_match_mode) is pairing mode one:
[0109] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair: set the swap address of the pair element to the value of the element at the "traversal index (e.g., index)" in the temporary swap offset address list.
[0110] Set the swap address of the paired area element to the value of the element in the temporary swap offset address list that is "(index of the last element in the temporary swap offset address list)-1-traversal index".
[0111] e-2) If the pairing mode (e.g., swap_match_mode) is pairing mode two:
[0112] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0113] Set the swap address of the paired area element to the value of the element at the second traversal index (e.g., index) in the temporary swap offset address list.
[0114] Set the swap address of the paired area element to the value of the "2nd traversal index (e.g., index) + 1" element in the temporary swap offset address list.
[0115] e-3) If the pairing mode (e.g., swap_match_mode) is pairing mode three:
[0116] The initial value of the random selection list is set to: a temporary swap offset address list after removing the last element. Therefore, the initial length of this random selection list is: the length of the temporary swap offset address list - 1.
[0117] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0118] Set the swap address of the paired elements to the value of the first element in the list randomly selected.
[0119] Generate a random positive integer. Take the modulo operation between this integer and the length of the random selection list, and use the result as the random selection index. If the random selection index is 0 (i.e., the first element), increment the random selection index by 1.
[0120] The second swap address for the paired elements is set to a value at a randomly selected index position from the list.
[0121] Update the random selection list and its length: Take all elements from the current random selection list except the first element and the element at the random selection index, and construct a new random selection list in order. Use this new random selection list as the new value of the random selection list. Simultaneously, set the length of the new random selection list to "the length of the random selection list - 2".
[0122] 3) The third type of random violation rule
[0123] Generate a set of preset number of random numbers; group the source files according to preset rules based on the generated random numbers, and randomly determine the group type for each group of source files; construct the corresponding file header structure for each group based on the group type.
[0124] In the third random corruption rule, the file header structure is composed of a preset protection magic number, a grouping mode (such as group_divide_mode), a list of operation point offset addresses (such as op_offset), the actual number of groups (such as group_number), the group length type (such as group_len_type), and a list of operation groups.
[0125] Each operation group element in the operation group list consists of the group length (e.g., group_len), the group offset address list (e.g., group_offset), the head and tail node mode (e.g., group_head_tail_mode), the head node offset address (e.g., group_head_offset), the tail node offset address (e.g., group_tail_offset), the group type (e.g., group_type), a one-head structure for the group type, and a two-head structure for the group type.
[0126] The group type header structure consists of the actual number of operation areas (e.g., gap_num) and a list of operation areas. Each operation area in the list consists of an offset address, a target offset address, and an operation length. The group type header structure consists of the swap type (e.g., swap_type), swap operation mode (e.g., swap_op_mode), pairing mode (e.g., swap_match_mode), swap area length (e.g., swap_len), actual number of pairs (e.g., match_number), a list of odd swap offset addresses, a list of even swap offset addresses, a list of odd pairing areas, and a list of even pairing areas.
[0127] In this context, each pairing element in the odd-numbered pairing list and the even-numbered pairing list consists of swap address one and swap address two.
[0128] Specifically, in this embodiment, a set of preset number of random numbers (i.e., an "operation point offset address list") is generated. The source file is grouped according to the generated random numbers and preset rules, and the source file is segmented, with each segment corresponding to a group. Then, a file header structure is constructed for different groups according to a randomly determined group type (i.e., the "group type" of the operation group). The file header structure includes a first method of constructing the processing rules to be executed on the source file, or a second method of constructing the file header structure including the processing rules to be executed on the source file. The file header structure includes the processing rules to be executed on the source file.
[0129] Each group is represented by an "operation group," and the actual number of groups is represented by an "actual group number." All groups constitute the concept of an "operation group list." The "group type" within an "operation group" determines whether to apply a file header structure, which includes the first approach to the processing rules to be performed on the source file, or a file header structure, which includes the basic idea of the second approach. A "group type one-header structure" applies the file header structure, which includes the information needed for the basic idea of the first approach to the processing rules to be performed on the source file. A "group type two-header structure" applies the file header structure, which includes the information needed for the basic idea of the second approach to the processing rules to be performed on the source file.
[0130] The boundaries of each operation group are determined by the "head node offset address" and the "tail node offset address." There are two grouping methods, corresponding to "grouping modes," and different grouping modes have different configuration rules for groups (i.e., "operation groups"). Grouping mode one uses generated random numbers (i.e., the "operation point offset address list") as the group boundaries. Each group generates its own set of random numbers (i.e., the "group offset address list"), and the number of generated random numbers is determined by the "group length." Grouping mode two uses the generated random numbers (i.e., the "operation point offset address list") as the basis to divide these operation points into different groups according to preset rules. "Group length type" and "head and tail node mode" are only used in grouping mode two to assist in group division.
[0131] Different grouping methods use different methods to determine the boundaries of each operation group (i.e., the "head node offset address" and the "tail node offset address" of the group). In grouping mode two, the boundaries are determined based on three "head and tail node modes".
[0132] In the third random corruption rule, the process of constructing the file header structure is as follows:
[0133] (1) Set the protection magic number of the file header structure to the preset magic number.
[0134] (2) Randomly generate a positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the grouping mode (e.g., group_divide_mode) of the file header structure, where for example, 0 represents grouping mode one and 1 represents grouping mode two.
[0135] (3) If the grouping mode (e.g., group_divide_mode) is mode one:
[0136] (3-1) Set the actual number of groups in the file header structure (e.g., group_number) to the preset number of groups.
[0137] (3-2) Generate a set of random integers of the number "actual number of groups - 1" as the operation point offset address list (e.g., op_offset) in the file header structure. That is, the length of the operation point offset address list is "actual number of groups - 1", and the requirements are:
[0138] a) The generated random number must be greater than the preset minimum value (e.g., 0) and less than the size of the source file (in bytes).
[0139] b) The elements in the generated list of operation point offset addresses must be distinct from each other.
[0140] c) Arrange the elements in the generated list of operation point offset addresses in ascending order.
[0141] (3-3) Traverse the list of operation groups in the file header structure, starting from the first element of the operation group list (index = 0) and continuing until the actual number of groups (group_number) elements are reached. For each operation group:
[0142] (3-3-1) Set the "group head node offset address (e.g., group_head_offset)" and "group tail node offset address (e.g., group_tail_offset)" of the operation group.
[0143] a) If it is the first operation group:
[0144] Set the head node offset address of the group (e.g., group_head_offset) to 0;
[0145] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the "traversal index (e.g., index)" element of the list of operation point offset addresses.
[0146] b) If it is the last operation group:
[0147] Set the offset address of the group's head node (e.g., group_head_offset) to the value of the element at the "traversal index (e.g., index) - 1"th element in the list of operation point offset addresses;
[0148] Set the tail node offset address of the group (e.g., group_tail_offset) to the size of the source file (in bytes);
[0149] c) For other operation groups:
[0150] Set the offset address of the group's head node (e.g., group_head_offset) to the value of the element at the "traversal index (e.g., index) - 1"th element in the list of operation point offset addresses;
[0151] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the element at the "traversal index (e.g., index)" of the list of operation point offset addresses;
[0152] (3-3-2) Set the group length of the operation group (e.g., group_len):
[0153] Generate a random integer that is not less than the preset minimum group length (e.g., 3) and not greater than the preset maximum group length. Use the resulting random integer that meets the requirements as the group length (e.g., group_len) of the operation group.
[0154] (3-3-3) Set the list of group offset addresses for the operation group (e.g., group_offset):
[0155] Generate a set of random integers equal to the "group length of the operation group" as a list of group offset addresses for the operation group (e.g., group_offset). The length of the list of group offset addresses is equal to the current group length. The requirements are:
[0156] a) The generated random number must be greater than the "head node offset address of the group" and less than the "tail node offset address of the group".
[0157] b) The elements in the generated list of group offset addresses must be distinct from each other.
[0158] c) Arrange the elements in the generated list of group offset addresses in ascending order.
[0159] (3-3-4) Set the group type of the operation group (e.g., group_type):
[0160] Generate a random positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the group type of the operation group, where 0 represents group type one and 1 represents group type two.
[0161] (3-3-5) If the group type of the operation group is group type one, then set the group type one header structure of the operation group according to the following rule (4):
[0162] (3-3-6) If the group type of the operation group is group type two, then set the group type two header structure of the operation group according to the following rule (5):
[0163] If the grouping mode (such as group_divide_mode) is mode two:
[0164] (3-1) Generate a set of predetermined random integers as a list of operation point offset addresses (e.g., op_offset) for the file header structure, and require:
[0165] a) The generated random number must be greater than the preset minimum value (e.g., 0) and less than the size of the source file (in bytes).
[0166] b) The elements in the generated list of operation point offset addresses must be distinct from each other.
[0167] c) Arrange the elements in the generated list of operation point offset addresses in ascending order.
[0168] (3-2) Set the group length type (e.g., group_len_type) of the file header structure:
[0169] A random positive integer is generated. The integer is modulo 4, and the resulting value is used as the group length type of the file header structure. 0 represents group length type one, 1 represents group length type two, 2 represents group length type three, and 3 represents group length type four.
[0170] (3-3) Set the actual number of groups in the file header structure (e.g., group_number):
[0171] If the group length type is group length type one, the actual number of groups in the file header structure is set to: the length of the operation point offset address list divided by the preset maximum group length, and rounded up.
[0172] If the group length type is group length type two, the actual number of groups in the file header structure is set to: the length of the operation point offset address list divided by the preset minimum group length, and then rounded down.
[0173] If the group length type is group length type three, set the actual number of groups in the file header structure to the preset number of groups.
[0174] If the group length type is Group Length Type 4, randomly generate an integer that is not less than the minimum group size and not greater than the maximum group size. The minimum group size is calculated by dividing the length of the operation point offset address list by the preset maximum group length and rounding up, while the maximum group size is calculated by dividing the length of the operation point offset address list by the preset minimum group length and rounding down. The resulting random integer that meets these requirements will be used as the actual number of groups in the file header structure.
[0175] (3-4) Traverse the list of operation groups in the file header structure, starting from the first element of the operation group list (index = 0) and continuing until the actual number of groups (group_number) elements are reached. For each operation group:
[0176] (3-4-1) Set the group length of the operation group (e.g., group_len):
[0177] a) If it is the last operation group:
[0178] Set the group length of the operation group to: "length of the operation point offset address list" minus "traversal index" multiplied by the step size. The step size is "length of the operation point offset address list divided by the actual number of groups in the file header structure, rounded down".
[0179] b) For other operation groups:
[0180] Set the group length of the operation group to: the length of the operation point offset address list divided by the actual number of groups in the file header structure, and rounded down.
[0181] (3-4-2) Set the list of group offset addresses for the operation group (e.g., group_offset):
[0182] Iterate through the list of group offset addresses for the operation group, starting from the first element (i=0) of the list and continuing until the group length (e.g., group_len) elements are reached. For each offset address in the list:
[0183] The value at the "offset address index" position of the group offset address list is set to the value of the element at the "operation group traversal index multiplied by the step size plus the offset address index" (i.e., operation group traversal index x step size + offset address index) of the operation point offset address list in the file header structure. The step size is the length of the operation point offset address list divided by the actual number of groups in the file header structure, rounded down.
[0184] (3-4-3) Set the head and tail node mode of the operation group (e.g., group_head_tail_mode):
[0185] A positive integer is randomly generated. The integer is modulo 3. The resulting value is used as the head and tail node pattern of the operation group. 0 represents head and tail node pattern one, 1 represents head and tail node pattern two, and 2 represents head and tail node pattern three.
[0186] (3-4-4) Set the group type of the operation group (e.g., group_type):
[0187] Generate a random positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the group type of the operation group, where 0 represents group type one and 1 represents group type two.
[0188] (3-5) Iterate through the operation group list in the file header structure again, starting from the first element of the operation group list (index = 0) and continuing until the actual number of groups (group_number) elements are reached. For each operation group:
[0189] (3-5-1) Set the "group head offset address (e.g., group_head_offset)" and "group tail offset address (e.g., group_tail_offset)" for the operation group.
[0190] If the head and tail node patterns of the operation group are head and tail node pattern one:
[0191] a) If it is the first operation group:
[0192] Set the head node offset address of the group (e.g., group_head_offset) to 0.
[0193] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the last element in the list of group offset addresses for the current operation group.
[0194] Update the group offset address list (e.g., group_offset) of the operation group to: remove the last element from the original group offset address list of the operation group.
[0195] The update operation group's group length (e.g., group_len) is: the original operation group's group length (e.g., group_len) minus 1.
[0196] b) If it is the last operation group:
[0197] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0198] Set the tail node offset address of the group (e.g., group_tail_offset) to the size of the source file (in bytes);
[0199] c) For other operation groups:
[0200] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0201] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the last element in the list of group offset addresses for the current operation group.
[0202] Update the group offset address list (e.g., group_offset) of the operation group to: remove the last element from the original group offset address list of the operation group.
[0203] The update operation group's group length (e.g., group_len) is: the original operation group's group length (e.g., group_len) minus 1.
[0204] If the head and tail node pattern of the operation group is head and tail node pattern two:
[0205] a) If it is the first operation group:
[0206] Set the head node offset address of the group (e.g., group_head_offset) to 0.
[0207] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the first element of the group offset address list for the next operation group.
[0208] b) If it is the last operation group:
[0209] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0210] Set the tail node offset address of the group (e.g., group_tail_offset) to the size of the source file (in bytes);
[0211] The update operation group's group length (e.g., group_len) is: the original operation group's group length (e.g., group_len) minus 1.
[0212] Update the group offset address list (e.g., group_offset) of the operation group to: remove the first element from the original group offset address list of the operation group.
[0213] c) For other operation groups:
[0214] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0215] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the first element of the group offset address list for the next operation group.
[0216] The update operation group's group length (e.g., group_len) is: the original operation group's group length (e.g., group_len) minus 1.
[0217] Update the group offset address list (e.g., group_offset) of the operation group to: remove the first element from the original group offset address list of the operation group.
[0218] If the head and tail node pattern of the operation group is head and tail node pattern three:
[0219] a) If it is the first operation group:
[0220] Set the head node offset address of the group (e.g., group_head_offset) to 0.
[0221] Set the tail node offset address of the group (e.g., `group_tail_offset`) to: "the value of the last element in the group offset address list of the current operation group" plus "the inter-group difference multiplied by a preset ratio". The inter-group difference is the value of the first element in the group offset address list of the next operation group minus the value of the last element in the group offset address list of the current operation group. The preset ratio must be greater than 0 and less than 1.
[0222] b) If it is the last operation group:
[0223] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0224] Set the tail node offset address of the group (e.g., group_tail_offset) to the size of the source file (in bytes);
[0225] c) For other operation groups:
[0226] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0227] Set the tail node offset address of the group (e.g., `group_tail_offset`) to: "the value of the last element in the group offset address list of the current operation group" plus "the inter-group difference multiplied by a preset ratio". The inter-group difference is the value of the first element in the group offset address list of the next operation group minus the value of the last element in the group offset address list of the current operation group. The preset ratio must be greater than 0 and less than 1.
[0228] (3-5-2) If the group type of the operation group is group type one, then set the group type one header structure of the operation group according to the following rule (4):
[0229] (3-5-3) If the group type of the operation group is group type two, then set the group type two header structure of the operation group according to the following rule (5):
[0230] (4) Set the group type of the operation group to a head structure:
[0231] (4-1) Set the actual number of operation areas (e.g., gap_num) of the group type head structure to the group length of the operation group.
[0232] (4-2) Set up the operation area list of the group type with a head structure. The specific process is as follows:
[0233] Iterate through the list of operands, starting from the first element of the list (index = 0) and continuing until the number of operands (gap_num) elements are reached. For each operand:
[0234] a) Set the offset address of the operation area to the value of the "traversal index (e.g., index)" element of the group offset address list of the operation group;
[0235] b) Generate a random integer that is greater than a preset minimum value (e.g., 0) and less than the source file size (in bytes). Use the resulting random integer that meets the requirements as the target offset address of the operation area.
[0236] c) Generate a random integer that is greater than a preset minimum value (e.g., 0) and less than "the size of the source file multiplied by a preset ratio", where the preset ratio is greater than 0 and less than 1.
[0237] The obtained random integer that meets the requirements is used as the operation length of the operation area.
[0238] d) Determine whether the "target offset address + operation length" of the operation area exceeds the size of the source file. If it does, subtract the target offset address of the operation area from the size of the source file to obtain the operation length of the operation area.
[0239] (5) Set the group type of the operation group to a two-headed structure:
[0240] (5-1) Perform a modulo operation between the group length of the operation group and 2, and use the resulting value as the swap type (such as swap_type) of the group type binary structure of the operation group, where 0 indicates that the swap type is even and 1 indicates that the swap type is odd.
[0241] (5-2) Randomly generate a positive integer, perform a modulo operation on the integer and 2, and use the resulting value as the swap operation mode (such as swap_op_mode) of the group type two-head structure of the operation group, where 0 represents swap operation mode one and 1 represents swap operation mode two.
[0242] (5-3) Randomly generate a positive integer, perform a modulo operation between the integer and 3, and use the resulting value as the pairing mode of the group type two-head structure of the operation group (such as swap_match_mode), where 0 represents pairing mode one, 1 represents pairing mode two, and 2 represents pairing mode three.
[0243] (5-4) If the swap type (e.g., swap_type) is odd, then the group offset address list of the operation group is used as the odd swap offset address list of the group type two-head structure of the operation group. Otherwise, if the swap type is even, then the group offset address list of the operation group is used as the even swap offset address list of the group type two-head structure of the operation group.
[0244] (5-5) Settings for swap length (e.g., swap_len), actual number of pairs (e.g., match_number), odd-numbered pairing list, and even-numbered pairing list. Specifically:
[0245] If the swap type (such as swap_type) is odd:
[0246] a) Construct a temporary swap offset address list:
[0247] a-1) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode one:
[0248] The temporary swap offset address list consists of an odd-numbered swap offset address list.
[0249] a-2) If the swap operation mode (e.g., swap_op_mode) is type swap operation mode two: the temporary swap offset address list is constructed by adding one element to the beginning and one to the end of the odd swap offset address list. Therefore, the length of the temporary swap offset address list is: odd swap offset address list + 2. And:
[0250] The first element (i.e., the first element) of the temporary swap offset address list is: the "head node offset address of the operation group".
[0251] The last element (i.e., the last element) of the temporary swap offset address list is: the "tail node offset address of the operation group".
[0252] b) Subtract the directly adjacent swap offset addresses in the temporary swap offset address list in order to obtain a set of adjacent differences.
[0253] The length of the resulting adjacent difference is: the length of the temporary swap offset address list - 1.
[0254] c) The minimum value of the adjacent differences obtained in this group is taken as the swap length of the group type two-head structure of the operation group (e.g., swap_len).
[0255] d) Divide the length of the adjacent difference obtained in this group by 2 and round down to get the actual number of pairs (e.g., match_number) of the two-headed structure of the group type of the operation group.
[0256] e) The odd-numbered pairing list is set according to the following rules:
[0257] e-1) If the pairing mode (e.g., swap_match_mode) is pairing mode one:
[0258] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0259] Set the swap address of the paired area element to the value of the "traversal index (e.g., index)" element in the temporary swap offset address list.
[0260] Set the swap address of the paired area element to the value of the element in the temporary swap offset address list that is "(index of the last element in the temporary swap offset address list)-1-traversal index".
[0261] e-2) If the pairing mode (e.g., swap_match_mode) is pairing mode two:
[0262] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0263] Set the swap address of the paired area element to the value of the element at the second traversal index (e.g., index) in the temporary swap offset address list.
[0264] Set the swap address of the paired area element to the value of the "2nd traversal index (e.g., index) + 1" element in the temporary swap offset address list.
[0265] e-3) If the pairing mode (e.g., swap_match_mode) is pairing mode three:
[0266] The initial value of the random selection list is set to: a temporary swap offset address list after removing the last element. Therefore, the initial length of this random selection list is: the length of the temporary swap offset address list - 1.
[0267] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0268] Set the swap address of the paired elements to the value of the first element in the list randomly selected.
[0269] Generate a random positive integer. Take the modulo operation between this integer and the length of the random selection list, and use the result as the random selection index. If the random selection index is 0 (i.e., the first element), increment the random selection index by 1.
[0270] The second swap address for the paired elements is set to a value at a randomly selected index position from the list.
[0271] Update the random selection list and its length: Take all elements from the current random selection list except the first element and the element at the random selection index, and construct a new random selection list in order. Use this new random selection list as the new value of the random selection list. Simultaneously, set the length of the new random selection list to "the length of the random selection list - 2".
[0272] If the swap type (such as swap_type) is even:
[0273] a) Construct a temporary swap offset address list:
[0274] a-1) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode one:
[0275] The temporary swap offset address list is formed by adding one element to the beginning of the even-numbered swap offset address list. Therefore, the length of the temporary swap offset address list is: even-numbered swap offset address list + 1. Furthermore, the first element (the first element) of the temporary swap offset address list is: the "head node offset address" of the operation group.
[0276] a-2) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode two:
[0277] The temporary swap offset address list is formed by adding an element to the end of the even-numbered swap offset address list. Therefore, the length of the temporary swap offset address list is: even-numbered swap offset address list + 1. And the last element of the temporary swap offset address list is: the "tail node offset address of the operation group".
[0278] b) Subtract the directly adjacent swap offset addresses in the temporary swap offset address list in order to obtain a set of adjacent differences.
[0279] The length of the resulting adjacent difference is: the length of the temporary swap offset address list - 1.
[0280] c) The minimum value of the adjacent differences obtained in this group is taken as the swap length of the group type two-head structure of the operation group (e.g., swap_len).
[0281] d) Divide the length of the adjacent difference obtained in this group by 2 and round down to get the actual number of pairs (e.g., match_number) of the two-headed structure of the group type of the operation group.
[0282] e) The even-numbered pairing list is set according to the following rules:
[0283] e-1) If the pairing mode (e.g., swap_match_mode) is pairing mode one:
[0284] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0285] Set the swap address of the paired area element to the value of the "traversal index (e.g., index)" element in the temporary swap offset address list.
[0286] Set the swap address of the paired area element to the value of the element in the temporary swap offset address list that is "(index of the last element in the temporary swap offset address list)-1-traversal index".
[0287] e-2) If the pairing mode (e.g., swap_match_mode) is pairing mode two:
[0288] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0289] Set the swap address of the paired area element to the value of the element at the second traversal index (e.g., index) in the temporary swap offset address list.
[0290] Set the swap address of the paired area element to the value of the "2nd traversal index (e.g., index) + 1" element in the temporary swap offset address list.
[0291] e-3) If the pairing mode (e.g., swap_match_mode) is pairing mode three:
[0292] The initial value of the random selection list is set to: a temporary swap offset address list after removing the last element. Therefore, the initial length of this random selection list is: the length of the temporary swap offset address list - 1.
[0293] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair: set the swap address of the pair element to the value of the first element of the randomly selected list.
[0294] Generate a random positive integer. Take the modulo operation between this integer and the length of the random selection list, and use the result as the random selection index. If the random selection index is 0 (i.e., the first element), increment the random selection index by 1.
[0295] The second swap address for the paired elements is set to a value at a randomly selected index position from the list.
[0296] Update the random selection list and its length: Take all elements from the current random selection list except the first element and the element at the random selection index, and construct a new random selection list in order. Use this new random selection list as the new value of the random selection list. Simultaneously, set the length of the new random selection list to "the length of the random selection list - 2".
[0297] 4) The fourth type of random destruction rule
[0298] In this embodiment, constructing the file header structure according to the fourth random destruction rule includes: constructing a basic header and a list of overlay operation units, and performing a random number of overlay operations on the source file based on the list of overlay operation units; in each overlay operation, constructing a corresponding file header structure according to different randomly generated operation types.
[0299] In the fourth random corruption rule, the file header structure consists of a base header of a preset size and a list of stacked operation units.
[0300] The basic header is composed of a preset protection magic number, overlay mode (e.g., overlay_mode), overlay point offset address list (e.g., overlay_offset), overlay point offset address list length (e.g., overlay_offset_len), actual overlay count (e.g., iteration_number), and overlay operation unit length (e.g., iteration_unit_size).
[0301] The list of stacking operation units, located after a base header of a preset size, is a list consisting of stacking operation units of stacking count (e.g., iteration_number). Each stacking operation unit is composed of the length of the iteration offset address list (e.g., iteration_offset_len), the iteration offset address list (e.g., iteration_offset), the iteration operation type (e.g., iteration_op_type), a one-head structure for the iteration operation type, a two-head structure for the iteration operation type, and a three-head structure for the iteration operation type.
[0302] The iterative operation type structure consists of the number of actual operation areas (e.g., gap_num) and a list of operation areas. Each operation area in the list consists of an offset address, a target offset address, and an operation length.
[0303] The iterative operation type binary structure consists of the swap type (e.g., swap_type), swap operation mode (e.g., swap_op_mode), pairing mode (e.g., swap_match_mode), swap region length (e.g., swap_len), actual number of pairs (e.g., match_number), a list of odd swap offset addresses, a list of even swap offset addresses, a list of odd pairing regions, and a list of even pairing regions. Each pairing region element in the odd and even pairing region lists consists of swap address one and swap address two.
[0304] The three-head structure of an iterative operation type consists of a grouping mode (e.g., group_divide_mode), a list of operation point offset addresses (e.g., op_offset), the actual number of groups (e.g., group_number), the group length type (e.g., group_len_type), and a list of operation groups.
[0305] Each operation group element in the operation group list consists of the group length (e.g., group_len), the group offset address list (e.g., group_offset), the head and tail node mode (e.g., group_head_tail_mode), the head node offset address of the group (e.g., group_head_offset), the tail node offset address of the group (e.g., group_tail_offset), the group type (e.g., group_type), a one-head structure of the group type, and a two-head structure of the group type.
[0306] The group type one-head structure and the iteration operation type one-head structure are the same, and the group type two-head structure and the iteration operation type two-head structure are the same.
[0307] Specifically, in this embodiment, the source file is subjected to a random number of operations (i.e., "actual superposition counts"). For each operation, a file header structure is constructed based on the randomly generated different operation types (i.e., "iterative operation types"). The file header structure includes the basic idea of a first method of processing rules to be executed on the source file, a second method of constructing a file header structure that includes processing rules to be executed on the source file, or a third method of constructing a file header structure that includes processing rules to be executed on the source file.
[0308] Each operation is represented by a "stacked operation unit", the size of which is represented by the "stacked operation unit length", and all operations constitute a "stacked operation unit list".
[0309] The "Iterative Operation Type" within the "Overlay Operation Unit" determines whether to apply a file header structure. This file header structure includes either a first method of processing the source file, a second method of processing the source file, or a third method of processing the source file. A "One-Header Structure for Iterative Operation Type" applies the file header structure, which includes the information needed for the basic idea of the first method of processing the source file. A "Two-Header Structure for Iterative Operation Type" applies the file header structure, which includes the information needed for the basic idea of the second method of processing the source file. A "Three-Header Structure for Iterative Operation Type" applies the file header structure, which includes the information needed for the basic idea of the third method of processing the source file.
[0310] Each operation can employ two methods (i.e., "overlay mode"). Method one ("overlay mode one") uses randomly generated random numbers (i.e., the "iterative offset address list") for each operation, and the number of random numbers generated each time (i.e., the "iterative offset address list length") is also different. Method two ("overlay mode two") uses the same set of basic random numbers (i.e., the "overlay point offset address list," the length of which is determined by the "overlay point offset address list length"), but for each operation, these basic random numbers are randomly transformed according to preset rules, and the transformed value is used as the value in the "iterative offset address list."
[0311] The "overlay point offset address list" and "overlay point offset address list length" are only used in operation method two (i.e. "overlay mode two"), and are not needed in overlay mode one.
[0312] In the fourth random corruption rule, the process of constructing the file header structure is as follows:
[0313] (1) Set the protection magic number of the basic header in the file header structure to the preset magic number.
[0314] (2) Randomly generate a positive integer that is greater than or equal to a preset minimum value and less than or equal to a preset maximum value. Use the resulting random positive integer that meets the requirements as the actual number of times the basic header is stacked in the file header structure (e.g., iteration_number).
[0315] (3) Set the stacking operation unit length (e.g., iteration_unit_size) of the basic header in the file header structure to the size of the stacking operation unit.
[0316] (4) Randomly generate a positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the overlay mode (e.g., overlay_mode) of the basic header in the file header structure, where 0 represents overlay mode one and 1 represents overlay mode two.
[0317] (5) Construct a list of stacking operation units consisting of the actual number of stacking times (e.g., iteration_number), which is called the stacking operation unit list.
[0318] (6) If the overlay mode (e.g., overlay_mode) is overlay mode one:
[0319] (6-1) Set the initial value of the extension length (e.g., extend_len) to 0.
[0320] (6-2) Traverse the list of stacking operation units, starting from the first element of the list (iterate_index = 0) and continuing until the actual stacking count (iteration_number) of the base header in the file header structure. For each stacking operation unit:
[0321] (6-2-1) Randomly generate a positive integer that is greater than or equal to a preset minimum value and less than or equal to a preset maximum value. Use the obtained random positive integer that meets the requirements as the length of the iterative offset address list of the superposition operation unit (e.g., iteration_offset_len).
[0322] (6-2-2) Generate a set of random integers equal to the length of the "iteration offset address list" as the iteration offset address list for the superposition operation unit (e.g., iteration_offset), and require:
[0323] a) The generated random number must be greater than the preset minimum value (e.g., 0) and less than "source file size plus extension length" (in bytes).
[0324] b) The elements in the generated iterative offset address list must be distinct from each other.
[0325] c) Arrange the elements in the generated iterative offset address list in ascending order.
[0326] (6-2-3) Randomly generate a positive integer, perform a modulo operation on the integer and 3, and use the resulting value as the iteration operation type (such as iteration_op_type) of the superposition operation unit, where 0 represents iteration operation type one, 1 represents iteration operation type two, and 2 represents iteration operation type three.
[0327] (6-2-4) Set the corresponding iteration operation type header structure according to the iteration operation type of the superposition operation unit (such as iteration_op_type). Specifically:
[0328] (a) If the iteration operation type (e.g., iteration_op_type) of the superposition operation unit is iteration operation type one, then the iteration operation type one header structure of the superposition operation unit is set according to the rules in 3 below.
[0329] (b) If the iteration operation type (e.g., iteration_op_type) of the superposition operation unit is iteration operation type two, then the superposition operation unit's iteration operation type two head structure shall be set according to the rules in 4 below.
[0330] (c) If the iteration operation type of the superposition operation unit (e.g., iteration_op_type) is iteration operation type three, then set the three-head structure of the iteration operation type of the superposition operation unit according to the rules in 5 below.
[0331] If the overlay mode (e.g., overlay_mode) is overlay mode two:
[0332] (6-1) Randomly generate a positive integer that is greater than or equal to a preset minimum value and less than or equal to a preset maximum value. Use the obtained random positive integer that meets the requirements as the length of the overlay offset address list of the basic header in the file header structure (e.g., overlay_offset_len).
[0333] (6-2) Generate a set of random integers equal to the length of the "overlay offset address list" as the overlay offset address list of the basic header in the file header structure (e.g., overlay_offset), and require:
[0334] a) The generated random number must be greater than the preset minimum value (e.g., 0) and less than the "source file size" (in bytes).
[0335] b) The elements in the generated list of offset addresses for the overlay points must be distinct from each other.
[0336] c) Arrange the elements in the generated list of offset addresses of the above overlay points in ascending order.
[0337] (6-3) Set the initial value of the extension length (e.g., extend_len) to 0.
[0338] (6-4) Traverse the list of stacking operation units, starting from the first element of the list (iterate_index = 0) and continuing until the actual stacking count (iteration_number) of the base header in the file header structure. For each stacking operation unit:
[0339] (6-4-1) Set the length of the iteration offset address list of the overlay operation unit (e.g., iteration_offset_len) to the length of the overlay point offset address list of the base header (e.g., overlay_offset_len).
[0340] (6-4-2) Traverse the iterative offset address list of the superposition operation unit, starting from the first element of the iterative offset address list (i=0) at index (e.g., i) and continuing until the length of the iterative offset address list of the superposition operation unit (e.g., iteration_offset_len) elements. For the iterative offset address list:
[0341] The value of the element at the "traversal index (e.g., i)" of the iterative offset address list of the overlay operation unit is set to: the value of the element at the "traversal index (e.g., i)" of the overlay point offset address list of the base header plus an auxiliary increment. The auxiliary increment is: a random ratio multiplied by the extended length and rounded down. The random ratio is an element randomly selected from a set of preset ratio lists, where each element is a number greater than 0 and less than 1.
[0342] (6-4-3) Randomly generate a positive integer, perform a modulo operation on the integer and 3, and use the resulting value as the iteration operation type (such as iteration_op_type) of the superposition operation unit, where 0 represents iteration operation type one, 1 represents iteration operation type two, and 2 represents iteration operation type three.
[0343] If the iteration operation type is iteration operation type two, determine whether the iteration operation type of the previous superposition operation unit is also type two. If it is: randomly generate a positive integer, perform a modulo operation between the integer and 2. If the modulo result is 0, update the iteration operation type to iteration operation type one; otherwise: update the iteration operation type to iteration operation type three.
[0344] (6-4-4) Set the corresponding iteration operation type header structure according to the iteration operation type of the superposition operation unit (such as iteration_op_type). Specifically:
[0345] (a) If the iteration operation type (e.g., iteration_op_type) of the superposition operation unit is iteration operation type one, then the iteration operation type one header structure of the superposition operation unit is set according to the rules in 3 below.
[0346] (b) If the iteration operation type (e.g., iteration_op_type) of the superposition operation unit is iteration operation type two, then the superposition operation unit's iteration operation type two head structure shall be set according to the rules in 4 below.
[0347] (c) If the iteration operation type of the superposition operation unit (e.g., iteration_op_type) is iteration operation type three, then set the three-head structure of the iteration operation type of the superposition operation unit according to the rules in 5 below.
[0348] 3. Set the iterative operation type of the superimposed operation unit to a one-head structure:
[0349] (1) Set the actual number of operation areas (e.g., gap_num) of the iterative operation type of the superposition operation unit to the length of the iterative offset address list of the superposition operation unit.
[0350] (2) Set the list of operation areas for the iterative operation type of the superimposed operation unit with a one-head structure. The specific process is as follows:
[0351] (2-1) Set the temporary append length (e.g., gap_source_addition_len) to the extended length (e.g., extend_len).
[0352] (2-2) Traverse the list of operands, starting from the first element of the list (index = 0) and continuing until the actual number of operands (gap_num) elements are reached. For each operand:
[0353] a) Set the offset address of the operation area to the value of the "traversal index (e.g., index)" element of the iterative offset address list of the superimposed operation unit;
[0354] b) Generate a random integer that is greater than a preset minimum value (e.g., 0) and less than "source file size plus temporary appended length" (in bytes). Use the resulting random integer that meets the requirements as the target offset address of the operation area.
[0355] c) Generate a random integer that is greater than a preset minimum value (e.g., 0) and less than "(source file size plus temporary append length) multiplied by a preset ratio", where the preset ratio is greater than 0 and less than 1.
[0356] The obtained random integer that meets the requirements is used as the operation length of the operation area.
[0357] d) Determine whether the "target offset address + operation length" of the operation area exceeds the "source file size + temporary append length". If it does, subtract the size of the target offset address of the operation area from the "source file size + temporary append length" to get the operation length of the operation area.
[0358] e) Update the extension length (e.g., extend_len) to: the original extension length plus the operation length of the operation area.
[0359] 4. Set the iterative operation type of the superposition operation unit to a two-headed structure:
[0360] (1) Perform a modulo operation on the length of the iterative offset address list of the superposition operation unit and 2. The resulting value is used as the swap type (such as swap_type) of the iterative operation type binary structure of the superposition operation unit. 0 indicates that the swap type is even and 1 indicates that the swap type is odd.
[0361] (2) Randomly generate a positive integer, perform a modulo operation on the integer and 2, and use the resulting value as the swap operation mode (such as swap_op_mode) of the iterative operation type of the superposition operation unit, where 0 represents swap operation mode one and 1 represents swap operation mode two.
[0362] (3) Randomly generate a positive integer, perform a modulo operation between the integer and 3, and use the resulting value as the pairing mode of the iterative operation type of the superposition operation unit (such as swap_match_mode), where 0 represents pairing mode one, 1 represents pairing mode two, and 2 represents pairing mode three.
[0363] (4) If the swap type (e.g., swap_type) is odd, then the iterative offset address list of the superposition operation unit is used as the odd swap offset address list of the two-head structure of the iterative operation type of the superposition operation unit. Otherwise, if the swap type is even, then the iterative offset address list of the superposition operation unit is used as the even swap offset address list of the two-head structure of the iterative operation type of the superposition operation unit.
[0364] (5) Settings for swap length (e.g., swap_len), actual number of pairs (e.g., match_number), odd-numbered pairing list, and even-numbered pairing list. Specifically:
[0365] (5-1) If the swap type (e.g., swap_type) is odd:
[0366] a) Construct a temporary swap offset address list:
[0367] a-1) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode one:
[0368] The temporary swap offset address list consists of an odd-numbered swap offset address list.
[0369] a-2) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode two: the temporary swap offset address list is constructed by adding one element to the beginning and one to the end of the odd swap offset address list. Therefore, the length of the temporary swap offset address list is: odd swap offset address list + 2. And: the first element (i.e., the first element) of the temporary swap offset address list is: 0.
[0370] The last element (i.e., the last element) of the temporary swap offset address list is: source file size + extension length.
[0371] b) Subtract the directly adjacent swap offset addresses in the temporary swap offset address list in order to obtain a set of adjacent differences.
[0372] The length of the resulting adjacent difference is: the length of the temporary swap offset address list - 1.
[0373] c) The minimum value of the obtained adjacent differences is used as the swap region length (e.g., swap_len) of the two-head structure of the iterative operation type of the superposition operation unit.
[0374] d) Divide the length of the resulting set of adjacent differences by 2 and round down to get the actual pairing number (e.g., match_number) of the binomial structure of the superposition operation unit.
[0375] e) The odd-numbered pairing list is set according to the following rules:
[0376] e-1) If the pairing mode (e.g., swap_match_mode) is pairing mode one:
[0377] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0378] Set the swap address of the paired area element to the value of the "traversal index (e.g., index)" element in the temporary swap offset address list.
[0379] Set the swap address of the paired area element to the value of the element in the temporary swap offset address list that is "(index of the last element in the temporary swap offset address list)-1-traversal index".
[0380] e-2) If the pairing mode (e.g., swap_match_mode) is pairing mode two:
[0381] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0382] Set the swap address of the paired area element to the value of the element at the second traversal index (e.g., index) in the temporary swap offset address list.
[0383] Set the swap address of the paired area element to the value of the "2nd traversal index (e.g., index) + 1" element in the temporary swap offset address list.
[0384] e-3) If the pairing mode (e.g., swap_match_mode) is pairing mode three:
[0385] The initial value of the random selection list is set to: a temporary swap offset address list after removing the last element. Therefore, the initial length of this random selection list is: the length of the temporary swap offset address list - 1.
[0386] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0387] Set the swap address of the paired elements to the value of the first element in the list randomly selected.
[0388] Generate a random positive integer. Take the modulo operation between this integer and the length of the random selection list, and use the result as the random selection index. If the random selection index is 0 (i.e., the first element), increment the random selection index by 1.
[0389] The second swap address for the paired elements is set to a value at a randomly selected index position from the list.
[0390] Update the random selection list and its length: Take all elements from the current random selection list except the first element and the element at the random selection index, and construct a new random selection list in order. Use this new random selection list as the new value of the random selection list. Simultaneously, set the length of the new random selection list to "the length of the random selection list - 2".
[0391] (5-2) If the swap type (e.g., swap_type) is even:
[0392] a) Construct a temporary swap offset address list:
[0393] a-1) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode one:
[0394] The temporary swap offset address list is formed by adding one element to the beginning of the even-numbered swap offset address list. Therefore, the length of the temporary swap offset address list is: even-numbered swap offset address list + 1. And the first element (i.e., the first element) of the temporary swap offset address list is 0.
[0395] a-2) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode two:
[0396] The temporary swap offset list is formed by adding an element to the end of the even-numbered swap offset list. Therefore, the length of the temporary swap offset list is: even-numbered swap offset list + 1. And the last element of the temporary swap offset list is: source file size + extended length.
[0397] b) Subtract the directly adjacent swap offset addresses in the temporary swap offset address list in order to obtain a set of adjacent differences.
[0398] The length of the resulting adjacent difference is: the length of the temporary swap offset address list - 1.
[0399] c) The minimum value of the obtained adjacent differences is used as the swap region length (e.g., swap_len) of the two-head structure of the iterative operation type of the superposition operation unit.
[0400] d) Divide the length of the resulting set of adjacent differences by 2 and round down to get the actual pairing number (e.g., match_number) of the binomial structure of the superposition operation unit.
[0401] e) The even-numbered pairing list is set according to the following rules:
[0402] e-1) If the pairing mode (e.g., swap_match_mode) is pairing mode one:
[0403] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0404] Set the swap address of the paired area element to the value of the "traversal index (e.g., index)" element in the temporary swap offset address list.
[0405] Set the swap address of the paired area element to the value of the element in the temporary swap offset address list that is "(index of the last element in the temporary swap offset address list)-1-traversal index".
[0406] e-2) If the pairing mode (e.g., swap_match_mode) is pairing mode two:
[0407] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0408] Set the swap address of the paired area element to the value of the element at the second traversal index (e.g., index) in the temporary swap offset address list.
[0409] Set the swap address of the paired area element to the value of the "2nd traversal index (e.g., index) + 1" element in the temporary swap offset address list.
[0410] e-3) If the pairing mode (e.g., swap_match_mode) is pairing mode three:
[0411] The initial value of the random selection list is set to: a temporary swap offset address list after removing the last element. Therefore, the initial length of this random selection list is: the length of the temporary swap offset address list - 1.
[0412] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0413] Set the swap address of the paired elements to the value of the first element in the list randomly selected.
[0414] Generate a random positive integer. Take the modulo operation between this integer and the length of the random selection list, and use the result as the random selection index. If the random selection index is 0 (i.e., the first element), increment the random selection index by 1.
[0415] The second swap address for the paired elements is set to a value at a randomly selected index position from the list.
[0416] Update the random selection list and its length: Take all elements from the current random selection list except the first element and the element at the random selection index, and construct a new random selection list in order. Use this new random selection list as the new value of the random selection list. Simultaneously, set the length of the new random selection list to "the length of the random selection list - 2".
[0417] 5. Set the iterative operation type of the superposition operation unit to a three-head structure:
[0418] (1) Set the temporary append length (e.g., gap_source_addition_len) to the extended length (e.g., extend_len).
[0419] (2) Randomly generate a positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the grouping mode of the three-head structure of the superposition operation unit (such as group_divide_mode), where 0 represents grouping mode one and 1 represents grouping mode two.
[0420] (3) If the grouping mode (e.g., group_divide_mode) is mode one:
[0421] (3-1) Set the actual number of groups (e.g., group_number) of the three-head structure of the iterative operation type of the superposition operation unit to "the length of the iterative offset address list of the superposition operation unit + 1".
[0422] (3-2) The iterative offset address list of the superposition operation unit is used as the operation point offset address list of the three-head structure of the iterative operation type of the superposition operation unit (such as op_offset). That is, the length of the operation point offset address list is "the actual number of groups - 1" (i.e. the length of the iterative offset address list of the superposition operation unit).
[0423] (3-3) Traverse the list of operation groups for the iterative operation type of the superimposed operation unit, starting from the first element of the operation group list (index = 0) and continuing until the actual number of groups (e.g., group_number) elements. For each operation group:
[0424] (3-3-1) Set the "group head node offset address (e.g., group_head_offset)" and "group tail node offset address (e.g., group_tail_offset)" of the operation group.
[0425] a) If it is the first operation group:
[0426] Set the head node offset address of the group (e.g., group_head_offset) to 0;
[0427] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the "traversal index (e.g., index)" element of the list of operation point offset addresses.
[0428] b) If it is the last operation group:
[0429] Set the offset address of the group's head node (e.g., group_head_offset) to the value of the element at the "traversal index (e.g., index) - 1"th element in the list of operation point offset addresses;
[0430] Set the tail node offset address of the group (e.g., group_tail_offset) to: source file size + temporary append length (in bytes);
[0431] c) For other operation groups:
[0432] Set the offset address of the group's head node (e.g., group_head_offset) to the value of the element at the "traversal index (e.g., index) - 1"th element in the list of operation point offset addresses;
[0433] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the element at the "traversal index (e.g., index)" of the list of operation point offset addresses;
[0434] (3-3-2) Set the group length of the operation group (e.g., group_len):
[0435] Generate a random integer that is not less than the preset minimum group length (e.g., 3) and not greater than the preset maximum group length. Use the resulting random integer that meets these requirements as the group length (e.g., group_len) for the operation group.
[0436] (3-3-3) Set the list of group offset addresses for the operation group (e.g., group_offset):
[0437] Generate a set of random integers equal to the "group length of the operation group" as a list of group offset addresses for the operation group (e.g., group_offset). The length of the list of group offset addresses is equal to the current group length. The requirements are:
[0438] a) The generated random number must be greater than the "head node offset address of the group" and less than the "tail node offset address of the group".
[0439] b) The elements in the generated list of group offset addresses must be distinct from each other.
[0440] c) Arrange the elements in the generated list of group offset addresses in ascending order.
[0441] (3-3-4) Set the group type of the operation group (e.g., group_type):
[0442] Generate a random positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the group type of the operation group, where 0 represents group type one and 1 represents group type two.
[0443] (3-3-5) If the group type of the operation group is group type one, then set the group type one header structure of the operation group according to the following rule (4):
[0444] (3-3-6) If the group type of the operation group is group type two, then set the group type two header structure of the operation group according to the following rule (5):
[0445] If the grouping mode (such as group_divide_mode) is mode two:
[0446] (3-1) Use the list of iterative offset addresses of the superposition operation unit as the list of operation point offset addresses of the three-head structure of the iterative operation type of the superposition operation unit (such as op_offset).
[0447] (3-2) Set the group length type (e.g., group_len_type) of the iteration operation type of the superposition operation unit:
[0448] A positive integer is randomly generated. The integer is modulo 4. The resulting value is used as the group length type of the three-head structure of the superposition operation unit. 0 represents group length type one, 1 represents group length type two, 2 represents group length type three, and 3 represents group length type four.
[0449] (3-3) Set the actual number of groups (e.g., group_number) of the iterative operation type of the superposition operation unit:
[0450] If the group length type is group length type one, the actual number of groups in the file header structure is set to: the length of the operation point offset address list divided by the preset maximum group length, and rounded up.
[0451] If the group length type is group length type two, the actual number of groups in the file header structure is set to: the length of the operation point offset address list divided by the preset minimum group length, and then rounded down.
[0452] If the group length type is group length type three, set the actual number of groups in the file header structure to the preset number of groups.
[0453] If the group length type is group length type four, a random integer is generated, requiring that the generated random number is not less than the minimum group size and not greater than the maximum group size. The minimum group size is calculated by dividing the length of the operation point offset address list by the preset maximum group length and rounding up, while the maximum group size is calculated by dividing the length of the operation point offset address list by the preset minimum group length and rounding down. The resulting random integer that meets the requirements is used as the actual group size of the iterative operation type three-head structure of the superimposed operation unit.
[0454] (3-4) Traverse the list of operation groups for the iterative operation type of the superimposed operation unit, starting from the first element of the operation group list (index = 0) and continuing until the actual number of groups (e.g., group_number) elements. For each operation group:
[0455] (3-4-1) Set the group length of the operation group (e.g., group_len):
[0456] a) If it is the last operation group:
[0457] The group length of the operation group is set to: "length of the operation point offset address list" minus "traversal index" multiplied by the step size. The step size is calculated as: "length of the operation point offset address list divided by the actual number of groups in the three-headed structure of the iterative operation type of the superimposed operation unit, rounded down".
[0458] b) For other operation groups:
[0459] The group length of the operation group is set as follows: the length of the operation point offset address list divided by the actual number of groups in the three-head structure of the iterative operation type of the superimposed operation unit, and then rounded down.
[0460] (3-4-2) Set the list of group offset addresses for the operation group (e.g., group_offset):
[0461] Iterate through the list of group offset addresses for the operation group, starting from the first element (i=0) of the list and continuing until the group length (e.g., group_len) elements are reached. For each offset address in the list:
[0462] The value at the "offset address index" position of the group offset address list is set to the value of the "operation group traversal index multiplied by the step size plus the offset address index" element of the operation point offset address list of the three-head structure of the iterative operation type of the superimposed operation unit (i.e., operation group traversal index x step size + offset address index). The step size is "the length of the operation point offset address list divided by the actual number of groups in the three-head structure of the iterative operation type of the superimposed operation unit, rounded down".
[0463] (3-4-3) Set the head and tail node mode of the operation group (e.g., group_head_tail_mode):
[0464] A positive integer is randomly generated. The integer is modulo 3. The resulting value is used as the head and tail node pattern of the operation group. 0 represents head and tail node pattern one, 1 represents head and tail node pattern two, and 2 represents head and tail node pattern three.
[0465] (3-4-4) Set the group type of the operation group (e.g., group_type):
[0466] Generate a random positive integer, perform a modulo operation between the integer and 2, and use the resulting value as the group type of the operation group, where 0 represents group type one and 1 represents group type two.
[0467] (3-5) Iterate through the operation group list in the file header structure again, starting from the first element of the operation group list (index = 0) and continuing until the actual number of groups (group_number) elements are reached. For each operation group:
[0468] (3-5-1) Set the "group head node offset address (e.g., group_head_offset)" and "group tail node offset address (e.g., group_tail_offset)" of the operation group.
[0469] If the head and tail node patterns of the operation group are head and tail node pattern one:
[0470] a) If it is the first operation group:
[0471] Set the head node offset address of the group (e.g., group_head_offset) to 0.
[0472] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the last element in the list of group offset addresses for the current operation group.
[0473] Update the group offset address list (e.g., group_offset) of the operation group to: remove the last element from the original group offset address list of the operation group.
[0474] The update operation group's group length (e.g., group_len) is: the original operation group's group length (e.g., group_len) minus 1.
[0475] b) If it is the last operation group:
[0476] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0477] Set the tail node offset address of the group (e.g., group_tail_offset) to: source file size + temporary append length (in bytes);
[0478] c) For other operation groups:
[0479] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0480] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the last element in the list of group offset addresses for the current operation group.
[0481] Update the group offset address list (e.g., group_offset) of the operation group to: remove the last element from the original group offset address list of the operation group.
[0482] The update operation group's group length (e.g., group_len) is: the original operation group's group length (e.g., group_len) minus 1.
[0483] If the head and tail node pattern of the operation group is head and tail node pattern two:
[0484] a) If it is the first operation group:
[0485] Set the head node offset address of the group (e.g., group_head_offset) to 0.
[0486] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the first element of the group offset address list for the next operation group.
[0487] b) If it is the last operation group:
[0488] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0489] Set the tail node offset address of the group (e.g., group_tail_offset) to: source file size + temporary append length (in bytes);
[0490] The update operation group's group length (e.g., group_len) is: the original operation group's group length (e.g., group_len) minus 1.
[0491] Update the group offset address list (e.g., group_offset) of the operation group to: remove the first element from the original group offset address list of the operation group.
[0492] c) For other operation groups:
[0493] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0494] Set the tail node offset address of the group (e.g., group_tail_offset) to the value of the first element of the group offset address list for the next operation group.
[0495] The update operation group's group length (e.g., group_len) is: the original operation group's group length (e.g., group_len) minus 1.
[0496] Update the group offset address list (e.g., group_offset) of the operation group to: remove the first element from the original group offset address list of the operation group.
[0497] If the head and tail node pattern of the operation group is head and tail node pattern three:
[0498] a) If it is the first operation group:
[0499] Set the head node offset address of the group (e.g., group_head_offset) to 0.
[0500] Set the tail node offset address of the group (e.g., `group_tail_offset`) to: "the value of the last element in the group offset address list of the current operation group" plus "the inter-group difference multiplied by a preset ratio". The inter-group difference is the value of the first element in the group offset address list of the next operation group minus the value of the last element in the group offset address list of the current operation group. The preset ratio must be greater than 0 and less than 1.
[0501] b) If it is the last operation group:
[0502] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0503] Set the tail node offset address of the group (e.g., group_tail_offset) to: source file size + temporary append length (in bytes);
[0504] c) For other operation groups:
[0505] Set the head node offset address of the group (e.g., group_head_offset) to the tail node offset address of the previous operation group.
[0506] Set the tail node offset address of the group (e.g., `group_tail_offset`) to: "the value of the last element in the group offset address list of the current operation group" plus "the inter-group difference multiplied by a preset ratio". The inter-group difference is the value of the first element in the group offset address list of the next operation group minus the value of the last element in the group offset address list of the current operation group. The preset ratio must be greater than 0 and less than 1.
[0507] (3-5-2) If the group type of the operation group is group type one, then set the group type one header structure of the operation group according to the following rule (4):
[0508] (3-5-3) If the group type of the operation group is group type two, then set the group type two header structure of the operation group according to the following rule (5):
[0509] (4) Set the group type of the operation group to a head structure:
[0510] (4-1) Set the actual number of operation areas (e.g., gap_num) of the group type head structure to the group length of the operation group.
[0511] (4-2) Set up the operation area list of the group type with a head structure. The specific process is as follows:
[0512] (4-2-1) Set the temporary append length (e.g., gap_source_addition_len) to the extended length (e.g., extend_len).
[0513] (4-2-2) Traverse the list of operands, starting from the first element of the list (index = 0) and continuing until the actual number of operands (gap_num) elements are reached. For each operand:
[0514] a) Set the offset address of the operation area to the value of the "traversal index (e.g., index)" element of the group offset address list of the operation group;
[0515] b) Generate a random integer that is greater than a preset minimum value (e.g., 0) and less than "source file size + temporary append length" (in bytes). Use the resulting random integer that meets the requirements as the target offset address of the operation area.
[0516] c) Generate a random integer that is greater than a preset minimum value (e.g., 0) and less than "(source file size + temporary append length) multiplied by a preset ratio", where the preset ratio is greater than 0 and less than 1.
[0517] The obtained random integer that meets the requirements is used as the operation length of the operation area.
[0518] d) Determine whether the "target offset address + operation length" of the operation area exceeds the "source file size + temporary append length". If it does, subtract the size of the target offset address of the operation area from the "source file size + temporary append length" to get the operation length of the operation area.
[0519] e) Update the extension length (e.g., extend_len) to: original extension length + operation length of the operation area.
[0520] (5) Set the group type of the operation group to a two-headed structure:
[0521] (5-1) Perform a modulo operation between the group length of the operation group and 2, and use the resulting value as the swap type (such as swap_type) of the group type binary structure of the operation group, where 0 indicates that the swap type is even and 1 indicates that the swap type is odd.
[0522] (5-2) Randomly generate a positive integer, perform a modulo operation on the integer and 2, and use the resulting value as the swap operation mode (such as swap_op_mode) of the group type two-head structure of the operation group, where 0 represents swap operation mode one and 1 represents swap operation mode two.
[0523] (5-3) Randomly generate a positive integer, perform a modulo operation between the integer and 3, and use the resulting value as the pairing mode of the group type two-head structure of the operation group (such as swap_match_mode), where 0 represents pairing mode one, 1 represents pairing mode two, and 2 represents pairing mode three.
[0524] (5-4) If the swap type (e.g., swap_type) is odd, then the group offset address list of the operation group is used as the odd swap offset address list of the group type two-head structure of the operation group. Otherwise, if the swap type is even, then the group offset address list of the operation group is used as the even swap offset address list of the group type two-head structure of the operation group.
[0525] (5-5) Settings for swap length (e.g., swap_len), actual number of pairs (e.g., match_number), odd-numbered pairing list, and even-numbered pairing list. Specifically:
[0526] If the swap type (such as swap_type) is odd:
[0527] a) Construct a temporary swap offset address list:
[0528] a-1) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode one:
[0529] The temporary swap offset address list consists of an odd-numbered swap offset address list.
[0530] a-2) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode two:
[0531] The temporary swap offset address list is constructed by adding one element to the beginning and one to the end of the odd swap offset address list. Therefore, the length of the temporary swap offset address list is: the odd swap offset address list + 2. Furthermore, the first element (the first element) of the temporary swap offset address list is the "head node offset address" of the operation group. The last element (the last element) of the temporary swap offset address list is the "tail node offset address" of the operation group.
[0532] b) Subtract each pair of directly adjacent swap offset addresses in the temporary swap offset address list in sequence to obtain a set of adjacent differences. The length of this set of adjacent differences is: the length of the temporary swap offset address list - 1.
[0533] c) The minimum value of the adjacent differences obtained in this group is taken as the swap length of the group type two-head structure of the operation group (e.g., swap_len).
[0534] d) Divide the length of the adjacent difference obtained in this group by 2 and round down to get the actual number of pairs (e.g., match_number) of the two-headed structure of the group type of the operation group.
[0535] e) The odd-numbered pairing list is set according to the following rules:
[0536] e-1) If the pairing mode (e.g., swap_match_mode) is pairing mode one:
[0537] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0538] Set the swap address of the paired area element to the value of the "traversal index (e.g., index)" element in the temporary swap offset address list.
[0539] Set the swap address of the paired area element to the value of the element in the temporary swap offset address list that is "(index of the last element in the temporary swap offset address list)-1-traversal index".
[0540] e-2) If the pairing mode (e.g., swap_match_mode) is pairing mode two:
[0541] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0542] Set the first swap address of the paired area element to the value of the element at the second traversal index (e.g., index) in the temporary swap offset address list. Set the second swap address of the paired area element to the value of the element at the second traversal index (e.g., index + 1) in the temporary swap offset address list.
[0543] e-3) If the pairing mode (e.g., swap_match_mode) is pairing mode three:
[0544] The initial value of the random selection list is set to: a temporary swap offset address list after removing the last element. Therefore, the initial length of this random selection list is: the length of the temporary swap offset address list - 1.
[0545] Iterate through the list of odd-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0546] Set the swap address of the paired elements to the value of the first element in the list randomly selected.
[0547] Generate a random positive integer. Take the modulo operation between this integer and the length of the random selection list, and use the result as the random selection index. If the random selection index is 0 (i.e., the first element), increment the random selection index by 1.
[0548] The second swap address for the paired elements is set to a value at a randomly selected index position from the list.
[0549] Update the random selection list and its length: Take all elements from the current random selection list except the first element and the element at the random selection index, and construct a new random selection list in order. Use this new random selection list as the new value of the random selection list. Simultaneously, set the length of the new random selection list to "the length of the random selection list - 2".
[0550] If the swap type (such as swap_type) is even:
[0551] a) Construct a temporary swap offset address list:
[0552] a-1) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode one:
[0553] The temporary swap offset address list is formed by adding one element to the beginning of the even-numbered swap offset address list. Therefore, the length of the temporary swap offset address list is: even-numbered swap offset address list + 1. Furthermore, the first element (the first element) of the temporary swap offset address list is: the "head node offset address" of the operation group.
[0554] a-2) If the swap operation mode (e.g., swap_op_mode) is of type swap operation mode two:
[0555] The temporary swap offset address list is formed by adding an element to the end of the even-numbered swap offset address list. Therefore, the length of the temporary swap offset address list is: even-numbered swap offset address list + 1. And the last element of the temporary swap offset address list is: the "tail node offset address of the operation group".
[0556] b) Subtract each pair of directly adjacent swap offset addresses in the temporary swap offset address list in sequence to obtain a set of adjacent differences. The length of this set of adjacent differences is: the length of the temporary swap offset address list - 1.
[0557] c) The minimum value of the adjacent differences obtained in this group is taken as the swap length of the group type two-head structure of the operation group (e.g., swap_len).
[0558] d) Divide the length of the adjacent difference obtained in this group by 2 and round down to get the actual number of pairs (e.g., match_number) of the two-headed structure of the group type of the operation group.
[0559] e) The even-numbered pairing list is set according to the following rules:
[0560] e-1) If the pairing mode (e.g., swap_match_mode) is pairing mode one:
[0561] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0562] Set the swap address of the paired area element to the value of the "traversal index (e.g., index)" element in the temporary swap offset address list.
[0563] Set the swap address of the paired area element to the value of the element in the temporary swap offset address list that is "(index of the last element in the temporary swap offset address list)-1-traversal index".
[0564] e-2) If the pairing mode (e.g., swap_match_mode) is pairing mode two:
[0565] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0566] Set the swap address of the paired area element to the value of the element at the second traversal index (e.g., index) in the temporary swap offset address list.
[0567] Set the swap address of the paired area element to the value of the "2nd traversal index (e.g., index) + 1" element in the temporary swap offset address list.
[0568] e-3) If the pairing mode (e.g., swap_match_mode) is pairing mode three:
[0569] The initial value of the random selection list is set to: a temporary swap offset address list after removing the last element. Therefore, the initial length of this random selection list is: the length of the temporary swap offset address list - 1.
[0570] Iterate through the list of even-numbered pairs, starting from the first element of the list (index = 0) and continuing until the actual number of pairs (match_number - 1). For each pair:
[0571] Set the swap address of the paired elements to the value of the first element in the list randomly selected.
[0572] Generate a random positive integer. Take the modulo operation between this integer and the length of the random selection list, and use the result as the random selection index. If the random selection index is 0 (i.e., the first element), increment the random selection index by 1.
[0573] The second swap address for the paired elements is set to a value at a randomly selected index position from the list.
[0574] Update the random selection list and its length: Take all elements from the current random selection list except the first element and the element at the random selection index, and construct a new random selection list in order. Use this new random selection list as the new value of the random selection list. Simultaneously, set the length of the new random selection list to "the length of the random selection list - 2".
[0575] In some embodiments, the empty protected file is processed according to the four specific file header structures constructed above.
[0576] For example, a protected file can be constructed based on the operation area information of the file header structure, a protected file can be constructed based on the pairing area information of the file header structure, a protected template file can be constructed based on the operation group list of the file header structure, or a protected file can be constructed based on the superimposed operation unit list of the file header structure.
[0577] According to embodiments of this disclosure, the source file is randomly corrupted by constructing a file header structure, and the random corruption rules are encrypted and written into the source file header. Because the source file is randomly corrupted, the corrupted content is different each time for the same source file, resulting in different protected files, thus maximizing the confidentiality and security of the source file protection. Simultaneously, since the entire source file is not encrypted, the demand for computing resources is reduced while protecting the source file.
[0578] Figure 2 This is a flowchart illustrating a file processing method according to an embodiment of the present disclosure. Figure 2 As shown, the file processing method includes the following steps S210 to S230.
[0579] In step S210, a protected file is received, the protected file including first information associated with an encrypted file header structure and second information associated with a processed source file obtained by processing the source file according to the file header structure, the file header structure including processing rules to be performed on the source file.
[0580] In some embodiments, the processing rules include random destruction rules, and the processed source file includes the source file after being randomly destroyed according to the random destruction rules.
[0581] In step S220, the first information of the protected file is verified based on a preset file header structure.
[0582] In some embodiments of this invention, such as Figure 3 As shown, verifying the first information of the protected file based on the preset file header structure includes the following steps S221 to S223.
[0583] In step S221, the encrypted file header structure is derived from the header of the protected file.
[0584] In step S222, the encrypted file header structure is decrypted using a preset symmetric encryption algorithm and key.
[0585] In step S223, the decrypted file header structure is verified based on the preset file header structure.
[0586] Specifically, in this embodiment, the verification is performed according to the method of encrypting the file header structure. As mentioned above, this embodiment uses the first and second verification methods to verify the protected file header.
[0587] 1) First verification method
[0588] Read the auxiliary header of a preset size from the header of the protected file, and determine whether the magic number of the auxiliary header is the same as the preset magic number:
[0589] If they are the same, after locating the protected file to the auxiliary header, data of a specified size is read into a temporary buffer according to the "size of the encrypted file header structure" in the auxiliary header, which serves as the encrypted file header structure. The "preset size of the auxiliary header" plus the "size of the encrypted file header structure" is used as the length of the temporary file header (e.g., protected_model_header_len).
[0590] If they are different, locate the header of the protected file, read the file header structure of the preset size into a temporary buffer, and use it as the encrypted file header structure. Use the preset size of the file header structure as the length of the temporary file header (e.g., protected_model_header_len).
[0591] 2) Second verification method
[0592] Read the auxiliary header of a preset size from the header of the protected file, and determine whether the magic number of the auxiliary header is the same as the preset magic number:
[0593] 2-1) If they are the same:
[0594] a) After locating the protected file to the auxiliary header, read data of a specified size into a temporary buffer based on the "size of the encrypted base header" in the auxiliary header, and use it as the encrypted base header. Then, locate the protected file to the "preset size of the auxiliary header + size of the encrypted base header," and simultaneously read data of a specified size into a temporary buffer based on the "size of the encrypted overlay operation unit list" in the auxiliary header, and use it as the encrypted overlay operation unit list.
[0595] b) Use "the preset size of the auxiliary header + the size of the encrypted base header + the size of the encrypted overlay operation unit list" as the temporary header length of the file (e.g., protected_model_header_len).
[0596] c) Use a preset symmetric encryption algorithm and key to decrypt the encrypted base header in the temporary buffer to obtain the decrypted base header.
[0597] Determine if the protected magic number in the decrypted base header is the same as the preset protected magic number: if they are the same, use the preset symmetric encryption algorithm and key to decrypt the list of superposition operation units in the temporary buffer to obtain the decrypted list of superposition operation units. Otherwise, indicate an invalid file and exit.
[0598] (2-2) Otherwise, it means that the magic number of the auxiliary head is different from the preset magic number, then:
[0599] a) Locate the header of the protected file, read the base header of the preset size into a temporary buffer, and use it as the base header for encryption.
[0600] b) Use a preset symmetric encryption algorithm and key to decrypt the encrypted base header in the temporary buffer to obtain the decrypted base header.
[0601] Check if the protection magic number in the decrypted base header is the same as the preset protection magic number: if they are different, indicate an invalid file and exit; otherwise (meaning they are the same):
[0602] b-1) After locating the protected file to the base header, read the data of "the actual number of overlays in the base header multiplied by the length of the overlay operation unit in the base header" into a temporary buffer as the encrypted overlay operation unit list.
[0603] b-2) The default size of the base header plus "the actual number of stacking operations in the base header multiplied by the length of the stacking operation unit in the base header" is used as the temporary header length of the file (e.g., protected_model_header_len).
[0604] b-3) Use a preset symmetric encryption algorithm and key to decrypt the list of superposition operation units in the temporary buffer to obtain the decrypted list of superposition operation units.
[0605] Subsequently, in step S230, in response to the first information of the protected file being verified, the source file is derived based on the second information of the protected file.
[0606] In some embodiments, such as Figure 4 As shown, deriving the source file based on the second information of the protected file includes the following steps S231 and S232.
[0607] In step S231, the processed source file is derived from the end of the protected file.
[0608] In step S232, the source file is decoded from the processed source file according to the file header structure, and the source file is stored in the target buffer.
[0609] Furthermore, in some embodiments, deriving the source file based on the second information of the protected file includes: decrypting the encrypted file header structure in the temporary buffer using a preset symmetric encryption algorithm and key to obtain the decrypted file header structure. It is then determined whether the protection magic number in the decrypted file header structure is the same as the preset protection magic number: if they are the same, a target file buffer is pre-allocated; otherwise, an invalid file is indicated, and the process exits.
[0610] Figure 5 The following example illustrates the implementation process of the file processing method described in this embodiment, using AI source files as an example.
[0611] like Figure 5As shown, when protecting the AI source model file, the process involves obtaining the AI source model file, creating an empty AI protection model file, constructing a model header structure, encrypting the constructed model header structure, writing it into the header of the AI protection model file, reading the source model, constructing the AI protection model file based on the information in the model header structure, and publishing the processed AI protection model file for actual deployment. When the AI source model file is to be used, the protection model header is verified, the original model is decoded from the protection model file, and stored in the target model buffer. In this embodiment, the entire AI model is not encrypted during the AI model protection process. Instead, the AI model is randomly corrupted, and the random corruption rules are encrypted and written into the AI model header. Because the AI model is randomly corrupted, the corrupted content is different each time for the same AI model, resulting in a different AI protection model after corruption, thereby maximizing the confidentiality and security of AI model protection. Simultaneously, since the entire AI model is not encrypted, the demand for computing resources is reduced while protecting the AI model, especially for end devices with limited computing resources, improving the speed of AI model deprotection before inference. The method in this embodiment is applicable to protecting any AI model, without restrictions on software and hardware environments and scenarios, and has strong versatility.
[0612] like Figure 6 As shown, this embodiment provides an electronic device 101, which includes a processor 1001 and a memory 1002. The memory 1002 is configured to store program instructions. The processor 1001 is configured to execute the program instructions stored in the memory 1002, so that the electronic device 101 performs each step of the above-described file processing method. Since the specific implementation process of each step of the file processing method has been described in detail in Embodiment 1, it will not be repeated here.
[0613] Processor 1001 is a CPU (Central Processing Unit). Memory 1002 is connected to processor 1001 via a system bus and communicates with it. Memory 1002 stores computer programs, and processor 1001 runs the computer programs to execute the file processing method described above. Memory 1002 may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0614] Furthermore, this embodiment also provides a computer-readable storage medium storing computer-readable program instructions thereon, which, when executed by the processor 1001, implements the aforementioned file processing method. The file processing method has already been described in detail above and will not be repeated here.
[0615] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented using computer program-related hardware. The aforementioned computer program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0616] In summary, this application does not encrypt the entire source file (e.g., AI model file). Instead, it randomly corrupts the source file by constructing a file header structure, and then encrypts the random corruption rules and writes them into the source file header. Because the source file is randomly corrupted, the corrupted content is different each time, resulting in different protected files. This maximizes the confidentiality and security of the source file protection. Furthermore, since the entire source file is not encrypted, the demand for computing resources is reduced while protecting the source file, especially for devices with limited computing resources, thus improving the speed of deprotection before inference. The method of this application is applicable to protecting AI model files and various application documents, without limitations on software and hardware environments or scenarios, and has strong versatility. Therefore, this invention effectively overcomes the various shortcomings of existing technologies and has high industrial applicability.
[0617] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A file processing method, characterized in that, include: Create an empty first protected file for the source file; Construct a file header structure, the file header structure including the processing rules to be performed on the source file, the processing rules including random destruction rules; The file header structure is encrypted, and a second protected file is formed based on the encrypted file header structure and the first protected file; as well as The source file is processed according to the file header structure, and a third protected file is formed based on the processed source file and the second protected file. The processing of the source file according to the file header structure includes: randomly destroying the source file according to the random destruction rules.
2. The file processing method according to claim 1, characterized in that, Forming a second protected file based on the encrypted file header structure and the first protected file includes: writing the encrypted file header structure into the header of the first protected file to form the second protected file.
3. The file processing method according to claim 1, characterized in that, Forming a third protected file based on the processed source file and the second protected file includes: writing the processed source file to the end of the second protected file to form the third protected file.
4. The file processing method according to claim 1, characterized in that, Also includes: Obtain the source file, which includes an artificial intelligence source model file.
5. The file processing method according to claim 1, characterized in that, Also includes: Release and deployment are performed based on the aforementioned third-party protected file.
6. A file processing method, characterized in that, include: Receive a protected file, the protected file including first information associated with an encrypted file header structure and second information associated with a processed source file obtained by processing the source file according to the file header structure, the file header structure including processing rules to be performed on the source file, the processing rules including random destruction rules, and randomly destroying the source file according to the random destruction rules; The first information of the protected file is verified based on the preset file header structure; as well as In response to the first information of the protected file being verified, the source file is derived based on the second information of the protected file.
7. The document processing method according to claim 6, characterized in that, The processing rules include random destruction rules, and the processed source file includes the source file after being randomly destroyed according to the random destruction rules.
8. The document processing method according to claim 6, characterized in that, Verification of the first information of the protected file based on a preset file header structure includes: The encrypted file header structure is derived from the header of the protected file; The encrypted file header structure is decrypted using a preset symmetric encryption algorithm and key; and The decrypted file header structure is verified based on the preset file header structure.
9. The document processing method according to claim 6, characterized in that, Based on the second information of the protected file, the source file is determined to include: The processed source file is derived from the end of the protected file; and The source file is decoded from the processed source file according to the file header structure, and the source file is stored in the target buffer.
10. A computer-readable storage medium storing computer-readable program instructions thereon, characterized in that, When the program instructions are executed, they are the file processing method according to any one of claims 1 to 5 or the file processing method according to any one of claims 6 to 9.
11. An electronic device, characterized in that, include: The memory is configured to store program instructions; as well as The processor is configured to execute the program instructions to implement the file processing method according to any one of claims 1 to 5 or the file processing method according to any one of claims 6 to 9.