Differential package generation method and device, electronic equipment and storage medium

By dividing the original package into data blocks and matching the target packages one by one, differential packages are generated, the problem of low upgrade success rate in vehicle software OTA upgrades is solved, efficiency and accuracy are improved, and memory usage is reduced.

CN120540684APending Publication Date: 2025-08-26Z-ONE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510615066.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-08-26

AI Technical Summary

Technical Problem

The existing differential package generation solution has problems such as low upgrade success rate, long transmission time and high memory usage in vehicle software OTA upgrades.

Method used

By dividing the original packet into multiple data blocks, determining the starting point and matching the target packet block by block, identifying the difference block, and generating the difference packet.

Benefits of technology

It improves the accuracy and efficiency of differential package generation, shortens production time, reduces memory usage, reduces the risk of failure, and improves the upgrade success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120540684A_ABST
    Figure CN120540684A_ABST
Patent Text Reader

Abstract

The invention provides a differential package generation method and device, electronic equipment and a storage medium. The differential packet generation method comprises the following steps: dividing an original packet into a plurality of first data blocks according to a given data length; determining the start bit of the target packet as a selection start point; based on the selection starting point, obtaining a second data block with the data length from the target packet, performing data matching on the second data block and each first data block, moving the selection starting point backwards by a data length if the matching is successful, and moving the selection starting point backwards by a byte if the matching is unsuccessful, repeating the step until the target packet is traversed, so as to determine each second difference block in the target packet and each first difference block in the original packet; and determining a difference packet according to each second difference block and each first difference block. According to the scheme, the differential package can be conveniently generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of software technology, and in particular to a differential packet generation method, device, electronic device, and storage medium. Background Art

[0002] With the advancement of science and technology, software technology has rapidly developed in areas such as vehicles. Software upgrades are a key focus of this technology, and differential upgrades using differential packets are a common upgrade method. For example, using differential packets for in-vehicle software OTA upgrades can effectively reduce the size of network transmission packets, significantly reducing the transmission time and bandwidth required for software packages, thereby improving the success rate of software upgrades. Therefore, it is necessary to provide some new differential packet generation solutions to facilitate differential packet generation. Summary of the Invention

[0003] Embodiments of the present application provide a differential packet generation method, device, electronic device, and storage medium.

[0004] According to a first aspect of an embodiment of the present application, a differential packet generation method is provided, comprising:

[0005] Dividing the original packet into a plurality of first data blocks according to a given data length;

[0006] Determine the start position of the target packet as the selection starting point;

[0007] Based on the selected starting point, a second data block having the data length is obtained from the target packet, and the second data block is matched with each first data block. If the match is successful, the selected starting point is shifted back by one data length; if the match is unsuccessful, the selected starting point is shifted back by one byte, and this step is repeated until the target packet is traversed, so as to determine each second difference block in the target packet and each first difference block in the original packet;

[0008] A differential packet is determined according to each second difference block and each first difference block.

[0009] In some optional embodiments, the method further includes: calculating first hash values ​​of the plurality of first data blocks, and recording the first hash values ​​of the plurality of first data blocks into a target dictionary;

[0010] Determine whether the second data block successfully matches the first data block by:

[0011] Calculate a second hash value of the second data block, and search the target dictionary that records the first hash value according to the second hash value, wherein:

[0012] If the target dictionary contains a first hash value identical to the second hash value, determining that a first data block identical to the second data block exists in the plurality of first data blocks, and determining that the second data block successfully matches the first data block;

[0013] If the target dictionary does not contain the same first hash value as the second hash value, it is determined that the plurality of first data blocks do not contain the same first data block as the second data block, and it is determined that the second data block is not successfully matched to the first data block.

[0014] In some optional embodiments, determining the differential packet according to each second difference block and each first difference block includes:

[0015] Analyzing the difference information between each second difference block and each first difference block to determine a sub-difference packet corresponding to each second difference block;

[0016] The sub-difference packets corresponding to each obtained second difference block are merged to obtain a difference packet.

[0017] In some optional embodiments, analyzing the difference information between each second difference block and each first difference block includes:

[0018] For the i-th first difference block in each first difference block and the t-th second difference block in each second difference block,

[0019] Determine the starting position of the t-th second difference block as the matching starting point, perform data matching on the t-th second difference block and the i-th first difference block, and determine the longest identical data segment obtained as the target data segment;

[0020] executing a target processing step of the target data segment: synchronously extending the target data segment, determining a first extended data segment in the i-th first difference block and a second extended data segment in the t-th second difference block, determining target position information of the first extended data segment in the i-th first difference block, performing differential processing on the second extended data segment and the first extended data segment to obtain local differential data of the target data segment;

[0021] The matching starting point is moved back to one byte after the second extended data segment, and matched with the unmatched data in the i-th first difference block, and the obtained new longest identical data segment is updated as the new target data segment. The target processing step of the target data segment is executed again until the i-th first difference block is traversed, and the target position information and local differential data corresponding to each target data segment are obtained;

[0022] The differential information between the tth second difference block and the i-th first difference block is determined based on the target position information corresponding to each target data segment, the local differential data, and the additional data segments in the tth second difference block except the second extended data segments.

[0023] In some optional embodiments, synchronously extending the target data segment to determine a first extended data segment in the i-th first difference block and a second extended data segment in the t-th second difference block includes:

[0024] Based on the starting position and / or the ending position of the target data segment in the ith first difference block and the tth second difference block, respectively, the target data segment is synchronously extended outward to obtain a first extended data segment in the ith first difference block and a second extended data segment in the tth second difference block;

[0025] The ratio of identical bytes between the first extended data segment and the second extended data segment is less than or equal to a preset ratio.

[0026] In some optional embodiments, the sub-difference packet corresponding to the t-th second difference block is determined in the following manner:

[0027] Target differential information with the smallest data amount among the obtained differential information is determined, and a sub-differential packet corresponding to the t-th second differential block is generated according to the target differential information.

[0028] In some optional embodiments, the method further includes:

[0029] For the i-th first difference block in each first difference block:

[0030] If there is no first longest identical data segment that is greater than or equal to the preset data length, the tth second difference block and the position information of the tth second difference block in the target packet are determined as the differential information between the tth second difference block and the i-th first difference block.

[0031] According to a second aspect of an embodiment of the present application, a differential packet generation device is provided, including:

[0032] a dividing module, configured to divide the original packet into a plurality of first data blocks according to a given data length;

[0033] A first determining module, configured to determine the start position of the target packet as a selection starting point;

[0034] a second determining module, configured to obtain, based on the selected starting point, a second data block having the data length from the target packet, perform data matching on the second data block with each first data block, shift the selected starting point backward by one data length if the match is successful, and shift the selected starting point backward by one byte if the match is unsuccessful, and repeat this step until the target packet is traversed completely, so as to determine each second difference block in the target packet and each first difference block in the original packet;

[0035] The third determining module is configured to determine a differential packet according to each second difference block and each first difference block.

[0036] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory is used to store a computer program; and the processor is used to execute any one of the methods of the first aspect by running the computer program stored in the memory.

[0037] According to a fourth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method according to any one of the first aspects is implemented.

[0038] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, it implements the method as described in any one of the first aspects.

[0039] The differential packet generation method in the present application can divide the original packet into multiple first data blocks according to the given data length, and determine the starting bit of the target packet as the selection starting point, and then obtain the second data block with the data length from the target packet based on the selection starting point, and perform data matching on the second data block and each first data block. If the match is successful, the selection starting point will be shifted back by one data length. If the match is unsuccessful, the selection starting point will be shifted back by one byte, and this step is repeated until the target packet traversal is completed to determine the second difference blocks in the target packet and the first difference blocks in the original packet, and then determine the differential packet based on the second difference blocks and the first difference blocks. Therefore, through this scheme, differential packets can be generated conveniently and effectively to facilitate software differential upgrades. In addition, since in this scheme, data matching can be performed on the second data block and the first data block when traversing the target packet, When the match is successful, the starting point will be selected and moved back by one data length before continuing the matching. If the match is unsuccessful, the starting point will be selected and moved back by one byte before continuing the matching until the target packet traversal is completed. Therefore, it can be ensured that each byte of the target packet can be matched, thereby accurately determining the same data and difference data between the target packet and the original packet, and facilitating the accurate acquisition of each second difference block and each first difference block for the generation of differential packets, thereby conveniently and effectively improving the generation effect of differential packets; and, since the differential packet generation scheme in the present application is to match and process the original packet and the target packet according to data blocks, when the byte amount of the original packet and the target packet is large, this scheme can effectively shorten the production time of the differential packet, reduce the memory occupancy rate, reduce the risk of failure of differential packet production due to memory size limitation, and also help to improve the production efficiency of differential packets and save computing power. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0041] Figure 1 This is a flowchart of some optional differential packet generation methods in the embodiments of the present application.

[0042] Figure 2 These are some optional sub-flowcharts of step S108 in the embodiment of the present application.

[0043] Figure 3 This is a structural block diagram of some optional differential packet generation devices in the embodiments of the present application.

[0044] Figure 4 This is a structural block diagram of some optional electronic devices in the embodiments of this application. DETAILED DESCRIPTION

[0045] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art should fall within the scope of protection of the embodiments of the present application. It should be understood that the various steps described in the method implementation mode of the present disclosure can be performed in different orders and / or in parallel. In addition, the method implementation mode may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0046] With the advancement of science and technology, software technology has rapidly developed in areas such as vehicles. Software upgrades are a key area of ​​software technology, and differential upgrades using differential packets are a common upgrade method. For example, in the automotive sector, the demand for software-defined vehicles is shifting vehicles from mechanical to electronic, leading to continuous innovation in their electrical and electronic architectures. The computing power of electronic control units (ECUs) is increasing, resulting in larger ECU firmware sizes, more frequent version updates, and the relative independence of each domain controller. OTA (Over-the-Air Technology) upgrades have become the primary method for upgrading products after they are launched. However, due to the uncontrollable environment of the vehicle, the successful download of firmware is affected by many factors, such as network connectivity and file size, resulting in a low success rate for ECU firmware OTA upgrades. By using differential upgrades, the use of differential packets can effectively reduce the size of the packets transmitted on the network, significantly reducing the transmission time and bandwidth of the software package, thereby improving the success rate of OTA software upgrades.

[0047] The embodiments of the present application provide some new differential packet generation solutions, which can easily generate differential packets to improve the differential upgrade effect including but not limited to vehicle software OTA upgrade scenarios, which are described in detail below.

[0048] According to one aspect of an embodiment of the present application, a differential packet generation method is provided. It should be noted that the differential packet generation scheme in this solution can be applied to differential packet generation in any software upgrade scenario, including but not limited to differential upgrades of vehicle-mounted software. For example, in one application, it can be applied to differential packet generation in an OTA differential upgrade scenario for vehicle-mounted software. Figure 1 The following is a flowchart showing some optional differential packet generation methods in the embodiment of the present application. Figure 1As shown, the method includes steps S102, S104, S106 and S108, specifically:

[0049] S102: Divide the original packet into a plurality of first data blocks according to a given data length.

[0050] In this application, the original package can be an already installed software package, which is equivalent to the software package to be upgraded.

[0051] In the present application, when dividing the original packet, the original packet can be split, that is, the original packet can be split into multiple first data blocks; or the original packet can be divided without splitting, as long as it can meet the requirements.

[0052] The specific implementation of step S102 is not limited in this application, and the original packet can be divided as needed. Optionally, in step S102, the original packet can be divided into N first data blocks according to a given data length (i.e., a field with a fixed length consisting of a given number of bytes) (for example, denoted as a), where N ≥ 2 and is an integer. In some embodiments, the lengths of the N first data blocks can all be a given data length a. In other embodiments, the lengths of the first N-1 first data blocks in the N first data blocks can all be a given data length a, and the length of the last first data block can be less than the given data length a. This can adapt to the division requirements of original packets of various sizes. The given data length a can be reasonably set as needed, such as 50 bytes, 100 bytes, etc., and is not limited here.

[0053] Optionally, to facilitate subsequent processing, unique data block identifiers may be sequentially assigned to the multiple divided first data blocks. For example, the unique data block identifiers may be data block IDs. This may be implemented in any manner. For example, N first data blocks may be sequentially assigned data block IDs 1 to N. Hereinafter, the N first data blocks may be referred to as first data block 1, ..., first data block N.

[0054] S104: Determine the start position of the target packet as the selection starting point.

[0055] In this application, the target package may be a software package for upgrading, which is equivalent to an updated software package.

[0056] The start of the target packet can be determined as the starting point for selecting the second data block, so as to facilitate the selection of the second data block for data matching in subsequent steps.

[0057] S106: Based on the selected starting point, a second data block with a data length is obtained from the target packet, and the second data block is matched with each first data block. If the match is successful, the selected starting point is shifted back by a data length. If the match is unsuccessful, the selected starting point is shifted back by one byte. This step is repeated until the target packet is traversed to determine each second difference block in the target packet and each first difference block in the original packet.

[0058] After determining the starting point of the target packet as the starting point for selecting the second data block, optionally, based on the given data length a, the second data block can be obtained from the target packet with the selected starting point as the starting point, and the second data block can be matched with each first data block. Optionally, if it is determined that there is a first data block identical to the second data block among multiple first data blocks, the match is successful; if it is determined that there is no first data block identical to the second data block among multiple first data blocks, the match is unsuccessful. Furthermore, if the match is successful, the selected starting point is shifted back by a data length a; if the match is unsuccessful, the selected starting point is shifted back by one byte, until the entire target packet is traversed to determine each second difference block in the target packet and each first difference block in the original packet.

[0059] Optionally, in the present application, each second difference block may be other consecutive data blocks in the target packet except the second data block that is identical to the first data block, and the first difference block is a first data block that is different from each second data block.

[0060] It should be understood that by the above-mentioned traversal method of the target packet, it can be ensured that each byte of the target packet can be matched, thereby accurately determining the identical data and difference data between the target packet and the original packet, and facilitating the accurate acquisition of each second difference block and each first difference block for the generation of a differential packet.

[0061] For example, assume that the original packet (assuming it is 1000 bytes) is divided into N=10 first data blocks, which are: first data block 1, first data block 2, ..., first data block 10, and the 10 first data blocks are all of a given data length a (assuming it is 100 bytes); assuming the target packet is 1200 bytes, the traversal of the target packet can be started from the starting position (the first byte) of the target packet: the second data block is selected for the first time, and the given data length a=100 bytes (that is, the 1st to 100th bytes of the target packet) is selected as the second data block, and the second data block selected for the first time is matched with the first data blocks 1 to 10: if there is a first data block in the first data blocks 1 to 10 that is the same as the second data block selected for the first time, it is considered that the match is successful, and the second data block successfully matches the first data block, then the corresponding matching information is recorded (for example, assuming that the first data block 1 is the same as the second data block, then the 1st to 100th bytes of the target packet are recorded). byte and the first data block 1 (i.e., the data of the 1st to 100th bytes of the original packet) are the same as the relevant matching information), then the starting point is moved back to the next byte of the second data block selected for the first time, that is, the 101st byte of the target packet, and the second data block is continued to be selected from the 101st byte with a given data length a=100 bytes (i.e., the 101st to 200th bytes of the target packet are selected) to match with the remaining first data blocks; and if there is no first data block identical to the second data block selected for the first time in the first data blocks 1 to 10, it is considered that the match is unsuccessful, and the second data block is not successfully matched to the first data block, then the starting point is moved back by one byte, that is, the second data block is continued to be selected from the 2nd byte of the target packet (i.e., the 2nd to 101st bytes of the target packet are continued to be selected), and then it is determined whether there is a first data block identical to the second data block in each first data block; and so on, until the target packet is traversed. In this way, some data blocks in the target packet can be determined to be second data blocks that are identical to the first data blocks, while the other continuous data blocks can be determined to be second difference blocks, and the first data blocks in the original packet that are different from the second data blocks can be determined to be first difference blocks. Each second difference block and each first difference block can reflect the difference between the target packet and the original packet, which can facilitate the subsequent accurate determination of the differential packet. It should be understood that the above examples are not limitations of the embodiments of the present application.

[0062] In the present application, any method can be used to determine whether a first data block identical to a second data block exists in the plurality of first data blocks, thereby determining whether the second data block has successfully matched the first data block. For example, the determination can be achieved by directly performing a byte-by-byte comparison or by using an algorithm such as a machine learning model. In some optional embodiments, after dividing the plurality of first data blocks in step S102, the method of the present application further includes: calculating first hash values ​​for the plurality of first data blocks, and recording the first hash values ​​for the plurality of first data blocks in a target dictionary. Alternatively, determining whether the second data block has successfully matched the first data block can be performed by calculating a second hash value for the second data block and searching a target dictionary containing the first hash values ​​based on the second hash value. If the target dictionary contains a first hash value identical to the second hash value, then determining that the plurality of first data blocks contain a first data block identical to the second data block, and determining that the second data block has successfully matched the first data block; if the target dictionary does not contain a first hash value identical to the second hash value, then determining that the plurality of first data blocks contain a first data block identical to the second data block, and determining that the second data block has not successfully matched the first data block.

[0063] It should be understood that for different data blocks, the hash values ​​calculated by the same algorithm are different, while when two data blocks are the same, the hash values ​​calculated by the same algorithm for the two data blocks are the same. In this application, any algorithm can be used to calculate the hash value (i.e., the first hash value and the second hash value), for example, the MD5 algorithm can be used. Alternatively, any feasible algorithm such as the SHA-1 algorithm and the SHA-2 algorithm can be used.

[0064] Therefore, in this application, by calculating the first hash values ​​of multiple first data blocks, recording them in the target dictionary, calculating the second hash value of the second data block, and searching the target dictionary for the first hash value that is the same as the second hash value based on the second hash value, it is possible to effectively determine whether there is a first data block that is the same as the second data block in the multiple first data blocks, thereby accurately and effectively determining whether the second data block is successfully matched to the first data block, so that this scheme can determine the same data and difference data between the target packet and the original packet, and facilitate accurate acquisition of each second difference block and each first difference block for the generation of differential packets.

[0065] Optionally, after calculating the first hash values ​​of the plurality of first data blocks, the data block IDs of the plurality of first data blocks and the first hash values ​​can be associated and then stored in the target dictionary. In this way, if the same first hash value is found in the target dictionary through the second hash value, it is possible to accurately determine which first data block the second data block is identical to, thereby facilitating the recording of corresponding matching information.

[0066] S108: Determine a differential packet according to each second difference block and each first difference block.

[0067] After traversing the target package and completing the processing in the above step S106, the determined second difference blocks and first difference blocks can reflect the differences between the target package and the original package. Therefore, the differential package can be determined by processing the second difference blocks and the first difference blocks for subsequent software differential upgrades.

[0068] The differential packet generation method in the present application can divide the original packet into multiple first data blocks according to the given data length, and determine the starting bit of the target packet as the selection starting point, and then obtain the second data block with the data length from the target packet based on the selection starting point, and perform data matching on the second data block with each first data block. If the match is successful, the selection starting point will be shifted back by one data length. If the match is unsuccessful, the selection starting point will be shifted back by one byte, and this step is repeated until the target packet traversal is completed to determine the second difference blocks in the target packet and the first difference blocks in the original packet, and then determine the differential packet based on the second difference blocks and the first difference blocks. Therefore, through this scheme, differential packets can be generated conveniently and effectively to facilitate software differential upgrades. In addition, since in this scheme, data matching can be performed on the second data block and the first data block when traversing the target packet, When the matching is successful, the starting point will be selected and moved back by one data length before continuing the matching. If the matching is unsuccessful, the starting point will be selected and moved back by one byte before continuing the matching until the target packet traversal is completed. Therefore, it can be ensured that each byte of the target packet can be matched, thereby accurately determining the same data and difference data between the target packet and the original packet, and facilitating the accurate acquisition of each second difference block and each first difference block for the generation of differential packets, thereby conveniently and effectively improving the generation effect of differential packets; and, since the differential packet generation scheme in the present application is to match and process the original packet and the target packet according to data blocks, when the byte amount of the original packet and the target packet is large, this scheme can effectively shorten the production time of the differential packet, reduce the memory occupancy rate, reduce the risk of failure of differential packet production due to memory size limitation, and also help to improve the production efficiency of differential packets and save computing power.

[0069] The specific implementation of step S108 is not limited in this application. In some optional embodiments, optionally, refer to Figure 2 In the flowchart shown, step S108 may include steps S1082 and S1084:

[0070] S1082: Analyze the difference information between each second difference block and each first difference block to determine a sub-difference packet corresponding to each second difference block.

[0071] For example, assuming there are n second difference blocks and m first difference blocks, where n and m are both integers greater than 0 and may or may not be equal, then for the t-th second difference block among the n second difference blocks, differential information between the t-th second difference block and the m first difference blocks can be determined. Based on each obtained differential information, a sub-difference packet corresponding to the t-th second difference block can be determined, where 1≤t≤n and t is an integer. In this way, differential information between each second difference block and each first difference block can be obtained, thereby facilitating the determination of a sub-difference packet corresponding to each second difference block.

[0072] S1084: Merge the sub-difference packets corresponding to each obtained second difference block to obtain a difference packet.

[0073] In this application, by analyzing the differential information between each second difference block and each first difference block, determining the sub-differential package corresponding to each second difference block, and then merging the sub-differential packages corresponding to each second difference block, the differential package can be generated conveniently and accurately.

[0074] In some optional embodiments, the method of analyzing the difference information between each second difference block and each first difference block in step S1082 may include:

[0075] For the i-th first difference block in each first difference block and the t-th second difference block in each second difference block, the following steps S1082A to S1082D are performed:

[0076] S1082A: Determine the starting position of the t-th second difference block as the matching starting point, perform data matching on the t-th second difference block and the i-th first difference block, and determine the obtained longest identical data segment as the target data segment.

[0077] For example, assuming that there are n second difference blocks and m first difference blocks, where n and m are both integers greater than 0, and m and n may be equal or unequal, then 1≤t≤n and t is an integer, 1≤i≤m and i is an integer.

[0078] Optionally, the starting position of the t-th second difference block can be determined as the matching starting point, and data matching can be performed with the i-th first difference block starting from the matching starting point to determine the first longest identical data segment greater than or equal to the preset data length in the t-th second difference block and the i-th first difference block, and the obtained first longest identical data segment can be determined as the target data segment.

[0079] In this application, the preset data length can be preset as needed to avoid the longest matching identical data segment from being meaningless, thereby improving the validity of the subsequently obtained differential information. For example, in some examples, the preset data length can be set to 10 bytes. That is, the longest matching data segment between the t-th second difference block and the i-th first difference block is considered meaningful only when the length is greater than or equal to 10 bytes.

[0080] The longest identical data segment may refer to the largest continuous identical data segment. The longest identical data segment exists in both the t-th second difference block and the i-th first difference block. It should be understood that the longest identical data segments matched each time may be of the same length or different lengths, depending on the actual situation. For example, assuming that the preset data length is 10 bytes, if the first longest identical data segment is matched, and the first longest identical data segment may be a 12-byte data segment, and if the second longest identical data segment is matched in the following step S1084C, the second longest identical data segment may be longer or shorter than 12 bytes, or the same, for example, it may be 10 bytes, 11 bytes, 12 bytes, 13 bytes, etc., and the same applies to other cases.

[0081] After the first longest identical data segment is determined to be obtained, it can be determined as the target data segment for the next step of processing.

[0082] S1082B: Execute target processing steps of the target data segment: synchronously extend the target data segment, determine the first extended data segment in the i-th first difference block and the second extended data segment in the t-th second difference block, determine the target position information of the first extended data segment in the i-th first difference block, perform differential processing on the second extended data segment and the first extended data segment, and obtain local differential data of the target data segment.

[0083] Optionally, when executing the target processing step, the target data segment can be synchronously extended in the i-th first difference block and the t-th second difference block, the first extended data segment in the i-th first difference block and the second extended data segment in the t-th second difference block, and the target position information of the first extended data segment in the i-th first difference block is determined, and then the second extended data segment and the first extended data segment are differentially processed to obtain local differential data of the target data segment.

[0084] Optionally, the result of the differential processing can be used as local differential data. Alternatively, the result of the differential processing can be compressed and then used as the local differential data. This can reduce the amount of data and memory usage. The local differential data can then be used to determine the differential information between the t-th second difference block and the i-th first difference block.

[0085] In the present application, when the target data segment is synchronously extended in the i-th first difference block and the t-th second difference block, it is necessary to make the extension direction and length of the target data segment in the i-th first difference block consistent with the extension direction and length of the target data segment in the i-th first difference block (that is, the forward extension length needs to be the same, and the backward extension length needs to be the same), so that when differential processing (which can be bitwise subtraction) is performed on the second extended data segment and the first extended data segment, the target data segment can be subtracted, so that the obtained local differential data can accurately and effectively represent the difference between the first extended data segment and the second extended data segment of the target data segment, and this also facilitates the compression of the local differential data to reduce the data volume and memory occupancy, thereby facilitating the use of the compressed local differential data.

[0086] The target position information may be position information of the first extended data segment in the i-th first difference block, for example, may include the starting position and the ending position of the first extended data segment in the i-th first difference block.

[0087] In some optional embodiments, the target data segment can be synchronously extended in the following manner to determine the first extended data segment in the i-th first difference block and the second extended data segment in the t-th second difference block: based on the starting position and / or ending position of the target data segment in the i-th first difference block and the t-th second difference block, the target data segment is synchronously expanded outward to obtain the first extended data segment in the i-th first difference block and the second extended data segment in the t-th second difference block; wherein the ratio of identical bytes between the first extended data segment and the second extended data segment is less than or equal to a preset ratio.

[0088] In the present application, the i-th first difference block and the t-th second difference block can be synchronously expanded outward from the starting position and / or the end position of the target data segment as needed (it can be synchronously expanded forward and outward from the starting position and / or synchronously expanded backward and outward from the end position), so that the target data segment is in the same position in the first extended data segment and the second extended data segment obtained by expansion, which facilitates subsequent differential processing.

[0089] The preset ratio can be set as needed. For example, in one embodiment, it can be set to 50%, or it can also be set to 40%, 60%, etc. For example, the determination of the byte-identical ratio can be understood with reference to the following example. Assuming that the target data segment is AAAA (each letter is understood as 1 byte here, and 4 bytes are taken as an example here), the data segment BBAAAACC obtained by expansion in the i-th first difference block and the data segment DDAAAAEE obtained by expansion in the t-th second difference block, then the identical bytes between the two data segments are the 3rd to 6th bytes (i.e., AAAA), and the different bytes are the 1st to 2nd and 7th to 8th bytes. It can be determined that the byte-identical ratio is equal to 50%. Assuming the preset ratio is 50%, the expansion can be stopped at this time, and the data segment BBAAAACC is determined as the first extended data segment, and the data segment DDAAAAEE is determined as the second extended data segment. Of course, this does not serve as any limitation to the present application.

[0090] It should be understood that in this application, through the above-mentioned optional method, the target data segment can be conveniently and effectively synchronously extended in the i-th first difference block and the t-th second difference block, and the first extended data segment and the second extended data segment of the target data segment can be conveniently and effectively determined.

[0091] In this application, determining the longest identical data segment can be considered as an exact match, while the synchronous extension of the target data segment can be considered as a fuzzy match. By combining exact matching and fuzzy matching, it is convenient to accurately calculate local differential data for determining differential information.

[0092] S1082C: Move the matching starting point back to one byte after the second extended data segment, and match it with the unmatched data in the i-th first difference block. Update the obtained new longest identical data segment as the new target data segment, and return to execute the target processing step of the target data segment until the i-th first difference block is traversed, and obtain the target position information and local differential data corresponding to each target data segment.

[0093] Optionally, after determining the target position information and local differential data corresponding to the target data segment, the matching starting point is moved back to the next byte after the second extended data segment of the target data segment in the t-th second difference block, and starting from the matching starting point after the backward shift, the matching is continued with the unmatched data after the first extended data segment of the target data segment in the i-th first difference block, and it is continued to be determined whether there is a new longest identical data segment greater than or equal to the preset data length, and the new longest identical data segment is updated as the new target data segment, and the target processing step of the target data segment is returned to be executed (i.e., return to step S1082B to continue execution), until the i-th first difference block is traversed, and the target position information and local differential data corresponding to each target data segment are obtained.

[0094] In this application, after the first longest identical data segment is determined as the target data segment for processing and the target processing step is completed, the new longest identical data segment can be further determined and determined as the new target data segment for the target processing step until the i-th first difference block is traversed to obtain the target position information and local differential data corresponding to each target data segment.

[0095] S1082D: Determine the differential information between the tth second difference block and the i-th first difference block based on the target position information corresponding to each target data segment, the local differential data, and the additional data segments in the tth second difference block except for the second extended data segments.

[0096] Optionally, the differential information between the tth second difference block and the i-th first difference block can be determined based on the target position information and local differential data corresponding to each target data segment, and the additional data segments in the tth second difference block except for the second extended data segments.

[0097] Optionally, the target position information and local differential data corresponding to each target data segment, and the additional data segments in the tth second difference block except for the second extended data segments can be summarized to form the differential information between the tth second difference block and the i-th first difference block.

[0098] In the present application, by performing the above steps S1082A to S1082D on the t-th second difference block and the m first difference blocks, the difference information between the t-th second difference block and the m first difference blocks can be determined respectively.

[0099] In the present application, through the above-mentioned optional embodiments, the differential information between the t-th second difference block in each first difference block and the i-th first difference block in each second difference block can be conveniently and accurately determined, thereby conveniently and accurately determining the differential information between the t-th second difference block and each first difference block, and accurately determining the differential information between each second difference block and each first difference block, so as to facilitate the generation of differential packages.

[0100] In some optional embodiments, the differential packet generation method in the present application may also include: for the i-th first difference block in each first difference block: if there is no first longest identical data segment greater than or equal to the preset data length, then the t-th second difference block and the position information of the t-th second difference block in the target packet are determined as the differential information between the t-th second difference block and the i-th first difference block.

[0101] In the present application, through the above-mentioned optional embodiments, when there is no first longest identical data segment greater than or equal to the preset data length, the differential information between the t-th second difference block and the i-th first difference block in each first difference block can be conveniently and accurately determined, thereby conveniently and accurately determining the differential information between the t-th second difference block and each first difference block, so as to facilitate the generation of differential packets.

[0102] For example, the position information of the t-th second difference block in the target packet may include the starting position and the ending position of the t-th second difference block in the target packet.

[0103] In some optional embodiments, in step S1082, the sub-differential package corresponding to the t-th second difference block can be determined in the following manner: determine the target differential information with the smallest data amount among the obtained differential information, and generate the sub-differential package corresponding to the t-th second difference block based on the target differential information.

[0104] In the present application, by determining the target differential information with the smallest data volume among the differential information, and generating the sub-differential package corresponding to the t-th second differential block based on the target differential information, the data volume of the sub-differential package corresponding to the t-th second differential block can be as small as possible, which is beneficial to reducing the data volume of the differential package obtained by subsequently merging the sub-differential packages corresponding to the various second differential blocks, reducing memory usage, and helping to reduce the transmission time and transmission bandwidth of the differential package on the network during subsequent software differential upgrades, which is beneficial to improving the success rate of differential upgrades.

[0105] In this application, in step S1084, multiple sub-differential packages are merged to generate a complete differential package, and the complete differential package can be used to perform a differential upgrade of the software. Optionally, when merging multiple sub-differential packages, the merging can be performed according to a predetermined format to obtain a complete differential package that meets the requirements. This application does not impose any specific restrictions.

[0106] Optionally, when using a differential package, the differential package can be transmitted to a device on which the original package is installed. The device can parse the differential package to obtain multiple sub-differential packages and utilize the sub-differential packages. For example, optionally, if the sub-differential package corresponding to the t-th second difference block is generated by differential information (target differential information) including each local differential data, each target position information, and each additional data segment in the t-th second difference block except for each second extended data segment, then the data segments corresponding to each target position information in the i-th first difference block of the original package can be processed respectively based on the utilization of each local differential data, and then each additional data segment is added to the i-th first difference block. Optionally, if the sub-differential package corresponding to the t-th second difference block is generated by differential information (target differential information) including the t-th second difference block and the position information of the t-th second difference block in the target package, then the t-th second difference block is added to the original package according to the position information of the t-th second difference block in the target package. Of course, this is only an optional example and does not limit the present application.

[0107] The following is an overall introduction to an optional differential packet generation method of the present application, which uses less memory and includes:

[0108] Step 1: Divide the original packet into N first data blocks according to a given data length (for example, each of which has a given data length a), where N is ≥ 2 and is an integer.

[0109] Step 2: Calculate the first hash values ​​of the N first data blocks (for example, by using the MD5 algorithm), and store the first hash values ​​and data block IDs of the N first data blocks in the target dictionary.

[0110] Step 3: Determine the starting bit of the target packet as the starting point for selecting the second data block, traverse the data blocks starting from the selected starting point with the data length of the first data block in step 1 (for example, the given data length a), obtain the second data block with the given data length, perform data matching on the second data block with each first data block, and record the matching information to obtain n second difference blocks and m first difference blocks, where the n second difference blocks are respectively other consecutive data blocks in the target packet except the second data block that is the same as the first data block, and the first difference block is the first data block where all second data blocks are different.

[0111] Step 3 can be divided into the following steps 3.1 and 3.2:

[0112] Step 3.1: Calculate the second hash value of the second data block (for example, by using the MD5 algorithm), and query the target dictionary in step 2 based on the second hash value. If there is a first hash value identical to the second hash value in the target dictionary, it is determined that there is a first data block identical to the second data block in the multiple first data blocks, and the match is successful (that is, the second data block successfully matches the first data block). Record the corresponding matching information, move the selection starting point of the second data block backward by the data length of the first data block (that is, the given data length a), and re-execute step 3.1.

[0113] Step 3.2: If there is no first hash value identical to the second hash value in the target dictionary, it is determined that there is no first data block identical to the second data block among the multiple first data blocks, and the match is unsuccessful (that is, the second data block is not successfully matched to the first data block), then the starting point is selected and moved backward by one byte, and step 3.1 is executed until the entire target packet is traversed, and a total of n second difference blocks and m first difference blocks are obtained.

[0114] Step 4: Process the m first difference blocks of the original packet and the n second difference blocks of the target packet. Specifically, for the t-th second difference block among the n second difference blocks, determine the differential information between the t-th second difference block and the m first difference blocks respectively, and determine the sub-differential packet corresponding to the t-th second difference block based on the obtained differential information, where 1≤t≤n and t is an integer.

[0115] Determining the difference information between the t-th second difference block and the m first difference blocks in step 4 can be divided into the following steps 4.1 to 4.6:

[0116] Step 4.1: Determine the starting position of the t-th second difference block as the matching starting point, start data matching with the i-th first difference block from the matching starting point, determine the first longest identical data segment between the t-th second difference block and the i-th first difference block that is greater than or equal to a preset data length, and determine the obtained first longest identical data segment as the target data segment. 1≤i≤m, where i is an integer.

[0117] Step 4.2: Target processing of the target data segment: Synchronously extend the target data segment in the i-th first difference block and the t-th second difference block, determine the first extended data segment in the i-th first difference block and the second extended data segment in the t-th second difference block, determine the target position information of the first extended data segment in the i-th first difference block, and then perform differential processing on the second extended data segment and the first extended data segment to obtain local differential data of the target data segment. Optionally, the result of the differential processing can be used as the local differential data, or the result of the differential processing can be compressed and the compressed result of the differential processing can be used as the local differential data. (When executing step 4.2, the target data segment may be synchronously extended outward from the starting position and / or the ending position of the target data segment in the i-th first difference block and the t-th second difference block until the ratio of identical bytes between the two extended data segments is less than or equal to a preset ratio (e.g., 50%). The data segment extended from the i-th first difference block at the time of the stop is determined as the first extended data segment, and the data segment extended from the t-th second difference block is determined as the second extended data segment.)

[0118] Step 4.3: After determining the target position information and local differential data (which can also be compressed local differential data) corresponding to the target data segment, the matching starting point is moved back to the next byte after the second extended data segment of the target data segment in the t-th second difference block, and starting from the matching starting point after the backward shift, continue to match with the unmatched data after the first extended data segment of the target data segment in the i-th first difference block, and continue to determine whether there is a new longest identical data segment greater than or equal to the preset data length, and update the new longest identical data segment to the new target data segment, and return to execute the target processing step of the target data segment (that is, return to execute step 4.2), until the i-th first difference block is traversed, and the target position information and local differential data corresponding to each target identical data segment are obtained.

[0119] Step 4.4: Determine the difference information between the tth second difference block and the i-th first difference block based on the obtained local difference data, target position information, and additional data segments other than the second extended data segments in the tth second difference block.

[0120] Step 4.5: If it is determined in step 4.1 that there is no first longest identical data segment greater than or equal to the preset data length, the t-th second difference block and the position information of the t-th second difference block in the target packet are determined as the differential information between the t-th second difference block and the i-th first difference block.

[0121] Step 4.6: Determine the target differential information with the smallest data amount among the obtained differential information, and generate a sub-differential packet corresponding to the t-th second differential block according to the target differential information.

[0122] Step 5: Execute the above step 4 for each of the n second difference blocks to obtain the sub-difference packets corresponding to the n second difference blocks.

[0123] Step 6: Aggregate and merge the sub-difference packages corresponding to the obtained n second difference blocks to obtain a difference package.

[0124] It will be understood that the above descriptions are merely some optional embodiments of the differential packet generation method of the present application, and do not constitute any limitation to the embodiments of the present application.

[0125] According to another aspect of the embodiment of the application, a differential packet generation device is provided. Figure 3 As shown, the differential packet generating device 300 includes:

[0126] A division module 302 is configured to divide the original packet into a plurality of first data blocks according to a given data length;

[0127] A first determining module 304 is configured to determine the start position of the target packet as a selection starting point;

[0128] a second determining module 306 configured to obtain, based on the selected starting point, a second data block having the data length from the target packet, perform data matching on the second data block with each first data block, and if the matching is successful, shift the selected starting point backward by one data length; if the matching is unsuccessful, shift the selected starting point backward by one byte, and repeat this step until the target packet is traversed, thereby determining each second difference block in the target packet and each first difference block in the original packet;

[0129] The third determination module 308 is configured to determine a differential packet based on each second difference block and each first difference block. The differential packet generation device 300 provided in this embodiment of the present application is based on the same inventive concept as the differential packet generation method described above, corresponds to the corresponding differential packet generation method in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding differential packet generation method embodiments, and therefore will not be described in detail here. Furthermore, the implementation of each module in the differential packet generation device 300 in this embodiment of the present application can refer to the corresponding descriptions in the aforementioned differential packet generation method embodiments, and will not be described in detail here.

[0130] According to another aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory is used to store a computer program; and the processor is used to execute any of the aforementioned differential packet generation methods by running the computer program stored on the memory.

[0131] Reference Figure 4 , shows a schematic diagram of the structure of an electronic device according to an embodiment of the present application, and the embodiment of the present application does not limit the specific implementation of the electronic device. Figure 4 As shown, the electronic device 1000 may include: a processor 1002 , a communications interface 1004 , a memory 1006 , and a communication bus 1008 .

[0132] in:

[0133] The processor 1002 , the communication interface 1004 , and the memory 1006 communicate with each other via a communication bus 1008 .

[0134] The communication interface 1004 is used to communicate with other electronic devices or servers.

[0135] The processor 1002 is configured to execute the computer program 1010, and specifically to execute the relevant steps in the above-mentioned differential packet generation method embodiment.

[0136] Specifically, the computer program 1010 may include program codes, which include computer operation instructions.

[0137] The processor 1002 may be a CPU, a GPU (Graphic Processing Unit), an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0138] The memory 1006 is used to store the computer program 1010. The memory 1006 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0139] The computer program 1010 may include multiple computer instructions. Specifically, the computer program 1010 may enable the processor 1002 to execute operations corresponding to the differential packet generation method described in any of the aforementioned method embodiments through the multiple computer instructions.

[0140] The specific implementation of each step in the computer program 1010 can refer to the corresponding description of the corresponding steps and units in the above-mentioned method embodiment, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working process of the above-mentioned devices and modules can refer to the corresponding process description in the above-mentioned method embodiment, and will not be repeated here.

[0141] According to another aspect of the embodiments of the present application, the embodiments of the present application further provide a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the differential packet generation method described in any one of the aforementioned multiple method embodiments.

[0142] The computer storage medium includes but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.

[0143] According to another aspect of the embodiments of the present application, the embodiments of the present application further provide a computer program product, including a computer program, which, when executed by a processor, implements the differential packet generation method described in any one of the aforementioned multiple method embodiments.

[0144] The differential packet generation device 300 / electronic device 1000 / computer storage medium / computer program product embodiment in the embodiment of the present application has been described in detail in the aforementioned differential packet generation method embodiment, so its relevant content and beneficial effects can be understood with reference to the above-mentioned method embodiment and will not be repeated here.

[0145] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0146] It should be noted that, depending on the needs of implementation, the various components / steps described in the embodiments of this application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of this application. It should be understood that the various technical features in the technical solutions of the embodiments of this application can be combined in any appropriate manner.

[0147] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk or magneto-optical disk), or as computer code that is originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded via a network and will be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA)). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., random access memory (RAM), read-only memory (ROM), flash memory, etc.) that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown here.

[0148] Those skilled in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for specific applications, but such implementation should not be considered to be beyond the scope of the embodiments of this application.

[0149] The above implementation methods are only used to illustrate the embodiments of the present application, and are not intended to limit the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of the present application, and the scope of patent protection of the embodiments of the present application should be defined by the claims.

[0150] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". It should be noted that the concepts of "first", "second", etc. mentioned in the embodiments of the present application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units. It should be noted that the modifications of "one" and "multiple" mentioned in the embodiments of the present application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present application, rather than to limit them. Although the embodiments of the present application have been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A differential packet generation method, comprising: Dividing the original packet into a plurality of first data blocks according to a given data length; Determine the start position of the target packet as the selection starting point; Based on the selected starting point, a second data block having the data length is obtained from the target packet, and the second data block is matched with each first data block. If the match is successful, the selected starting point is shifted back by one data length; if the match is unsuccessful, the selected starting point is shifted back by one byte, and this step is repeated until the target packet is traversed, so as to determine each second difference block in the target packet and each first difference block in the original packet; A differential packet is determined according to each second difference block and each first difference block.

2. The method according to claim 1, wherein The method further includes: calculating first hash values ​​of the plurality of first data blocks, and recording the first hash values ​​of the plurality of first data blocks into a target dictionary; Determine whether the second data block successfully matches the first data block by: Calculate a second hash value of the second data block, and search the target dictionary that records the first hash value according to the second hash value, wherein: If the target dictionary contains a first hash value identical to the second hash value, determining that a first data block identical to the second data block exists in the plurality of first data blocks, and determining that the second data block successfully matches the first data block; If the target dictionary does not contain the same first hash value as the second hash value, it is determined that the plurality of first data blocks do not contain the same first data block as the second data block, and it is determined that the second data block is not successfully matched to the first data block.

3. The method according to claim 1 or 2, wherein: The determining of the differential packets according to each second difference block and each first difference block includes: Analyzing the difference information between each second difference block and each first difference block to determine a sub-difference packet corresponding to each second difference block; The sub-difference packets corresponding to each obtained second difference block are merged to obtain a difference packet.

4. The method according to claim 3, wherein: The analyzing the difference information between each second difference block and each first difference block includes: For the i-th first difference block in each first difference block and the t-th second difference block in each second difference block, Determine the starting position of the t-th second difference block as the matching starting point, perform data matching on the t-th second difference block and the i-th first difference block, and determine the longest identical data segment obtained as the target data segment; executing a target processing step of the target data segment: synchronously extending the target data segment, determining a first extended data segment in the i-th first difference block and a second extended data segment in the t-th second difference block, determining target position information of the first extended data segment in the i-th first difference block, performing differential processing on the second extended data segment and the first extended data segment to obtain local differential data of the target data segment; The matching starting point is moved back to one byte after the second extended data segment, and matched with the unmatched data in the i-th first difference block, and the obtained new longest identical data segment is updated as the new target data segment. The target processing step of the target data segment is executed again until the i-th first difference block is traversed, and the target position information and local differential data corresponding to each target data segment are obtained; The differential information between the tth second difference block and the i-th first difference block is determined based on the target position information corresponding to each target data segment, the local differential data, and the additional data segments in the tth second difference block except the second extended data segments.

5. The method according to claim 4, wherein Synchronously extending the target data segment to determine a first extended data segment in the i-th first difference block and a second extended data segment in the t-th second difference block, comprising: Based on the starting position and / or the ending position of the target data segment in the ith first difference block and the tth second difference block, respectively, the target data segment is synchronously extended outward to obtain a first extended data segment in the ith first difference block and a second extended data segment in the tth second difference block; The ratio of identical bytes between the first extended data segment and the second extended data segment is less than or equal to a preset ratio.

6. The method according to claim 4, wherein: The sub-difference package corresponding to the t-th second difference block is determined in the following way: Target differential information with the smallest data amount among the obtained differential information is determined, and a sub-differential packet corresponding to the t-th second differential block is generated according to the target differential information.

7. The method according to claim 4, wherein: The method further comprises: For the i-th first difference block in each first difference block: If there is no first longest identical data segment that is greater than or equal to the preset data length, the tth second difference block and the position information of the tth second difference block in the target packet are determined as the differential information between the tth second difference block and the i-th first difference block.

8. A differential packet generation device, comprising: a dividing module, configured to divide the original packet into a plurality of first data blocks according to a given data length; A first determining module, configured to determine the start position of the target packet as a selection starting point; a second determining module, configured to obtain, based on the selected starting point, a second data block having the data length from the target packet, perform data matching on the second data block with each first data block, shift the selected starting point backward by one data length if the match is successful, and shift the selected starting point backward by one byte if the match is unsuccessful, and repeat this step until the target packet is traversed completely, so as to determine each second difference block in the target packet and each first difference block in the original packet; The third determining module is configured to determine a differential packet according to each second difference block and each first difference block.

9. An electronic device comprising: A processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 7 by running the computer program stored in the memory.

10. A computer storage medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 7 when executed by a processor.