WO2021097624A1 - File processing method, file processing apparatus, and terminal device - Google Patents

File processing method, file processing apparatus, and terminal device Download PDF

Info

Publication number
WO2021097624A1
WO2021097624A1 PCT/CN2019/119243 CN2019119243W WO2021097624A1 WO 2021097624 A1 WO2021097624 A1 WO 2021097624A1 CN 2019119243 W CN2019119243 W CN 2019119243W WO 2021097624 A1 WO2021097624 A1 WO 2021097624A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
compressed file
compressed
compression
compression parameter
Prior art date
Application number
PCT/CN2019/119243
Other languages
French (fr)
Chinese (zh)
Inventor
赵杰
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN201980100491.8A priority Critical patent/CN114402286A/en
Priority to PCT/CN2019/119243 priority patent/WO2021097624A1/en
Publication of WO2021097624A1 publication Critical patent/WO2021097624A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • This application belongs to the field of information processing technology, and in particular relates to a file processing method, a file processing device, a terminal device, and a computer-readable storage medium.
  • This application provides a file processing method, file processing device, terminal device, and computer-readable storage medium, which can reduce the corresponding traffic consumption when a designated terminal obtains a new version of a file for update.
  • the first aspect of this application provides a file processing method, including:
  • the difference file between the first file set and the second file set wherein the first file set is obtained by decompressing the first compressed file, the second file set is obtained by decompressing the second compressed file, and the second compressed file Is a historical version file of the first compressed file;
  • the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file;
  • the first target compressed file is sent to a designated terminal to instruct the designated terminal to obtain the restored first compressed file according to the first target compressed file and the fourth compressed file in the designated terminal, where:
  • the fourth compressed file is the same as the second compressed file.
  • the second aspect of the present application provides a file processing device, including:
  • the first processing module is configured to obtain the difference file between the first file set and the second file set, wherein the first file set is obtained by decompressing the first compressed file, and the second file set is obtained by decompressing the second compressed file ,
  • the second compressed file is a historical version file of the first compressed file
  • the first detection module is configured to detect whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file the same;
  • a second processing module configured to obtain the first digital signature of the first compressed file if the first compression parameter set exists
  • the third processing module is configured to obtain a first target compressed file containing first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information contains information about the first compression parameter Collection of information.
  • the sending module is configured to send the first target compressed file to a designated terminal, so as to instruct the designated terminal to obtain the restored first compressed file according to the first target compressed file and the fourth compressed file in the designated terminal.
  • a compressed file, wherein the fourth compressed file is the same as the second compressed file.
  • the third aspect of the present application provides a terminal device.
  • the terminal device includes a memory, a processor, and a computer program that is stored in the memory and can run on the processor.
  • the processor executes the computer program, the above-mentioned computer program is implemented. Steps of the method on the one hand.
  • the fourth aspect of the present application provides a computer-readable storage medium, the above-mentioned computer-readable storage medium stores a computer program, and when the above-mentioned computer program is executed by a processor, the steps of the method of the above first aspect are realized.
  • the fifth aspect of the present application provides a computer program product.
  • the computer program product includes a computer program, and the computer program is executed by one or more processors to implement the steps of the method of the first aspect.
  • FIG. 1 is a schematic diagram of an implementation process of a file processing method provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of an implementation process of a file processing method provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of an implementation process of detecting whether a first compression parameter set exists according to an embodiment of the present application
  • Figure 4 is a structural block diagram of a file processing device provided by an embodiment of the present application.
  • Fig. 5 is a schematic diagram of a terminal device provided by an embodiment of the present application.
  • FIG. 1 it is a schematic diagram of an implementation flow of a file processing method provided by an embodiment of this application.
  • This file processing method can be applied to terminal equipment.
  • the terminal device may be a server, a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR)/virtual reality (VR) device, a notebook computer, an ultra mobile personal computer (Ultra -mobile Personal Computer, UMPC), netbook, personal digital assistant (Personal Digital Assistant, PDA), etc.
  • AR augmented reality
  • VR virtual reality
  • PDA Personal Digital Assistant
  • files in some terminals often need to be updated.
  • an application program installed in a mobile terminal often needs to download a new version of the installation package for upgrade, or a certain file needs to be version updated, and so on.
  • the user when the application in the mobile terminal needs to be upgraded, the user will obtain the installation package of the new version of the application through the browser, application store, etc. in the mobile terminal.
  • the corresponding server and other equipment will often transmit to the mobile terminal the incremental package of the new version of the installation package relative to the old version of the installation package in the mobile terminal, and the incremental package is often It is obtained by performing a difference operation on the installation package of the new version and the installation package of the old version.
  • the installation package is often a compressed package, and even a small change in the uncompressed file, the compressed file obtained after the compression will change greatly, resulting in the size of the incremental package itself is still large. Therefore, even if the terminal downloads the corresponding incremental package, the traffic resources consumed are still very large.
  • the file processing method when the designated terminal obtains a new version of the file for update, the corresponding traffic consumption can be reduced.
  • the file processing method in the embodiment of the present application includes:
  • step 101 the difference file between the first file set and the second file set is obtained, wherein the first file set is obtained by decompressing the first compressed file, and the second file set is obtained by decompressing the second compressed file, so
  • the second compressed file is a historical version file of the first compressed file.
  • the difference file is obtained by performing a difference operation on the first file set and the second file set.
  • the difference algorithm may be Bsdiff.
  • One or more of the difference algorithms such as, Xdelta3, etc.
  • the number and types of files contained in the first file set and the second file set are not limited herein.
  • it may be determined that the second compressed file is a historical version file of the first compressed file through information such as version number, file name, and so on.
  • the method for obtaining the difference file may be determined according to actual application scenarios.
  • the difference file may be obtained by a terminal device executing the embodiment of the present application from other terminals through a specific information transmission method, or the difference file may be After receiving a related request sent by another terminal, the terminal device obtains the first file set and the second file set according to the related request.
  • step 102 it is detected whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file.
  • the provider of the first compressed file (such as a developer) often does not provide compression information such as specific compression parameters and specific compression algorithms corresponding to the first compressed file. After decompressing the first compressed file to obtain the first file set, and then compressing the first file set, if the obtained new compressed file is different from the first compressed file, even if it is a 1-bit file The difference will also cause the new compressed file to be illegal when the new compressed file is verified through the digital signature of the first compressed file. Therefore, in the embodiment of the present application, the first set of compression parameters can be obtained through detection, and the first set of files can be compressed to obtain a third compressed file that is the same as the first compressed file. The digital signature of the first compressed file is used for verification of the third compressed file, so that the provider of the first compressed file does not need to provide the digital signature of the third compressed file again, which improves processing efficiency.
  • the first compression parameter set may include one or more compression parameters, and, in some embodiments, the first compression parameter set may also include one or more first compression parameters.
  • the compression parameters can be determined according to specific compression algorithms, application scenarios and other conditions.
  • the first set of compression parameters may include parameters used to indicate compression algorithms, parameters used to indicate encoding methods, parameters used to indicate compression levels, and parameters used to indicate conditions of check fields. At least one.
  • the parameter may be a preset number, text, symbol number, and so on.
  • the parameters can be independent of each other, or they can be related. For example, since the specific parameters corresponding to different compression algorithms may be different, the parameters used to indicate different compression algorithms, the corresponding parameters used to indicate the encoding mode and the parameters used to indicate the degree of compression may be different.
  • the detected compression algorithm is determined to be the Deflate compression algorithm. Then, when detecting whether there is a first compression parameter set, the parameters used to indicate the encoding mode in the Deflate compression algorithm may be adjusted , The parameter used to indicate the degree of compression and the parameter used to indicate the condition of the check field are detected to determine whether there is a first set of compression parameters.
  • the detected compression algorithm is determined to be the Deflate compression algorithm.
  • the detected parameters may include strategy, level, and nowrap.
  • the parameter indicating the encoding mode can be named strategy, and the value of the strategy can be 0-4, where 0 means for ordinary data, and 1 means for filter (or called predictor). predictor), 2 indicates that it is used to force Huffman coding, 3 indicates that the matching length is restricted to 1, and 4 indicates that the use of dynamic Huffman coding is prevented.
  • the parameter used to indicate the degree of compression can be named level, and the level can have three values, where 0 means no compression, 1 means speed priority, compression degree higher than 0, 9 means compression priority, compression degree higher than 1, compression The speed is slower than 1.
  • the parameter used to indicate the condition of the check field can be named nowrap, and the nowrap can indicate whether to use the zlib check header, where the nowrap can have two values, 1 means not using the zlib check header and the check header.
  • Check field, 0 means to use zlib check header and check field.
  • the strategy, the level, and the nowrap may also use other values to represent other meanings.
  • step 103 if the first compression parameter set exists, the first digital signature of the first compressed file is obtained.
  • the first file set may be compressed to obtain a third compressed file that is the same as the first compressed file.
  • the digital signature of the first compressed file may be used for verification of the third compressed file, so that the provider of the first compressed file may not need to provide the digital signature of the third compressed file again.
  • the first digital signature of the first compressed file is included in the first compressed file. Therefore, the first digital signature can be directly extracted from the first compressed file get.
  • the first digital signature of the first compressed file can also be generated according to the private key provided by the provider (such as the developer) of the first compressed file.
  • step 104 a first target compressed file containing first compression parameter information, the difference file, and the first digital signature is obtained, wherein the first compression parameter information contains information about the first compression parameter set information.
  • the first compression parameter information, the difference file, and the first digital signature may exist in multiple forms.
  • a first file containing the information of the first compression parameter set can be generated, and a second file containing the information of the first digital signature can be generated, and a difference file and the first file, the first file and the second file can be generated.
  • the first compression parameter information and/or the first digital signature may also be added to the difference file, for example, after the end position of the difference file, and the added information may be identified by a corresponding mark.
  • the first compression parameter information and/or the first digital signature may also be added to the difference file, for example, after the end position of the difference file, and the added information may be identified by a corresponding mark.
  • step 105 the first target compressed file is sent to a designated terminal to instruct the designated terminal to obtain the restored first target file according to the first target compressed file and the fourth compressed file in the designated terminal.
  • a compressed file, wherein the fourth compressed file is the same as the second compressed file.
  • the designated terminal may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, a server, or augmented reality (AR)/virtual reality.
  • AR Augmented Reality
  • VR Virtual Reality
  • the compressed file is the size of the file obtained by performing the differential operation. Therefore, in the information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced.
  • the first digital signature in the first target compressed file is used to verify the restored first compressed file after the restored first compressed file is obtained.
  • the decompressed third file set of the fourth compressed file in the designated terminal may be obtained, and the first The difference file in the target compressed file can be synthesized with the third file set, so that the designated terminal can obtain the restored first file set, and then obtain the restored first file set according to the first compression parameter information. Compress the file, so that the restored first compressed file can be verified through the first digital signature, so that the designated terminal can use the first compressed file to perform corresponding functions, install and read and many more.
  • the file processing method may further include the following steps:
  • Step 201 If the first compression parameter set does not exist, determine a second compression parameter set according to the compression speed, compression ratio, and/or similarity of compressed files, where the similarity of the compressed files is based on the second The degree of similarity between the fifth compressed file obtained by compressing the first file set by the compression parameter set and the first compressed file;
  • Step 202 Compress the first file set according to the second compression parameter set to obtain a fifth compressed file
  • Step 203 Obtain a second digital signature of the fifth compressed file
  • Step 204 Obtain a second target compressed file that includes second compression parameter information, the difference file, and the second digital signature, where the second compression parameter information includes information of the second compression parameter set.
  • the compression speed, compression ratio, and/or similarity of compressed files may be considered as an influencing factor that affects the determination of the second compression parameter set, and the selection of the influencing factor may be determined according to actual requirements.
  • it may be predetermined which one or more influence factors are used to determine the second compression parameter set, or it may be based on at least one of the status information of the designated terminal and the size of the difference file.
  • the state information of the designated terminal may include the network connection status of the designated terminal, etc. For example, if the difference file is large, the second compression parameter set may be determined according to the compression ratio.
  • the digital signature of the first compressed file cannot be used to verify the fifth compressed file.
  • the fifth compressed file may be transmitted to the provider of the first compressed file, and the provider's second digital signature of the fifth compressed file may be obtained; or, according to the first compressed file
  • the private key provided by the provider of the file (such as the developer) generates the second digital signature of the fifth compressed file.
  • the obtaining the digital signature of the fifth compressed file includes:
  • the fifth compressed file is sent to a preset object, and the second digital signature returned by the preset object is received, where the preset object is an object that sets the first digital signature of the first compressed file.
  • the preset object may be an object that provides the first compressed file, for example, may be a developer of the first compressed file.
  • the preset object may use the key used to generate the first digital signature to generate the second digital signature, and return it to the execution of this application The terminal device of the embodiment.
  • the obtaining the digital signature of the fifth compressed file includes:
  • the second digital signature of the fifth compressed file is generated, the preset key is received in advance from the preset object, and the preset key is used to generate the first The key used for the digital signature.
  • the preset key may be sent in advance by the preset object to the terminal device that executes the embodiment of the present application. At this time, the terminal device executing the embodiment of the present application can conveniently generate the second digital signature of the fifth compressed file.
  • the step S101 may include the following steps:
  • A4. Obtain a difference file between the first file set and the second file set according to the first compressed file and the second compressed file.
  • the terminal device that executes this embodiment may be a device (such as a server or a specific mobile terminal, etc.) that can provide corresponding download resources.
  • the historical version information may be used to identify information about the version of the corresponding file, for example, may include version number, file name, and so on.
  • the object for performing the difference operation After receiving the download request of the designated terminal for the first compressed file, by acquiring the historical version information in the designated terminal, the object for performing the difference operation can be determined.
  • the mobile terminal can request the server to obtain the installation package of the new version through the application store.
  • the server can obtain the historical version information of the installation package of the old version in the designated terminal from the designated terminal, so that the server can obtain the same file as the installation package of the old version in the mobile terminal (that is, the first (2) compressed file) and the installation package of the new version required by the mobile terminal, so as to obtain the difference file according to the second compressed file and the first compressed file.
  • the detecting whether there is a first compression parameter set includes:
  • a compressed sub-file has corresponding identical parts in the first compressed file
  • the compressed part corresponding to the first file may be determined, and it is detected whether the compressed part is the same as the first compressed subfile of the first file.
  • the first compression corresponding to each first file may be determined separately. Parameters to improve the accuracy of detection.
  • the detecting whether there is a first compression parameter for any first file in the first file set includes:
  • the parallel mode may be implemented through different processing processes (or different threads).
  • the parameters included in a set of compression parameters to be verified may include one or more parameters involved in a compression process.
  • the set of compression parameters to be verified may include parameters for indicating a compression algorithm, The parameter indicating the encoding mode, the parameter indicating the degree of compression, and the parameter indicating the condition of the check field. Since the detection of each group of compression parameters to be verified is independent of each other, it is possible to detect whether the first compression parameter exists in the at least two groups of compression parameters to be verified in a parallel manner, thereby greatly improving the detection efficiency.
  • FIG. 3 it is a schematic diagram of an implementation process of detecting whether the first compression parameter set exists according to an embodiment of the present application.
  • a first file in the first file set includes new file 1, new file 2, new file 3, and so on.
  • the compression parameters to be verified include strategy, level, and nowrap, wherein the parameter indicating the encoding mode can be named strategy, and the value of strategy can be 0-4, where 0 means for common Data, 1 means data generated by the filter (or predictor), 2 means to force Huffman coding, 3 means to limit the matching length to 1, 4 means to prevent the use of dynamic Huffman coding.
  • the parameter used to indicate the degree of compression can be named level, and the level can have three values, where 0 means no compression, 1 means speed priority, compression degree higher than 0, 9 means compression priority, compression degree higher than 1, compression The speed is slower than 1.
  • the parameter used to indicate the condition of the check field can be named nowrap, and the nowrap can indicate whether to use the zlib check header, where the nowrap can have two values, 1 means not using the zlib check header and the check header.
  • Check field, 0 means to use zlib check header and check field.
  • the same method can be used for other files such as new file 2 and new file 3 in the first file set. It should be noted that the compression parameters to be verified corresponding to other files may be different from the new file 1 or may be the same. There is no limitation here.
  • the size of the first target compressed file is often smaller than that of the first compressed file directly.
  • the size of the file obtained by performing a difference operation between a compressed file and the second compressed file Therefore, in the subsequent information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced.
  • a third compressed file that is the same as the first compressed file can be obtained; in this case, the digital signature of the first compressed file can be used for the third compressed file Therefore, it is not necessary for the provider of the first compressed file to provide the digital signature of the third compressed file again, which improves the efficiency of information processing, shortens the time required for information processing, and improves the user experience .
  • the embodiment of the present application provides a file processing device, and the above-mentioned file processing device can be integrated in a terminal device.
  • the file processing device 4 in the embodiment of the present application includes:
  • the first processing module 401 is configured to obtain a difference file between a first file set and a second file set, wherein the first file set is obtained by decompressing the first compressed file, and the second file set is obtained by decompressing the second compressed file Obtained, the second compressed file is a historical version file of the first compressed file;
  • the first detection module 402 is configured to detect whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file.
  • the files are the same;
  • the second processing module 403 is configured to obtain the first digital signature of the first compressed file if the first compression parameter set exists;
  • the third processing module 404 is configured to obtain a first target compressed file containing first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information contains information about the first compression Information about the parameter set.
  • the sending module 405 is configured to send the first target compressed file to a designated terminal to instruct the designated terminal to obtain the restored first target file according to the first target compressed file and the fourth compressed file in the designated terminal A compressed file, wherein the fourth compressed file is the same as the second compressed file.
  • the file processing device 4 further includes:
  • the first determining module is configured to, if the first compression parameter set does not exist, determine a second compression parameter set according to the compression speed, compression rate, and/or similarity degree of compressed files, wherein the similarity degree of the compressed files is based on Degree of similarity between the fifth compressed file obtained by compressing the first file set by the second compression parameter set and the first compressed file;
  • a fourth processing module configured to compress the first file set according to the second compression parameter set to obtain a fifth compressed file
  • the first obtaining module is configured to obtain the second digital signature of the fifth compressed file
  • the fifth processing module is configured to obtain a second target compressed file containing second compression parameter information, the difference file, and the second digital signature, wherein the second compression parameter information includes the second compression parameter set Information.
  • the first obtaining module is specifically configured to:
  • the fifth compressed file is sent to a preset object, and the second digital signature returned by the preset object is received, where the preset object is an object that sets the first digital signature of the first compressed file.
  • the first obtaining module is specifically configured to:
  • the second digital signature of the fifth compressed file is generated, the preset key is received in advance from the preset object, and the preset key is used to generate the first The key used for the digital signature.
  • the first processing module 401 specifically includes:
  • the first obtaining unit is configured to obtain historical version information of the fourth compressed file in the specified terminal after receiving the download request of the first compressed file from the specified terminal;
  • the second obtaining unit is configured to obtain a second compressed file according to the historical version information
  • the third obtaining unit is used to obtain the first compressed file
  • the first processing unit is configured to obtain a difference file between the first file set and the second file set according to the first compressed file and the second compressed file.
  • the first digital signature in the first target compressed file is used to verify the restored first compressed file after the restored first compressed file is obtained.
  • the first set of compression parameters includes parameters used to indicate compression algorithms, parameters used to indicate encoding methods, parameters used to indicate compression levels, and parameters used to indicate check field conditions. At least one of the parameters.
  • the first detection module 402 specifically includes:
  • the first detection unit is configured to detect whether there is a first compression parameter for any first file in the first file set, and the first compression parameter is used to compress the first file to obtain the first file. Compress a sub-file, the first compressed sub-file has corresponding identical parts in the first compressed file;
  • the second detection unit is configured to traverse each first file in the first file set, and detect whether each first file has a corresponding first compression parameter, wherein the first compression parameter set includes each The first compression parameter.
  • the first detection unit specifically includes:
  • a determining subunit configured to determine at least two sets of compression parameters to be verified for any first file in the first file set
  • the detection subunit is configured to detect whether the first compression parameter exists in the at least two sets of compression parameters to be verified in a parallel manner.
  • the size of the first target compressed file is often smaller than that of the first compressed file directly.
  • the size of the file obtained by performing a difference operation between a compressed file and the second compressed file Therefore, in the subsequent information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced.
  • a third compressed file that is the same as the first compressed file can be obtained; at this time, the digital signature of the first compressed file can be used for the third compressed file Therefore, there is no need for the provider of the first compressed file to re-provide the digital signature of the third compressed file, which improves the efficiency of information processing, shortens the time required for information processing, and improves the user experience .
  • the embodiment of the present application provides a terminal device. Please refer to FIG. 5.
  • the terminal device in the embodiment of the present application includes: a memory 501, one or more processors 502 (only one is shown in FIG. 5) and stored in the memory 501 A computer program that can run on the processor.
  • the memory 501 is used to store software programs and modules
  • the processor 502 executes various functional applications and data processing by running the software programs and units stored in the memory 501 to obtain resources corresponding to the aforementioned preset events.
  • the processor 502 implements the steps in any of the above-mentioned file processing method embodiments when running the above-mentioned computer program stored in the memory 501.
  • the aforementioned terminal device may further include: one or more input devices 503 (only one is shown in FIG. 5) and one or more output devices 504 (only one is shown in FIG. 5).
  • the memory 501, the processor 502, the input device 503, and the output device 504 are connected by a bus 505.
  • the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors or digital signal processors (DSP). , Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the input device 503 may include a keyboard, a touch panel, a fingerprint sensor (used to collect user fingerprint information and fingerprint orientation information), a microphone, etc.
  • the output device 504 may include a display, a speaker, and the like.
  • the memory 501 may include a read-only memory and a random access memory, and provides instructions and data to the processor 502. A part or all of the memory 501 may also include a non-volatile random access memory. For example, the memory 501 may also store device type information.
  • the size of the first target compressed file is often smaller than that of the first compressed file directly.
  • the size of the file obtained by performing a difference operation between a compressed file and the second compressed file Therefore, in the subsequent information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced.
  • a third compressed file that is the same as the first compressed file can be obtained; in this case, the digital signature of the first compressed file can be used for the third compressed file Therefore, it is not necessary for the provider of the first compressed file to provide the digital signature of the third compressed file again, which improves the efficiency of information processing, shortens the time required for information processing, and improves the user experience .
  • the disclosed device and method may be implemented in other ways.
  • the system embodiment described above is only illustrative.
  • the division of the above-mentioned modules or units is only a logical function division.
  • there may be other division methods for example, multiple units or components may be combined. Or it can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the aforementioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through a computer program.
  • the above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program When executed by the processor, the steps of the foregoing method embodiments can be implemented.
  • the above-mentioned computer program includes computer program code, and the above-mentioned computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the above-mentioned computer-readable storage medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer readable memory, read-only memory (ROM, Read-Only Memory) ), Random Access Memory (RAM, Random Access Memory), electrical carrier signal, telecommunications signal, and software distribution media, etc.
  • the content contained in the above-mentioned computer-readable storage medium can be appropriately added or deleted according to the requirements of the legislation and patent practice in the jurisdiction.
  • the computer-readable storage The medium does not include electrical carrier signals and telecommunication signals.
  • the embodiments of the present application provide a computer program product.
  • the steps in the above-mentioned file processing method embodiments can be realized when the mobile terminal is executed.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

A file processing method disclosed in the present application comprises: obtaining a differential file between a first file set and a second file set, wherein the first file set is obtained by decompressing a first compressed file, and the second file set is obtained by decompressing a second compressed file, the second compressed file being a historical version file of the first compressed file; detecting whether a first compression parameter set exists, the first compression parameter set being used for compressing the first file set, and a third compressed file obtained by compression being the same as the first compressed file; if the first compression parameter set exists, obtaining a first digital signature of the first compressed file; obtaining a first target compressed file including first compression parameter information, the differential file, and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set; and sending the first target compressed file to a specified terminal.

Description

一种文件处理方法、文件处理装置及终端设备File processing method, file processing device and terminal equipment 技术领域Technical field
本申请属于信息处理技术领域,尤其涉及一种文件处理方法、文件处理装置、终端设备及计算机可读存储介质。This application belongs to the field of information processing technology, and in particular relates to a file processing method, a file processing device, a terminal device, and a computer-readable storage medium.
背景技术Background technique
当前,由于信息的更新速度较快,许多文件常常需要进行更新。例如,诸如移动终端、可穿戴设备等终端中安装的应用程序常常需要下载新版本的安装包来进行升级,或者,某一文件需要进行版本更新等等。因此,常常需要获取到新版本的文件,以进行更新。At present, due to the fast update speed of information, many files often need to be updated. For example, applications installed in terminals such as mobile terminals and wearable devices often need to download a new version of the installation package for upgrade, or a certain file needs to be version updated, and so on. Therefore, it is often necessary to obtain a new version of the file for updating.
发明内容Summary of the invention
本申请提供一种文件处理方法、文件处理装置、终端设备及计算机可读存储介质,可以在指定终端获取新版本的文件以进行更新时,减小相应的流量消耗。This application provides a file processing method, file processing device, terminal device, and computer-readable storage medium, which can reduce the corresponding traffic consumption when a designated terminal obtains a new version of a file for update.
本申请的第一方面提供了一种文件处理方法,包括:The first aspect of this application provides a file processing method, including:
获得第一文件集合与第二文件集合的差分文件,其中,所述第一文件集合通过解压第一压缩文件得到,所述第二文件集合通过解压第二压缩文件得到,所述第二压缩文件为所述第一压缩文件的历史版本文件;Obtain the difference file between the first file set and the second file set, wherein the first file set is obtained by decompressing the first compressed file, the second file set is obtained by decompressing the second compressed file, and the second compressed file Is a historical version file of the first compressed file;
检测是否存在第一压缩参数集合,所述第一压缩参数集合用于对所述第一文件集合进行压缩,且压缩得到的第三压缩文件与所述第一压缩文件相同;Detecting whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file;
若存在所述第一压缩参数集合,则获取所述第一压缩文件的第一数字签名;If the first compression parameter set exists, obtain the first digital signature of the first compressed file;
获得包含第一压缩参数信息、所述差分文件和所述第一数字签名的第一目标压缩文件,其中,所述第一压缩参数信息包含关于所述第一压缩参数集合的信息;Obtaining a first target compressed file that includes first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set;
将所述第一目标压缩文件发送至指定终端,以指示所述指定终端根据所述第一目标压缩文件和所述指定终端中的第四压缩文件,获得还原后的第一压缩文件,其中,所述第四压缩文件与所述第二压缩文件相同。The first target compressed file is sent to a designated terminal to instruct the designated terminal to obtain the restored first compressed file according to the first target compressed file and the fourth compressed file in the designated terminal, where: The fourth compressed file is the same as the second compressed file.
本申请的第二方面提供了一种文件处理装置,包括:The second aspect of the present application provides a file processing device, including:
第一处理模块,用于获得第一文件集合与第二文件集合的差分文件,其中,所述第一文件集合通过解压第一压缩文件得到,所述第二文件集合通过解压第二压缩文件得到,所述第二压缩文件为所述第一压缩文件的历史版本文件;The first processing module is configured to obtain the difference file between the first file set and the second file set, wherein the first file set is obtained by decompressing the first compressed file, and the second file set is obtained by decompressing the second compressed file , The second compressed file is a historical version file of the first compressed file;
第一检测模块,用于检测是否存在第一压缩参数集合,所述第一压缩参数集合用于对所述第一文件集合进行压缩,且压缩得到的第三压缩文件与所述第一压缩文件相同;The first detection module is configured to detect whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file the same;
第二处理模块,用于若存在所述第一压缩参数集合,则获取所述第一压缩文件的第一数字签名;A second processing module, configured to obtain the first digital signature of the first compressed file if the first compression parameter set exists;
第三处理模块,用于获得包含第一压缩参数信息、所述差分文件和所述第一数字签名 的第一目标压缩文件,其中,所述第一压缩参数信息包含关于所述第一压缩参数集合的信息。The third processing module is configured to obtain a first target compressed file containing first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information contains information about the first compression parameter Collection of information.
发送模块,用于将所述第一目标压缩文件发送至指定终端,以指示所述指定终端根据所述第一目标压缩文件和所述指定终端中的第四压缩文件,获得还原后的第一压缩文件,其中,所述第四压缩文件与所述第二压缩文件相同。The sending module is configured to send the first target compressed file to a designated terminal, so as to instruct the designated terminal to obtain the restored first compressed file according to the first target compressed file and the fourth compressed file in the designated terminal. A compressed file, wherein the fourth compressed file is the same as the second compressed file.
本申请的第三方面提供了一种终端设备,上述终端设备包括存储器、处理器以及存储在上述存储器中并可在上述处理器上运行的计算机程序,上述处理器执行上述计算机程序时实现如上第一方面的方法的步骤。The third aspect of the present application provides a terminal device. The terminal device includes a memory, a processor, and a computer program that is stored in the memory and can run on the processor. When the processor executes the computer program, the above-mentioned computer program is implemented. Steps of the method on the one hand.
本申请的第四方面提供了一种计算机可读存储介质,上述计算机可读存储介质存储有计算机程序,上述计算机程序被处理器执行时实现如上第一方面的方法的步骤。The fourth aspect of the present application provides a computer-readable storage medium, the above-mentioned computer-readable storage medium stores a computer program, and when the above-mentioned computer program is executed by a processor, the steps of the method of the above first aspect are realized.
本申请的第五方面提供了一种计算机程序产品,上述计算机程序产品包括计算机程序,上述计算机程序被一个或多个处理器执行时实现如上述第一方面的方法的步骤。The fifth aspect of the present application provides a computer program product. The computer program product includes a computer program, and the computer program is executed by one or more processors to implement the steps of the method of the first aspect.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only of the present application. For some embodiments, those of ordinary skill in the art can obtain other drawings based on these drawings without creative work.
图1是本申请实施例提供的文件处理方法的一种实现流程示意图;FIG. 1 is a schematic diagram of an implementation process of a file processing method provided by an embodiment of the present application;
图2是本申请实施例提供的文件处理方法的一种实现流程示意图;FIG. 2 is a schematic diagram of an implementation process of a file processing method provided by an embodiment of the present application;
图3是本申请实施例提供的检测是否存在第一压缩参数集合的一种实现流程示意图;FIG. 3 is a schematic diagram of an implementation process of detecting whether a first compression parameter set exists according to an embodiment of the present application;
图4是本申请实施例提供的文件处理装置的结构框图;Figure 4 is a structural block diagram of a file processing device provided by an embodiment of the present application;
图5是本申请实施例提供的终端设备的示意图。Fig. 5 is a schematic diagram of a terminal device provided by an embodiment of the present application.
具体实施方式Detailed ways
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are proposed for a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from obstructing the description of this application.
为了说明本申请上述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the above-mentioned technical solutions of the present application, specific embodiments are used for description below.
实施例1Example 1
下面对本申请实施例提供的一种文件处理方法进行描述。The following describes a file processing method provided by an embodiment of the present application.
如图1所示,为本申请实施例提供的文件处理方法的一种实现流程示意图。该文件处 理方法可以应用于终端设备。As shown in FIG. 1, it is a schematic diagram of an implementation flow of a file processing method provided by an embodiment of this application. This file processing method can be applied to terminal equipment.
其中,可以应用本申请实施例的所述终端设备的类型可以有多种。例如,所述终端设备可以是服务器、手机、平板电脑、可穿戴设备、车载设备、增强现实(Augmented Reality,AR)/虚拟现实(Virtual Reality,VR)设备、笔记本电脑、超级移动个人计算机(Ultra-mobile Personal Computer,UMPC)、上网本、个人数字助理(Personal Digital Assistant,PDA)等。本申请实施例对终端设备的具体类型不作任何限制。Among them, there may be multiple types of the terminal device to which the embodiments of the present application can be applied. For example, the terminal device may be a server, a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR)/virtual reality (VR) device, a notebook computer, an ultra mobile personal computer (Ultra -mobile Personal Computer, UMPC), netbook, personal digital assistant (Personal Digital Assistant, PDA), etc. The embodiments of the present application do not impose any restrictions on the specific types of terminal devices.
在一些场景中,一些终端中的文件常常会需要更新。例如移动终端中安装的应用程序常常需要下载新版本的安装包来进行升级,或者,某一文件需要进行版本更新等等。在一些情况下,当移动终端中的应用程序需要升级时,用户会通过移动终端中的浏览器、应用商店等途径,获取该应用程序的新版本的安装包。而为了减小用户的流量消耗,相应的服务器等设备往往会向移动终端传输该新版本的安装包相对于所述移动终端中的旧版本的安装包的增量包,该增量包往往是由对所述新版本的安装包和旧版本的安装包进行差分运算后得到。然而,由于安装包往往是压缩包,而未压缩的文件中即使很小的改动,在压缩之后得到的压缩文件的变化也会很大,导致获得的增量包本身的大小也还是很大。因此,终端即使是下载对应的增量包,所消耗的流量资源也还是很大。In some scenarios, files in some terminals often need to be updated. For example, an application program installed in a mobile terminal often needs to download a new version of the installation package for upgrade, or a certain file needs to be version updated, and so on. In some cases, when the application in the mobile terminal needs to be upgraded, the user will obtain the installation package of the new version of the application through the browser, application store, etc. in the mobile terminal. In order to reduce the user's traffic consumption, the corresponding server and other equipment will often transmit to the mobile terminal the incremental package of the new version of the installation package relative to the old version of the installation package in the mobile terminal, and the incremental package is often It is obtained by performing a difference operation on the installation package of the new version and the installation package of the old version. However, because the installation package is often a compressed package, and even a small change in the uncompressed file, the compressed file obtained after the compression will change greatly, resulting in the size of the incremental package itself is still large. Therefore, even if the terminal downloads the corresponding incremental package, the traffic resources consumed are still very large.
此外,对于其他的待更新的文件,也存在所要获取的新版本的文件对流量的消耗问题。In addition, for other files to be updated, there is also the problem of traffic consumption of the new version of the file to be obtained.
而本申请实施例中,通过执行文件处理方法,可以在指定终端获取新版本的文件以进行更新时,减小相应的流量消耗。However, in the embodiment of the present application, by executing the file processing method, when the designated terminal obtains a new version of the file for update, the corresponding traffic consumption can be reduced.
其中,本申请实施例中的文件处理方法包括:Among them, the file processing method in the embodiment of the present application includes:
在步骤101中,获得第一文件集合与第二文件集合的差分文件,其中,所述第一文件集合通过解压第一压缩文件得到,所述第二文件集合通过解压第二压缩文件得到,所述第二压缩文件为所述第一压缩文件的历史版本文件。In step 101, the difference file between the first file set and the second file set is obtained, wherein the first file set is obtained by decompressing the first compressed file, and the second file set is obtained by decompressing the second compressed file, so The second compressed file is a historical version file of the first compressed file.
本申请实施例中,所述差分文件为通过对所述第一文件集合和第二文件集合进行差分运算而得到,其中,具体的差分算法可以有多种,例如,所述差分算法可以是Bsdiff、Xdelta3等差分算法中的一种或多种。所述第一文件集合以及所述第二文件集合中所包含的文件的个数以及文件类型在此均不作限制。在一些实施例中,可以通过诸如版本号、文件名称等等信息来确定所述第二压缩文件为所述第一压缩文件的历史版本文件。In the embodiment of the present application, the difference file is obtained by performing a difference operation on the first file set and the second file set. Among them, there may be multiple specific difference algorithms. For example, the difference algorithm may be Bsdiff. One or more of the difference algorithms such as, Xdelta3, etc. The number and types of files contained in the first file set and the second file set are not limited herein. In some embodiments, it may be determined that the second compressed file is a historical version file of the first compressed file through information such as version number, file name, and so on.
所述差分文件的获取方式可以根据实际应用场景来确定,示例性的,所述差分文件可以是执行本申请实施例的终端设备通过特定的信息传输方式从其他终端获取到,也可以是所述终端设备在接收到其他终端发送的相关请求之后,根据该相关请求,获取第一文件集合与第二文件集合而得到的。The method for obtaining the difference file may be determined according to actual application scenarios. For example, the difference file may be obtained by a terminal device executing the embodiment of the present application from other terminals through a specific information transmission method, or the difference file may be After receiving a related request sent by another terminal, the terminal device obtains the first file set and the second file set according to the related request.
在步骤102中,检测是否存在第一压缩参数集合,所述第一压缩参数集合用于对所述第一文件集合进行压缩,且压缩得到的第三压缩文件与所述第一压缩文件相同。In step 102, it is detected whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file.
在一些实施例中,所述第一压缩文件的提供者(如开发者)往往不会提供所述第一压缩文件所对应的具体压缩参数、具体压缩算法等压缩信息。而在将所述第一压缩文件解压得到第一文件集合之后,再对第一文件集合进行压缩时,若获得的新的压缩文件与所述第一压缩文件存在差异,即使是1个bit的差异,也会在通过第一压缩文件的数字签名来对该新的压缩文件进行验证时,导致该新的压缩文件不合法。因此,本申请实施例中,可以通过检测得到第一压缩参数集合,对所述第一文件集合进行压缩,以获得与所述第一压缩文件相同的第三压缩文件,此时,可以将所述第一压缩文件的数字签名用于所述第三压缩文件的验证,从而可以不需要所述第一压缩文件的提供者重新提供所述第三压缩文件的数字签名,提高了处理效率。In some embodiments, the provider of the first compressed file (such as a developer) often does not provide compression information such as specific compression parameters and specific compression algorithms corresponding to the first compressed file. After decompressing the first compressed file to obtain the first file set, and then compressing the first file set, if the obtained new compressed file is different from the first compressed file, even if it is a 1-bit file The difference will also cause the new compressed file to be illegal when the new compressed file is verified through the digital signature of the first compressed file. Therefore, in the embodiment of the present application, the first set of compression parameters can be obtained through detection, and the first set of files can be compressed to obtain a third compressed file that is the same as the first compressed file. The digital signature of the first compressed file is used for verification of the third compressed file, so that the provider of the first compressed file does not need to provide the digital signature of the third compressed file again, which improves processing efficiency.
本申请实施例中,所述第一压缩参数集合可以包括一个或多个压缩参数,并且,在一些实施例中,所述第一压缩参数集合中还可以包括一个或多个第一压缩参数子集合,其中,每一个第一压缩参数子集合可以分别对应所述第一文件集合中一个文件,且每个第一压缩参数子集合所对应的文件互不相同。任一所述第一压缩参数子集合可以用于对对应的文件进行压缩,并且,每个第一压缩参数子集合之间可以存在差异,当然,也可以相同。其中,压缩参数可以根据具体的压缩算法、应用场景等情况来确定。In the embodiment of the present application, the first compression parameter set may include one or more compression parameters, and, in some embodiments, the first compression parameter set may also include one or more first compression parameters. A set, where each first compression parameter subset may correspond to one file in the first file set, and the files corresponding to each first compression parameter subset are different from each other. Any one of the first compression parameter subsets may be used to compress the corresponding file, and each first compression parameter subset may have differences, and of course, they may also be the same. Among them, the compression parameters can be determined according to specific compression algorithms, application scenarios and other conditions.
在一些实施例中,所述第一压缩参数集合可以包括用于指示压缩算法的参数、用于指示编码方式的参数、用于指示压缩程度的参数以及用于指示校验字段情况的参数中的至少一种。In some embodiments, the first set of compression parameters may include parameters used to indicate compression algorithms, parameters used to indicate encoding methods, parameters used to indicate compression levels, and parameters used to indicate conditions of check fields. At least one.
本申请实施例中,所述参数可以是预设的数字、文字、符号编号等等形式。各个参数之间可以相互独立,也可以存在关联。例如,由于不同的压缩算法所对应的具体参数可能存在差异,因此,用于指示不同的压缩算法的参数,所对应的用于指示编码方式的参数以及用于指示压缩程度的参数可以不同。In the embodiment of the present application, the parameter may be a preset number, text, symbol number, and so on. The parameters can be independent of each other, or they can be related. For example, since the specific parameters corresponding to different compression algorithms may be different, the parameters used to indicate different compression algorithms, the corresponding parameters used to indicate the encoding mode and the parameters used to indicate the degree of compression may be different.
下面以一个具体示例来说明。Let's take a specific example to illustrate.
示例性的,在一种应用场景中,检测的压缩算法确定为Deflate压缩算法,那么,在检测是否存在第一压缩参数集合时,可以对所述Deflate压缩算法中的用于指示编码方式的参数、用于指示压缩程度的参数以及用于指示校验字段情况的参数进行检测,以确定是否存在第一压缩参数集合。Exemplarily, in an application scenario, the detected compression algorithm is determined to be the Deflate compression algorithm. Then, when detecting whether there is a first compression parameter set, the parameters used to indicate the encoding mode in the Deflate compression algorithm may be adjusted , The parameter used to indicate the degree of compression and the parameter used to indicate the condition of the check field are detected to determine whether there is a first set of compression parameters.
其中,检测的压缩算法确定为Deflate压缩算法,那么,在检测是否存在第一压缩参数集合时,所检测的参数可以包括strategy、level和nowrap。具体的,所述指示编码方式的参数可以命名为strategy,所述strategy的取值可以有0-4,其中,0表示用于普通 数据,1表示用于由滤波器filter(或者称为预测器predictor)生成的数据,2表示用于强制哈夫曼编码,3表示限制匹配长度为1,4表示阻止使用动态哈夫曼编码。所述用于指示压缩程度的参数可以命名为level,所述level可以有三个值,其中0表示不压缩,1表示速度优先压缩程度高于0,9表示压缩优先,压缩程度高于1,压缩速度慢于1。所述用于指示校验字段情况的参数可以命名为nowrap,所述nowrap可以表示是否使用zlib的校验头,其中,所述nowrap可以有两个值,1表示不使用zlib校验头和校验字段,0表示使用zlib校验头和校验字段。所述strategy、所述level和所述nowrap还可以通过其他取值来表示其他含义。Wherein, the detected compression algorithm is determined to be the Deflate compression algorithm. Then, when detecting whether the first compression parameter set exists, the detected parameters may include strategy, level, and nowrap. Specifically, the parameter indicating the encoding mode can be named strategy, and the value of the strategy can be 0-4, where 0 means for ordinary data, and 1 means for filter (or called predictor). predictor), 2 indicates that it is used to force Huffman coding, 3 indicates that the matching length is restricted to 1, and 4 indicates that the use of dynamic Huffman coding is prevented. The parameter used to indicate the degree of compression can be named level, and the level can have three values, where 0 means no compression, 1 means speed priority, compression degree higher than 0, 9 means compression priority, compression degree higher than 1, compression The speed is slower than 1. The parameter used to indicate the condition of the check field can be named nowrap, and the nowrap can indicate whether to use the zlib check header, where the nowrap can have two values, 1 means not using the zlib check header and the check header. Check field, 0 means to use zlib check header and check field. The strategy, the level, and the nowrap may also use other values to represent other meanings.
在步骤103中,若存在所述第一压缩参数集合,则获取所述第一压缩文件的第一数字签名。In step 103, if the first compression parameter set exists, the first digital signature of the first compressed file is obtained.
本申请实施例中,若存在第一压缩参数集合,则可以对所述第一文件集合进行压缩,以获得与所述第一压缩文件相同的第三压缩文件。此时,可以将所述第一压缩文件的数字签名用于所述第三压缩文件的验证,从而可以不需要所述第一压缩文件的提供者重新提供所述第三压缩文件的数字签名。In the embodiment of the present application, if there is a first compression parameter set, the first file set may be compressed to obtain a third compressed file that is the same as the first compressed file. At this time, the digital signature of the first compressed file may be used for verification of the third compressed file, so that the provider of the first compressed file may not need to provide the digital signature of the third compressed file again.
本申请实施例中,一般情况下,所述第一压缩文件的第一数字签名包含在所述第一压缩文件中,因此,所述第一数字签名可以直接从所述第一压缩文件中提取得到。当然,也可以是根据所述第一压缩文件的提供者(如开发者)所提供的私钥,生成所述第一压缩文件的第一数字签名。In the embodiments of the present application, generally, the first digital signature of the first compressed file is included in the first compressed file. Therefore, the first digital signature can be directly extracted from the first compressed file get. Of course, the first digital signature of the first compressed file can also be generated according to the private key provided by the provider (such as the developer) of the first compressed file.
在步骤104中,获得包含第一压缩参数信息、所述差分文件和所述第一数字签名的第一目标压缩文件,其中,所述第一压缩参数信息包含关于所述第一压缩参数集合的信息。In step 104, a first target compressed file containing first compression parameter information, the difference file, and the first digital signature is obtained, wherein the first compression parameter information contains information about the first compression parameter set information.
本申请实施例中,所述第一目标压缩文件中,所述第一压缩参数信息、所述差分文件和所述第一数字签名的存在形式可以有多种。示例性的,可以生成包含所述第一压缩参数集合的信息的第一文件,以及生成包含所述第一数字签名的信息的第二文件,并生成包含差分文件以及所述第一文件、第二文件的目标压缩文件。或者,也可以将所述第一压缩参数信息和/或第一数字签名添加在所述差分文件中,例如添加在所述差分文件的结束位置之后,并通过相应的标志标识所添加的所述第一压缩参数信息和/或第一数字签名。In the embodiment of the present application, in the first target compressed file, the first compression parameter information, the difference file, and the first digital signature may exist in multiple forms. Exemplarily, a first file containing the information of the first compression parameter set can be generated, and a second file containing the information of the first digital signature can be generated, and a difference file and the first file, the first file and the second file can be generated. The target compressed file of the second file. Alternatively, the first compression parameter information and/or the first digital signature may also be added to the difference file, for example, after the end position of the difference file, and the added information may be identified by a corresponding mark. The first compression parameter information and/or the first digital signature.
在步骤105中,将所述第一目标压缩文件发送至指定终端,以指示所述指定终端根据所述第一目标压缩文件和所述指定终端中的第四压缩文件,获得还原后的第一压缩文件,其中,所述第四压缩文件与所述第二压缩文件相同。In step 105, the first target compressed file is sent to a designated terminal to instruct the designated terminal to obtain the restored first target file according to the first target compressed file and the fourth compressed file in the designated terminal. A compressed file, wherein the fourth compressed file is the same as the second compressed file.
本申请实施例中,所述指定终端的类型可以有多种,例如,所述指定终端可以是手机、平板电脑、可穿戴设备、车载设备、服务器、增强现实(Augmented Reality,AR)/虚拟现实(Virtual Reality,VR)设备、笔记本电脑等等。In the embodiment of the present application, there may be multiple types of the designated terminal. For example, the designated terminal may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, a server, or augmented reality (AR)/virtual reality. (Virtual Reality, VR) equipment, laptops, etc.
其中,由于所述差分文件为对所述第一压缩文件和第二压缩文件解压后获得的,此时,第一目标压缩文件的大小往往要小于直接将所述第一压缩文件和所述第二压缩文件进行差分运算所获得的文件的大小,因此,在信息传输中,可以大大减小相关用户的流量消耗,减小传输时间。Wherein, since the difference file is obtained after decompressing the first compressed file and the second compressed file, at this time, the size of the first target compressed file is often smaller than directly combining the first compressed file and the second compressed file. Second, the compressed file is the size of the file obtained by performing the differential operation. Therefore, in the information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced.
在一些实施例中,所述第一目标压缩文件中的第一数字签名用于在获得还原后的第一压缩文件之后,对所述还原后的第一压缩文件进行验证。In some embodiments, the first digital signature in the first target compressed file is used to verify the restored first compressed file after the restored first compressed file is obtained.
具体的,在一些实施例中,将所述第一目标压缩文件发送至指定终端之后,可以获取所述指定终端中的所述第四压缩文件的解压后的第三文件集合,并将第一目标压缩文件中的差分文件可以与所述第三文件集合进行合成,使得所述指定终端可以获得还原后的第一文件集合,再根据所述第一压缩参数信息,获取到还原后的第一压缩文件,从而可以通过所述第一数字签名对还原后的所述第一压缩文件进行验证,从而使得所述指定终端可以使用所述第一压缩文件,执行相应的功能,进行安装、读取等等。Specifically, in some embodiments, after the first target compressed file is sent to a designated terminal, the decompressed third file set of the fourth compressed file in the designated terminal may be obtained, and the first The difference file in the target compressed file can be synthesized with the third file set, so that the designated terminal can obtain the restored first file set, and then obtain the restored first file set according to the first compression parameter information. Compress the file, so that the restored first compressed file can be verified through the first digital signature, so that the designated terminal can use the first compressed file to perform corresponding functions, install and read and many more.
如图2所示,可选的,在一些实施例中,所述文件处理方法还可以包括以下步骤:As shown in FIG. 2, optionally, in some embodiments, the file processing method may further include the following steps:
步骤201,若不存在所述第一压缩参数集合,则根据压缩速度、压缩率和/或压缩文件相似程度,确定第二压缩参数集合,其中,所述压缩文件相似程度为根据所述第二压缩参数集合对所述第一文件集合进行压缩所得到的第五压缩文件与所述第一压缩文件的相似程度;Step 201: If the first compression parameter set does not exist, determine a second compression parameter set according to the compression speed, compression ratio, and/or similarity of compressed files, where the similarity of the compressed files is based on the second The degree of similarity between the fifth compressed file obtained by compressing the first file set by the compression parameter set and the first compressed file;
步骤202,根据所述第二压缩参数集合,对所述第一文件集合进行压缩,获得第五压缩文件;Step 202: Compress the first file set according to the second compression parameter set to obtain a fifth compressed file;
步骤203,获取所述第五压缩文件的第二数字签名;Step 203: Obtain a second digital signature of the fifth compressed file;
步骤204,获得包含第二压缩参数信息、所述差分文件和所述第二数字签名的第二目标压缩文件,其中,所述第二压缩参数信息包含所述第二压缩参数集合的信息。Step 204: Obtain a second target compressed file that includes second compression parameter information, the difference file, and the second digital signature, where the second compression parameter information includes information of the second compression parameter set.
本申请实施例中,所述压缩速度、压缩率和/或压缩文件相似程度可以认为是影响所述第二压缩参数集合的确定的影响因子,所述影响因子的选择可以根据实际需求来确定。示例性的,可以是预先确定是哪一个或多个影响因子来确定所述第二压缩参数集合,也可以根据所述指定终端的状态信息以及所述差分文件的大小等信息中的至少一个,来确定是哪一个或多个影响因子来确定所述第二压缩参数集合,其中,所述指定终端的状态信息可以包括所述指定终端的网络连接情况等。例如,若所述差分文件较大,则可以根据压缩率确定所述第二压缩参数集合。In the embodiment of the present application, the compression speed, compression ratio, and/or similarity of compressed files may be considered as an influencing factor that affects the determination of the second compression parameter set, and the selection of the influencing factor may be determined according to actual requirements. Exemplarily, it may be predetermined which one or more influence factors are used to determine the second compression parameter set, or it may be based on at least one of the status information of the designated terminal and the size of the difference file. To determine which one or more influencing factors are used to determine the second compression parameter set, wherein the state information of the designated terminal may include the network connection status of the designated terminal, etc. For example, if the difference file is large, the second compression parameter set may be determined according to the compression ratio.
本申请实施例中,由于所述第五压缩文件与所述第一压缩文件不同,因此,所述第一压缩文件的数字签名不能用于验证所述第五压缩文件。具体的,可以通过将所述第五压缩 文件传输给所述第一压缩文件的提供者,并获取该提供者对该第五压缩文件的第二数字签名;或者,也根据所述第一压缩文件的提供者(如开发者)所提供的私钥,生成所述第五压缩文件的第二数字签名。In the embodiment of the present application, because the fifth compressed file is different from the first compressed file, the digital signature of the first compressed file cannot be used to verify the fifth compressed file. Specifically, the fifth compressed file may be transmitted to the provider of the first compressed file, and the provider's second digital signature of the fifth compressed file may be obtained; or, according to the first compressed file The private key provided by the provider of the file (such as the developer) generates the second digital signature of the fifth compressed file.
在一些实施例中,所述获取所述第五压缩文件的数字签名,包括:In some embodiments, the obtaining the digital signature of the fifth compressed file includes:
将所述第五压缩文件发送给预设对象,并接收所述预设对象返回的第二数字签名,其中,所述预设对象为设置所述第一压缩文件的第一数字签名的对象。The fifth compressed file is sent to a preset object, and the second digital signature returned by the preset object is received, where the preset object is an object that sets the first digital signature of the first compressed file.
本申请实施例中,所述预设对象可以为提供所述第一压缩文件的对象,例如,可以是所述第一压缩文件的开发者。示例性的,所述预设对象在接收到所述第五压缩文件之后,可以利用生成所述第一数字签名所采用的密钥,来生成所述第二数字签名,并返回给执行本申请实施例的终端设备。In the embodiment of the present application, the preset object may be an object that provides the first compressed file, for example, may be a developer of the first compressed file. Exemplarily, after receiving the fifth compressed file, the preset object may use the key used to generate the first digital signature to generate the second digital signature, and return it to the execution of this application The terminal device of the embodiment.
在一些实施例中,所述获取所述第五压缩文件的数字签名,包括:In some embodiments, the obtaining the digital signature of the fifth compressed file includes:
根据预设密钥,生成所述第五压缩文件的第二数字签名,所述预设密钥为预先从所述预设对象接收到,并且,所述预设密钥为生成所述第一数字签名所采用的密钥。According to a preset key, the second digital signature of the fifth compressed file is generated, the preset key is received in advance from the preset object, and the preset key is used to generate the first The key used for the digital signature.
本申请实施例中,所述预设密钥可以是所述预设对象预先发送给执行本申请实施例的终端设备的。此时,执行本申请实施例的终端设备可以方便地生成所述第五压缩文件的第二数字签名。In the embodiment of the present application, the preset key may be sent in advance by the preset object to the terminal device that executes the embodiment of the present application. At this time, the terminal device executing the embodiment of the present application can conveniently generate the second digital signature of the fifth compressed file.
可选的,在一些实施例中,所述步骤S101可以包括以下步骤:Optionally, in some embodiments, the step S101 may include the following steps:
A1、在接收到指定终端对第一压缩文件的下载请求之后,获取所述指定终端中的第四压缩文件的历史版本信息;A1. After receiving the download request of the first compressed file from the designated terminal, obtain historical version information of the fourth compressed file in the designated terminal;
A2、根据所述历史版本信息,获取第二压缩文件;A2. Obtain a second compressed file according to the historical version information;
A3、获取第一压缩文件;A3. Obtain the first compressed file;
A4、根据所述第一压缩文件和所述第二压缩文件,获得第一文件集合与第二文件集合的差分文件。A4. Obtain a difference file between the first file set and the second file set according to the first compressed file and the second compressed file.
其中,执行该实施例的终端设备可以是能够提供相应的下载资源的设备(如服务器或者特定移动终端等)。所述历史版本信息可以用于标识相应文件的版本的信息,例如,可以包括版本号、文件名称等等。Wherein, the terminal device that executes this embodiment may be a device (such as a server or a specific mobile terminal, etc.) that can provide corresponding download resources. The historical version information may be used to identify information about the version of the corresponding file, for example, may include version number, file name, and so on.
在接收到所述指定终端对第一压缩文件的下载请求之后,通过获取所述指定终端中的历史版本信息,可以确定进行差分运算的对象。After receiving the download request of the designated terminal for the first compressed file, by acquiring the historical version information in the designated terminal, the object for performing the difference operation can be determined.
示例性的,在一些应用场景中,可以是用户需要更新移动终端中的应用程序,从而需要获得该应用程序的新版本的安装包(即第一压缩文件),而所述移动终端中可能包含旧版本的安装包(即第四压缩文件),因此,所述移动终端可以通过应用商店向服务器请求 获取新版本的安装包。而服务器可以向所述指定终端获取所述指定终端中的旧版本的安装包的历史版本信息,从而在所述服务器中,获取到与移动终端中的旧版本的安装包相同的文件(即第二压缩文件)以及所述移动终端所需的新版本的安装包,从而根据所述第二压缩文件和所述第一压缩文件,获得所述差分文件。Exemplarily, in some application scenarios, it may be that the user needs to update the application in the mobile terminal, and thus needs to obtain the installation package of the new version of the application (that is, the first compressed file), and the mobile terminal may contain The installation package of the old version (that is, the fourth compressed file), therefore, the mobile terminal can request the server to obtain the installation package of the new version through the application store. The server can obtain the historical version information of the installation package of the old version in the designated terminal from the designated terminal, so that the server can obtain the same file as the installation package of the old version in the mobile terminal (that is, the first (2) compressed file) and the installation package of the new version required by the mobile terminal, so as to obtain the difference file according to the second compressed file and the first compressed file.
可选的,在一些实施例中,所述检测是否存在第一压缩参数集合,包括:Optionally, in some embodiments, the detecting whether there is a first compression parameter set includes:
对于所述第一文件集合中的任一第一文件,检测是否存在第一压缩参数,所述第一压缩参数用于对所述第一文件进行压缩,得到第一压缩子文件,所述第一压缩子文件在所述第一压缩文件中存在相应的相同部分;For any first file in the first file set, it is detected whether there is a first compression parameter, and the first compression parameter is used to compress the first file to obtain a first compressed subfile. A compressed sub-file has corresponding identical parts in the first compressed file;
遍历所述第一文件集合中的各个第一文件,检测各个所述第一文件是否分别存在对应的第一压缩参数,其中,所述第一压缩参数集合包括各个所述第一压缩参数。Traverse each first file in the first file set to detect whether each first file has a corresponding first compression parameter, where the first compression parameter set includes each of the first compression parameters.
本申请实施例中,可以在所述第一压缩文件中,确定与所述第一文件相对应的压缩部分,并检测所述压缩部分是否与所述第一文件的第一压缩子文件相同。当然,也可以直接比对所述第一压缩子文件与所述第一压缩文件,以确定所述第一压缩子文件在所述第一压缩文件中存在相应的相同部分。In the embodiment of the present application, in the first compressed file, the compressed part corresponding to the first file may be determined, and it is detected whether the compressed part is the same as the first compressed subfile of the first file. Of course, it is also possible to directly compare the first compressed subfile with the first compressed file to determine that the first compressed subfile has a corresponding same part in the first compressed file.
在一些情况下,由于第一文件集合中,各个第一文件的类型可能不同,而对于不同类型的文件的压缩方式可能存在差异,因此,可以分别确定每一个第一文件所对应的第一压缩参数,以提高检测的准确性。In some cases, since the types of the first files in the first file set may be different, and the compression methods for different types of files may be different, the first compression corresponding to each first file may be determined separately. Parameters to improve the accuracy of detection.
在一些实施例中,所述对于所述第一文件集合中的任一第一文件,检测是否存在第一压缩参数,包括:In some embodiments, the detecting whether there is a first compression parameter for any first file in the first file set includes:
对于所述第一文件集合中的任一第一文件,确定至少两组待验证压缩参数;For any first file in the first file set, determine at least two sets of compression parameters to be verified;
通过并行方式,检测所述至少两组待验证压缩参数中,是否存在第一压缩参数。In a parallel manner, it is detected whether there is a first compression parameter in the at least two sets of compression parameters to be verified.
本申请实施例中,所述并行方式可以是通过不同处理进程(或者说不同的线程)来实现。一般的,一组待验证压缩参数中所包含的参数可以包括一次压缩过程所涉及的一个或多个参数,例如,所述一组待验证压缩参数可以包括用于指示压缩算法的参数、用于指示编码方式的参数、用于指示压缩程度的参数以及用于指示校验字段情况的参数。由于对各组待验证压缩参数的检测是相互独立的,因此,可以通过并行方式,检测所述至少两组待验证压缩参数中,是否存在第一压缩参数,从而可以大大提高检测效率。In the embodiment of the present application, the parallel mode may be implemented through different processing processes (or different threads). Generally, the parameters included in a set of compression parameters to be verified may include one or more parameters involved in a compression process. For example, the set of compression parameters to be verified may include parameters for indicating a compression algorithm, The parameter indicating the encoding mode, the parameter indicating the degree of compression, and the parameter indicating the condition of the check field. Since the detection of each group of compression parameters to be verified is independent of each other, it is possible to detect whether the first compression parameter exists in the at least two groups of compression parameters to be verified in a parallel manner, thereby greatly improving the detection efficiency.
下面以一个具体示例说明本申请实施例在一个具体应用场景中的应用。The following uses a specific example to illustrate the application of the embodiment of the present application in a specific application scenario.
如图3所示,是本申请实施例提供的检测是否存在第一压缩参数集合的一种实现流程示意图。As shown in FIG. 3, it is a schematic diagram of an implementation process of detecting whether the first compression parameter set exists according to an embodiment of the present application.
其中,所述第一文件集合中的一个第一文件包括新文件1、新文件2和新文件3等等。 其中,对于新文件1,确定新文件1所对应的多组待验证压缩参数。其中,所述待验证压缩参数包括strategy、level和nowrap,其中,所述所述指示编码方式的参数可以命名为strategy,所述strategy的取值可以有0-4,其中,0表示用于普通数据,1表示用于由滤波器filter(或者称为预测器predictor)生成的数据,2表示用于强制哈夫曼编码,3表示限制匹配长度为1,4表示阻止使用动态哈夫曼编码。所述用于指示压缩程度的参数可以命名为level,所述level可以有三个值,其中0表示不压缩,1表示速度优先压缩程度高于0,9表示压缩优先,压缩程度高于1,压缩速度慢于1。所述用于指示校验字段情况的参数可以命名为nowrap,所述nowrap可以表示是否使用zlib的校验头,其中,所述nowrap可以有两个值,1表示不使用zlib校验头和校验字段,0表示使用zlib校验头和校验字段。Wherein, a first file in the first file set includes new file 1, new file 2, new file 3, and so on. Among them, for the new file 1, multiple sets of compression parameters to be verified corresponding to the new file 1 are determined. Wherein, the compression parameters to be verified include strategy, level, and nowrap, wherein the parameter indicating the encoding mode can be named strategy, and the value of strategy can be 0-4, where 0 means for common Data, 1 means data generated by the filter (or predictor), 2 means to force Huffman coding, 3 means to limit the matching length to 1, 4 means to prevent the use of dynamic Huffman coding. The parameter used to indicate the degree of compression can be named level, and the level can have three values, where 0 means no compression, 1 means speed priority, compression degree higher than 0, 9 means compression priority, compression degree higher than 1, compression The speed is slower than 1. The parameter used to indicate the condition of the check field can be named nowrap, and the nowrap can indicate whether to use the zlib check header, where the nowrap can have two values, 1 means not using the zlib check header and the check header. Check field, 0 means to use zlib check header and check field.
此时,可以分别设置确定各组待验证压缩参数中的strategy、level和nowrap的取值,由于所述strategy的取值有5种,所述所述level的取值有3种,所述nowrap的取值有2种,则所述待验证压缩参数可以有5*3*2=30种,此时,可以通过30个线程,分别检测通过各组待验证压缩参数对所述第一文件进行压缩所得到的待验证压缩子文件在所述第一压缩文件中存在相应的相同部分;若存在一个待验证压缩子文件在所述第一压缩文件中存在相应的相同部分,则该待验证压缩子文件所对应的待验证压缩参数为该第一文件的第一压缩参数。At this time, you can set and determine the values of strategy, level, and nowrap in each group of compression parameters to be verified. Since there are five values for the strategy and three values for the level, the nowrap There are two values for the compression parameters to be verified, and there can be 5*3*2=30 kinds of compression parameters. At this time, 30 threads can be used to separately detect the compression parameters to be verified on the first file. The compressed subfile to be verified obtained by compression has a corresponding identical part in the first compressed file; if there is a compressed subfile to be verified that has a corresponding identical part in the first compressed file, the compressed subfile to be verified is compressed The compression parameter to be verified corresponding to the subfile is the first compression parameter of the first file.
同样的方式,可以用于所述第一文件集合中的新文件2和新文件3等等其他文件。需要说明的是,其他文件所分别对应的待验证压缩参数可以与所述新文件1不同,也可以相同。在此不做限定。The same method can be used for other files such as new file 2 and new file 3 in the first file set. It should be noted that the compression parameters to be verified corresponding to other files may be different from the new file 1 or may be the same. There is no limitation here.
由上可见,本申请方案中,由于所述差分文件为对所述第一压缩文件和第二压缩文件解压后获得的,此时,第一目标压缩文件的大小往往要小于直接将所述第一压缩文件和所述第二压缩文件进行差分运算所获得的文件的大小,因此,在后续的信息传输中,可以大大减小相关用户的流量消耗,减小传输时间。此外,通过检测所述第一压缩参数集合,可以获得与所述第一压缩文件相同的第三压缩文件;此时,可以将所述第一压缩文件的数字签名用于所述第三压缩文件的验证,从而可以不需要所述第一压缩文件的提供者重新提供所述第三压缩文件的数字签名,提高了信息处理的效率,缩短了信息处理所需的时长,从而提升了用户的体验。It can be seen from the above that in the solution of the present application, since the difference file is obtained after decompressing the first compressed file and the second compressed file, at this time, the size of the first target compressed file is often smaller than that of the first compressed file directly. The size of the file obtained by performing a difference operation between a compressed file and the second compressed file. Therefore, in the subsequent information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced. In addition, by detecting the first compression parameter set, a third compressed file that is the same as the first compressed file can be obtained; in this case, the digital signature of the first compressed file can be used for the third compressed file Therefore, it is not necessary for the provider of the first compressed file to provide the digital signature of the third compressed file again, which improves the efficiency of information processing, shortens the time required for information processing, and improves the user experience .
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence number of each step in the foregoing embodiment does not mean the order of execution. The execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
实施例2Example 2
本申请实施例提供了一种文件处理装置,上述文件处理装置可集成于终端设备中,如图4所示,本申请实施例中的文件处理装置4包括:The embodiment of the present application provides a file processing device, and the above-mentioned file processing device can be integrated in a terminal device. As shown in FIG. 4, the file processing device 4 in the embodiment of the present application includes:
第一处理模块401,用于获得第一文件集合与第二文件集合的差分文件,其中,所述第一文件集合通过解压第一压缩文件得到,所述第二文件集合通过解压第二压缩文件得到,所述第二压缩文件为所述第一压缩文件的历史版本文件;The first processing module 401 is configured to obtain a difference file between a first file set and a second file set, wherein the first file set is obtained by decompressing the first compressed file, and the second file set is obtained by decompressing the second compressed file Obtained, the second compressed file is a historical version file of the first compressed file;
第一检测模块402,用于检测是否存在第一压缩参数集合,所述第一压缩参数集合用于对所述第一文件集合进行压缩,且压缩得到的第三压缩文件与所述第一压缩文件相同;The first detection module 402 is configured to detect whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file. The files are the same;
第二处理模块403,用于若存在所述第一压缩参数集合,则获取所述第一压缩文件的第一数字签名;The second processing module 403 is configured to obtain the first digital signature of the first compressed file if the first compression parameter set exists;
第三处理模块404,用于获得包含第一压缩参数信息、所述差分文件和所述第一数字签名的第一目标压缩文件,其中,所述第一压缩参数信息包含关于所述第一压缩参数集合的信息。The third processing module 404 is configured to obtain a first target compressed file containing first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information contains information about the first compression Information about the parameter set.
发送模块405,用于将所述第一目标压缩文件发送至指定终端,以指示所述指定终端根据所述第一目标压缩文件和所述指定终端中的第四压缩文件,获得还原后的第一压缩文件,其中,所述第四压缩文件与所述第二压缩文件相同。The sending module 405 is configured to send the first target compressed file to a designated terminal to instruct the designated terminal to obtain the restored first target file according to the first target compressed file and the fourth compressed file in the designated terminal A compressed file, wherein the fourth compressed file is the same as the second compressed file.
可选的,所述文件处理装置4还包括:Optionally, the file processing device 4 further includes:
第一确定模块,用于若不存在所述第一压缩参数集合,则根据压缩速度、压缩率和/或压缩文件相似程度,确定第二压缩参数集合,其中,所述压缩文件相似程度为根据所述第二压缩参数集合对所述第一文件集合进行压缩所得到的第五压缩文件与所述第一压缩文件的相似程度;The first determining module is configured to, if the first compression parameter set does not exist, determine a second compression parameter set according to the compression speed, compression rate, and/or similarity degree of compressed files, wherein the similarity degree of the compressed files is based on Degree of similarity between the fifth compressed file obtained by compressing the first file set by the second compression parameter set and the first compressed file;
第四处理模块,用于根据所述第二压缩参数集合,对所述第一文件集合进行压缩,获得第五压缩文件;A fourth processing module, configured to compress the first file set according to the second compression parameter set to obtain a fifth compressed file;
第一获取模块,用于获取所述第五压缩文件的第二数字签名;The first obtaining module is configured to obtain the second digital signature of the fifth compressed file;
第五处理模块,用于获得包含第二压缩参数信息、所述差分文件和所述第二数字签名的第二目标压缩文件,其中,所述第二压缩参数信息包含所述第二压缩参数集合的信息。The fifth processing module is configured to obtain a second target compressed file containing second compression parameter information, the difference file, and the second digital signature, wherein the second compression parameter information includes the second compression parameter set Information.
可选的,所述第一获取模块具体用于:Optionally, the first obtaining module is specifically configured to:
将所述第五压缩文件发送给预设对象,并接收所述预设对象返回的第二数字签名,其中,所述预设对象为设置所述第一压缩文件的第一数字签名的对象。The fifth compressed file is sent to a preset object, and the second digital signature returned by the preset object is received, where the preset object is an object that sets the first digital signature of the first compressed file.
可选的,所述第一获取模块具体用于:Optionally, the first obtaining module is specifically configured to:
根据预设密钥,生成所述第五压缩文件的第二数字签名,所述预设密钥为预先从所述 预设对象接收到,并且,所述预设密钥为生成所述第一数字签名所采用的密钥。According to a preset key, the second digital signature of the fifth compressed file is generated, the preset key is received in advance from the preset object, and the preset key is used to generate the first The key used for the digital signature.
可选的,所述第一处理模块401具体包括:Optionally, the first processing module 401 specifically includes:
第一获取单元,用于在接收到指定终端对第一压缩文件的下载请求之后,获取所述指定终端中的第四压缩文件的历史版本信息;The first obtaining unit is configured to obtain historical version information of the fourth compressed file in the specified terminal after receiving the download request of the first compressed file from the specified terminal;
第二获取单元,用于根据所述历史版本信息,获取第二压缩文件;The second obtaining unit is configured to obtain a second compressed file according to the historical version information;
第三获取单元,用于获取第一压缩文件;The third obtaining unit is used to obtain the first compressed file;
第一处理单元,用于根据所述第一压缩文件和所述第二压缩文件,获得第一文件集合与第二文件集合的差分文件。The first processing unit is configured to obtain a difference file between the first file set and the second file set according to the first compressed file and the second compressed file.
可选的,本申请实施例中,所述第一目标压缩文件中的第一数字签名用于在获得还原后的第一压缩文件之后,对所述还原后的第一压缩文件进行验证。Optionally, in this embodiment of the present application, the first digital signature in the first target compressed file is used to verify the restored first compressed file after the restored first compressed file is obtained.
可选的,本申请实施例中,所述第一压缩参数集合包括用于指示压缩算法的参数、用于指示编码方式的参数、用于指示压缩程度的参数以及用于指示校验字段情况的参数中的至少一种。Optionally, in this embodiment of the application, the first set of compression parameters includes parameters used to indicate compression algorithms, parameters used to indicate encoding methods, parameters used to indicate compression levels, and parameters used to indicate check field conditions. At least one of the parameters.
可选的,所述第一检测模块402具体包括:Optionally, the first detection module 402 specifically includes:
第一检测单元,用于对于所述第一文件集合中的任一第一文件,检测是否存在第一压缩参数,所述第一压缩参数用于对所述第一文件进行压缩,得到第一压缩子文件,所述第一压缩子文件在所述第一压缩文件中存在相应的相同部分;The first detection unit is configured to detect whether there is a first compression parameter for any first file in the first file set, and the first compression parameter is used to compress the first file to obtain the first file. Compress a sub-file, the first compressed sub-file has corresponding identical parts in the first compressed file;
第二检测单元,用于遍历所述第一文件集合中的各个第一文件,检测各个所述第一文件是否分别存在对应的第一压缩参数,其中,所述第一压缩参数集合包括各个所述第一压缩参数。The second detection unit is configured to traverse each first file in the first file set, and detect whether each first file has a corresponding first compression parameter, wherein the first compression parameter set includes each The first compression parameter.
可选的,所述第一检测单元具体包括:Optionally, the first detection unit specifically includes:
确定子单元,用于对于所述第一文件集合中的任一第一文件,确定至少两组待验证压缩参数;A determining subunit, configured to determine at least two sets of compression parameters to be verified for any first file in the first file set;
检测子单元,用于通过并行方式,检测所述至少两组待验证压缩参数中,是否存在第一压缩参数。The detection subunit is configured to detect whether the first compression parameter exists in the at least two sets of compression parameters to be verified in a parallel manner.
由上可见,通过本申请方案,由于所述差分文件为对所述第一压缩文件和第二压缩文件解压后获得的,此时,第一目标压缩文件的大小往往要小于直接将所述第一压缩文件和所述第二压缩文件进行差分运算所获得的文件的大小,因此,在后续的信息传输中,可以大大减小相关用户的流量消耗,减小传输时间。此外,通过检测所述第一压缩参数集合,可以获得与所述第一压缩文件相同的第三压缩文件;此时,可以将所述第一压缩文件的数字签名用于所述第三压缩文件的验证,从而可以不需要所述第一压缩文件的提供者重新提供所述第三压缩文件的数字签名,提高了信息处理的效率,缩短了信息处理所需的时长, 从而提升了用户的体验。It can be seen from the above that, through the solution of the present application, since the difference file is obtained after decompressing the first compressed file and the second compressed file, at this time, the size of the first target compressed file is often smaller than that of the first compressed file directly. The size of the file obtained by performing a difference operation between a compressed file and the second compressed file. Therefore, in the subsequent information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced. In addition, by detecting the first compression parameter set, a third compressed file that is the same as the first compressed file can be obtained; at this time, the digital signature of the first compressed file can be used for the third compressed file Therefore, there is no need for the provider of the first compressed file to re-provide the digital signature of the third compressed file, which improves the efficiency of information processing, shortens the time required for information processing, and improves the user experience .
实施例3Example 3
本申请实施例提供了一种终端设备,请参阅图5,本申请实施例中的终端设备包括:存储器501,一个或多个处理器502(图5中仅示出一个)及存储在存储器501上并可在处理器上运行的计算机程序。其中:存储器501用于存储软件程序以及模块,处理器502通过运行存储在存储器501的软件程序以及单元,从而执行各种功能应用以及数据处理,以获取上述预设事件对应的资源。具体地,处理器502通过运行存储在存储器501的上述计算机程序时实现上述任意文件处理方法实施例中的步骤。The embodiment of the present application provides a terminal device. Please refer to FIG. 5. The terminal device in the embodiment of the present application includes: a memory 501, one or more processors 502 (only one is shown in FIG. 5) and stored in the memory 501 A computer program that can run on the processor. Among them: the memory 501 is used to store software programs and modules, and the processor 502 executes various functional applications and data processing by running the software programs and units stored in the memory 501 to obtain resources corresponding to the aforementioned preset events. Specifically, the processor 502 implements the steps in any of the above-mentioned file processing method embodiments when running the above-mentioned computer program stored in the memory 501.
进一步,如图5所示,上述终端设备还可包括:一个或多个输入设备503(图5中仅示出一个)和一个或多个输出设备504(图5中仅示出一个)。存储器501、处理器502、输入设备503和输出设备504通过总线505连接。Further, as shown in FIG. 5, the aforementioned terminal device may further include: one or more input devices 503 (only one is shown in FIG. 5) and one or more output devices 504 (only one is shown in FIG. 5). The memory 501, the processor 502, the input device 503, and the output device 504 are connected by a bus 505.
应当理解,在本申请实施例中,所称处理器502可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors or digital signal processors (DSP). , Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
输入设备503可以包括键盘、触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风等,输出设备504可以包括显示器、扬声器等。The input device 503 may include a keyboard, a touch panel, a fingerprint sensor (used to collect user fingerprint information and fingerprint orientation information), a microphone, etc., and the output device 504 may include a display, a speaker, and the like.
存储器501可以包括只读存储器和随机存取存储器,并向处理器502提供指令和数据。存储器501的一部分或全部还可以包括非易失性随机存取存储器。例如,存储器501还可以存储设备类型的信息。The memory 501 may include a read-only memory and a random access memory, and provides instructions and data to the processor 502. A part or all of the memory 501 may also include a non-volatile random access memory. For example, the memory 501 may also store device type information.
由上可见,通过本申请方案,由于所述差分文件为对所述第一压缩文件和第二压缩文件解压后获得的,此时,第一目标压缩文件的大小往往要小于直接将所述第一压缩文件和所述第二压缩文件进行差分运算所获得的文件的大小,因此,在后续的信息传输中,可以大大减小相关用户的流量消耗,减小传输时间。此外,通过检测所述第一压缩参数集合,可以获得与所述第一压缩文件相同的第三压缩文件;此时,可以将所述第一压缩文件的数字签名用于所述第三压缩文件的验证,从而可以不需要所述第一压缩文件的提供者重新提供所述第三压缩文件的数字签名,提高了信息处理的效率,缩短了信息处理所需的时长,从而提升了用户的体验。It can be seen from the above that, through the solution of the present application, since the difference file is obtained after decompressing the first compressed file and the second compressed file, at this time, the size of the first target compressed file is often smaller than that of the first compressed file directly. The size of the file obtained by performing a difference operation between a compressed file and the second compressed file. Therefore, in the subsequent information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced. In addition, by detecting the first compression parameter set, a third compressed file that is the same as the first compressed file can be obtained; in this case, the digital signature of the first compressed file can be used for the third compressed file Therefore, it is not necessary for the provider of the first compressed file to provide the digital signature of the third compressed file again, which improves the efficiency of information processing, shortens the time required for information processing, and improves the user experience .
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将上述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above functional units and modules is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed. Module completion, that is, the internal structure of the above device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist alone physically, or two or more units can be integrated into one unit. The above-mentioned integrated units can be hardware-based Formal realization can also be realized in the form of software functional units. In addition, the specific names of the functional units and modules are only used to facilitate distinguishing from each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者外部设备软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in the embodiments disclosed in this specification can be implemented by electronic hardware or a combination of external device software and electronic hardware. Whether these functions are performed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的系统实施例仅仅是示意性的,例如,上述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed device and method may be implemented in other ways. For example, the system embodiment described above is only illustrative. For example, the division of the above-mentioned modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be combined. Or it can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,上述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,上述计算机程序包括计算机程序代码,上述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。上述计算机可读存储介质可以包括:能够携带上述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、 磁碟、光盘、计算机可读存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,上述计算机可读存储介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读存储介质不包括是电载波信号和电信信号。If the aforementioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program When executed by the processor, the steps of the foregoing method embodiments can be implemented. Wherein, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code may be in the form of source code, object code, executable file, or some intermediate forms. The above-mentioned computer-readable storage medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer readable memory, read-only memory (ROM, Read-Only Memory) ), Random Access Memory (RAM, Random Access Memory), electrical carrier signal, telecommunications signal, and software distribution media, etc. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately added or deleted according to the requirements of the legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to the legislation and patent practice, the computer-readable storage The medium does not include electrical carrier signals and telecommunication signals.
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个文件处理方法实施例中的步骤。The embodiments of the present application provide a computer program product. When the computer program product runs on a mobile terminal, the steps in the above-mentioned file processing method embodiments can be realized when the mobile terminal is executed.
以上上述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still compare the foregoing embodiments. The recorded technical solutions are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in this Within the scope of protection applied for.

Claims (20)

  1. 一种文件处理方法,其特征在于,包括:A file processing method, characterized in that it comprises:
    获得第一文件集合与第二文件集合的差分文件,其中,所述第一文件集合通过解压第一压缩文件得到,所述第二文件集合通过解压第二压缩文件得到,所述第二压缩文件为所述第一压缩文件的历史版本文件;Obtain the difference file between the first file set and the second file set, wherein the first file set is obtained by decompressing the first compressed file, the second file set is obtained by decompressing the second compressed file, and the second compressed file Is a historical version file of the first compressed file;
    检测是否存在第一压缩参数集合,所述第一压缩参数集合用于对所述第一文件集合进行压缩,且压缩得到的第三压缩文件与所述第一压缩文件相同;Detecting whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file;
    若存在所述第一压缩参数集合,则获取所述第一压缩文件的第一数字签名;If the first compression parameter set exists, obtain the first digital signature of the first compressed file;
    获得包含第一压缩参数信息、所述差分文件和所述第一数字签名的第一目标压缩文件,其中,所述第一压缩参数信息包含关于所述第一压缩参数集合的信息;Obtaining a first target compressed file that includes first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set;
    将所述第一目标压缩文件发送至指定终端,以指示所述指定终端根据所述第一目标压缩文件和所述指定终端中的第四压缩文件,获得还原后的第一压缩文件,其中,所述第四压缩文件与所述第二压缩文件相同。The first target compressed file is sent to a designated terminal to instruct the designated terminal to obtain the restored first compressed file according to the first target compressed file and the fourth compressed file in the designated terminal, where: The fourth compressed file is the same as the second compressed file.
  2. 如权利要求1所述的文件处理方法,其特征在于,还包括:5. The file processing method according to claim 1, further comprising:
    若不存在所述第一压缩参数集合,则根据压缩速度、压缩率和/或压缩文件相似程度,确定第二压缩参数集合,其中,所述压缩文件相似程度为根据所述第二压缩参数集合对所述第一文件集合进行压缩所得到的第五压缩文件与所述第一压缩文件的相似程度;If the first compression parameter set does not exist, a second compression parameter set is determined according to the compression speed, compression rate, and/or similarity degree of compressed files, where the similarity degree of the compressed files is based on the second compression parameter set Degree of similarity between the fifth compressed file obtained by compressing the first file set and the first compressed file;
    根据所述第二压缩参数集合,对所述第一文件集合进行压缩,获得第五压缩文件;Compress the first set of files according to the second set of compression parameters to obtain a fifth compressed file;
    获取所述第五压缩文件的第二数字签名;Acquiring a second digital signature of the fifth compressed file;
    获得包含第二压缩参数信息、所述差分文件和所述第二数字签名的第二目标压缩文件,其中,所述第二压缩参数信息包含所述第二压缩参数集合的信息。Obtain a second target compressed file that includes second compression parameter information, the difference file, and the second digital signature, where the second compression parameter information includes information of the second compression parameter set.
  3. 如权利要求2所述的文件处理方法,其特征在于,所述获取所述第五压缩文件的数字签名,包括:3. The file processing method according to claim 2, wherein said obtaining the digital signature of the fifth compressed file comprises:
    将所述第五压缩文件发送给预设对象,并接收所述预设对象返回的第二数字签名,其中,所述预设对象为设置所述第一压缩文件的第一数字签名的对象。The fifth compressed file is sent to a preset object, and the second digital signature returned by the preset object is received, where the preset object is an object that sets the first digital signature of the first compressed file.
  4. 如权利要求2所述的文件处理方法,其特征在于,所述获取所述第五压缩文件的数字签名,包括:3. The file processing method according to claim 2, wherein said obtaining the digital signature of the fifth compressed file comprises:
    根据预设密钥,生成所述第五压缩文件的第二数字签名,所述预设密钥为预先从所述预设对象接收到,并且,所述预设密钥为生成所述第一数字签名所采用的密钥。According to a preset key, the second digital signature of the fifth compressed file is generated, the preset key is received in advance from the preset object, and the preset key is used to generate the first The key used for the digital signature.
  5. 如权利要求1所述的文件处理方法,其特征在于,所述获得第一文件集合与第二文件集合的差分文件,包括:3. The file processing method according to claim 1, wherein said obtaining the difference file between the first file set and the second file set comprises:
    在接收到指定终端对第一压缩文件的下载请求之后,获取所述指定终端中的第四压缩文件的历史版本信息;After receiving the download request of the designated terminal for the first compressed file, acquiring historical version information of the fourth compressed file in the designated terminal;
    根据所述历史版本信息,获取第二压缩文件;Obtaining a second compressed file according to the historical version information;
    获取第一压缩文件;Obtain the first compressed file;
    根据所述第一压缩文件和所述第二压缩文件,获得第一文件集合与第二文件集合的差分文件。According to the first compressed file and the second compressed file, a difference file between the first file set and the second file set is obtained.
  6. 如权利要求1所述的文件处理方法,其特征在于,所述第一目标压缩文件中的第一数字签名用于在获得还原后的第一压缩文件之后,对所述还原后的第一压缩文件进行验证。2. The file processing method according to claim 1, wherein the first digital signature in the first target compressed file is used for obtaining the restored first compressed file, and then apply to the restored first compressed file. Documents are verified.
  7. 如权利要求1所述的文件处理方法,其特征在于,所述第一压缩参数集合包括用于指示压缩算法的参数、用于指示编码方式的参数、用于指示压缩程度的参数以及用于指示校验字段情况的参数中的至少一种。The file processing method according to claim 1, wherein the first set of compression parameters includes a parameter used to indicate a compression algorithm, a parameter used to indicate a coding mode, a parameter used to indicate a degree of compression, and a parameter used to indicate Check at least one of the parameters of the field condition.
  8. 如权利要求1至7任意一项所述的文件处理方法,其特征在于,所述检测是否存在第一压缩参数集合,包括:7. The file processing method according to any one of claims 1 to 7, wherein said detecting whether there is a first compression parameter set comprises:
    对于所述第一文件集合中的任一第一文件,检测是否存在第一压缩参数,所述第一压缩参数用于对所述第一文件进行压缩,得到第一压缩子文件,所述第一压缩子文件在所述第一压缩文件中存在相应的相同部分;For any first file in the first file set, it is detected whether there is a first compression parameter, and the first compression parameter is used to compress the first file to obtain a first compressed subfile. A compressed sub-file has corresponding identical parts in the first compressed file;
    遍历所述第一文件集合中的各个第一文件,检测各个所述第一文件是否分别存在对应的第一压缩参数,其中,所述第一压缩参数集合包括各个所述第一压缩参数。Traverse each first file in the first file set to detect whether each first file has a corresponding first compression parameter, where the first compression parameter set includes each of the first compression parameters.
  9. 如权利要求8所述的文件处理方法,其特征在于,所述对于所述第一文件集合中的任一第一文件,检测是否存在第一压缩参数,包括:8. The file processing method according to claim 8, wherein the detecting whether there is a first compression parameter for any first file in the first file set comprises:
    对于所述第一文件集合中的任一第一文件,确定至少两组待验证压缩参数;For any first file in the first file set, determine at least two sets of compression parameters to be verified;
    通过并行方式,检测所述至少两组待验证压缩参数中,是否存在第一压缩参数。In a parallel manner, it is detected whether there is a first compression parameter in the at least two sets of compression parameters to be verified.
  10. 一种文件处理装置,其特征在于,包括:A file processing device, characterized in that it comprises:
    第一处理模块,用于获得第一文件集合与第二文件集合的差分文件,其中,所述第一文件集合通过解压第一压缩文件得到,所述第二文件集合通过解压第二压缩文件得到,所述第二压缩文件为所述第一压缩文件的历史版本文件;The first processing module is configured to obtain the difference file between the first file set and the second file set, wherein the first file set is obtained by decompressing the first compressed file, and the second file set is obtained by decompressing the second compressed file , The second compressed file is a historical version file of the first compressed file;
    第一检测模块,用于检测是否存在第一压缩参数集合,所述第一压缩参数集合用于对所述第一文件集合进行压缩,且压缩得到的第三压缩文件与所述第一压缩文件相同;The first detection module is configured to detect whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file the same;
    第二处理模块,用于若存在所述第一压缩参数集合,则获取所述第一压缩文件的第一数字签名;A second processing module, configured to obtain the first digital signature of the first compressed file if the first compression parameter set exists;
    第三处理模块,用于获得包含第一压缩参数信息、所述差分文件和所述第一数字签名的第一目标压缩文件,其中,所述第一压缩参数信息包含关于所述第一压缩参数集合的信息。The third processing module is configured to obtain a first target compressed file containing first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information contains information about the first compression parameter Collection of information.
    发送模块,用于将所述第一目标压缩文件发送至指定终端,以指示所述指定终端根据所述第一目标压缩文件和所述指定终端中的第四压缩文件,获得还原后的第一压缩文件,其中,所述第四压缩文件与所述第二压缩文件相同。The sending module is configured to send the first target compressed file to a designated terminal, so as to instruct the designated terminal to obtain the restored first compressed file according to the first target compressed file and the fourth compressed file in the designated terminal. A compressed file, wherein the fourth compressed file is the same as the second compressed file.
  11. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如下步骤:A terminal device includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the following steps when the processor executes the computer program:
    获得第一文件集合与第二文件集合的差分文件,其中,所述第一文件集合通过解压第一压缩文件得到,所述第二文件集合通过解压第二压缩文件得到,所述第二压缩文件为所述第一压缩文件的历史版本文件;Obtain the difference file between the first file set and the second file set, wherein the first file set is obtained by decompressing the first compressed file, the second file set is obtained by decompressing the second compressed file, and the second compressed file Is a historical version file of the first compressed file;
    检测是否存在第一压缩参数集合,所述第一压缩参数集合用于对所述第一文件集合进行压缩,且压缩得到的第三压缩文件与所述第一压缩文件相同;Detecting whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file;
    若存在所述第一压缩参数集合,则获取所述第一压缩文件的第一数字签名;If the first compression parameter set exists, obtain the first digital signature of the first compressed file;
    获得包含第一压缩参数信息、所述差分文件和所述第一数字签名的第一目标压缩文件,其中,所述第一压缩参数信息包含关于所述第一压缩参数集合的信息;Obtaining a first target compressed file that includes first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set;
    将所述第一目标压缩文件发送至指定终端,以指示所述指定终端根据所述第一目标压缩文件和所述指定终端中的第四压缩文件,获得还原后的第一压缩文件,其中,所述第四压缩文件与所述第二压缩文件相同。The first target compressed file is sent to a designated terminal to instruct the designated terminal to obtain the restored first compressed file according to the first target compressed file and the fourth compressed file in the designated terminal, where: The fourth compressed file is the same as the second compressed file.
  12. 如权利要求11所述的终端设备,其特征在于,所述处理器执行所述计算机程序时,还实现如下步骤:The terminal device according to claim 11, wherein the processor further implements the following steps when executing the computer program:
    若不存在所述第一压缩参数集合,则根据压缩速度、压缩率和/或压缩文件相似程度,确定第二压缩参数集合,其中,所述压缩文件相似程度为根据所述第二压缩参数集合对所述第一文件集合进行压缩所得到的第五压缩文件与所述第一压缩文件的相似程度;If the first compression parameter set does not exist, a second compression parameter set is determined according to the compression speed, compression rate, and/or similarity degree of compressed files, where the similarity degree of the compressed files is based on the second compression parameter set Degree of similarity between the fifth compressed file obtained by compressing the first file set and the first compressed file;
    根据所述第二压缩参数集合,对所述第一文件集合进行压缩,获得第五压缩文件;Compress the first set of files according to the second set of compression parameters to obtain a fifth compressed file;
    获取所述第五压缩文件的第二数字签名;Acquiring a second digital signature of the fifth compressed file;
    获得包含第二压缩参数信息、所述差分文件和所述第二数字签名的第二目标压缩文件,其中,所述第二压缩参数信息包含所述第二压缩参数集合的信息。Obtain a second target compressed file that includes second compression parameter information, the difference file, and the second digital signature, where the second compression parameter information includes information of the second compression parameter set.
  13. 如权利要求12所述的终端设备,其特征在于,所述处理器执行所述计算机程序时,所述获取所述第五压缩文件的数字签名,包括:The terminal device of claim 12, wherein when the processor executes the computer program, the acquiring the digital signature of the fifth compressed file comprises:
    将所述第五压缩文件发送给预设对象,并接收所述预设对象返回的第二数字签名,其中,所述预设对象为设置所述第一压缩文件的第一数字签名的对象。The fifth compressed file is sent to a preset object, and the second digital signature returned by the preset object is received, where the preset object is an object that sets the first digital signature of the first compressed file.
  14. 如权利要求12所述的终端设备,其特征在于,所述处理器执行所述计算机程序时,所述获取所述第五压缩文件的数字签名,包括:The terminal device of claim 12, wherein when the processor executes the computer program, the acquiring the digital signature of the fifth compressed file comprises:
    根据预设密钥,生成所述第五压缩文件的第二数字签名,所述预设密钥为预先从所述预设对象接收到,并且,所述预设密钥为生成所述第一数字签名所采用的密钥。According to a preset key, the second digital signature of the fifth compressed file is generated, the preset key is received in advance from the preset object, and the preset key is used to generate the first The key used for the digital signature.
  15. 如权利要求11所述的终端设备,其特征在于,所述处理器执行所述计算机程序时,所述获得第一文件集合与第二文件集合的差分文件,包括:The terminal device according to claim 11, wherein when the processor executes the computer program, the obtaining the difference file between the first file set and the second file set comprises:
    在接收到指定终端对第一压缩文件的下载请求之后,获取所述指定终端中的第四压缩文件的历史版本信息;After receiving the download request of the designated terminal for the first compressed file, acquiring historical version information of the fourth compressed file in the designated terminal;
    根据所述历史版本信息,获取第二压缩文件;Obtaining a second compressed file according to the historical version information;
    获取第一压缩文件;Obtain the first compressed file;
    根据所述第一压缩文件和所述第二压缩文件,获得第一文件集合与第二文件集合的差分文件。According to the first compressed file and the second compressed file, a difference file between the first file set and the second file set is obtained.
  16. 如权利要求11所述的终端设备,其特征在于,所述处理器执行所述计算机程序时,所述第一目标压缩文件中的第一数字签名用于在获得还原后的第一压缩文件之后,对所述还原后的第一压缩文件进行验证。The terminal device according to claim 11, wherein when the processor executes the computer program, the first digital signature in the first target compressed file is used after obtaining the restored first compressed file To verify the restored first compressed file.
  17. 如权利要求11所述的终端设备,其特征在于,所述处理器执行所述计算机程序时,所述第一压缩参数集合包括用于指示压缩算法的参数、用于指示编码方式的参数、用于指示压缩程度的参数以及用于指示校验字段情况的参数中的至少一种。The terminal device according to claim 11, wherein when the processor executes the computer program, the first compression parameter set includes a parameter for indicating a compression algorithm, a parameter for indicating an encoding method, and At least one of a parameter indicating the degree of compression and a parameter indicating the condition of the check field.
  18. 如权利要求11至17任意一项所述的终端设备,其特征在于,所述处理器执行所述计算机程序时,所述检测是否存在第一压缩参数集合,包括:The terminal device according to any one of claims 11 to 17, wherein when the processor executes the computer program, the detecting whether there is a first compression parameter set comprises:
    对于所述第一文件集合中的任一第一文件,检测是否存在第一压缩参数,所述第一压缩参数用于对所述第一文件进行压缩,得到第一压缩子文件,所述第一压缩子文件在所述第一压缩文件中存在相应的相同部分;For any first file in the first file set, it is detected whether there is a first compression parameter, and the first compression parameter is used to compress the first file to obtain a first compressed subfile. A compressed sub-file has corresponding identical parts in the first compressed file;
    遍历所述第一文件集合中的各个第一文件,检测各个所述第一文件是否分别存在对应的第一压缩参数,其中,所述第一压缩参数集合包括各个所述第一压缩参数。Traverse each first file in the first file set to detect whether each first file has a corresponding first compression parameter, where the first compression parameter set includes each of the first compression parameters.
  19. 如权利要求18所述的终端设备,其特征在于,所述处理器执行所述计算机程序时,所述对于所述第一文件集合中的任一第一文件,检测是否存在第一压缩参数,包括:The terminal device according to claim 18, wherein when the processor executes the computer program, the detecting whether there is a first compression parameter for any first file in the first file set, include:
    对于所述第一文件集合中的任一第一文件,确定至少两组待验证压缩参数;For any first file in the first file set, determine at least two sets of compression parameters to be verified;
    通过并行方式,检测所述至少两组待验证压缩参数中,是否存在第一压缩参数。In a parallel manner, it is detected whether there is a first compression parameter in the at least two sets of compression parameters to be verified.
  20. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特 征在于,所述计算机程序被处理器执行时实现如权利要求1至9任一项所述文件处理方法的步骤。A computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the steps of the file processing method according to any one of claims 1 to 9 .
PCT/CN2019/119243 2019-11-18 2019-11-18 File processing method, file processing apparatus, and terminal device WO2021097624A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980100491.8A CN114402286A (en) 2019-11-18 2019-11-18 File processing method, file processing device and terminal equipment
PCT/CN2019/119243 WO2021097624A1 (en) 2019-11-18 2019-11-18 File processing method, file processing apparatus, and terminal device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/119243 WO2021097624A1 (en) 2019-11-18 2019-11-18 File processing method, file processing apparatus, and terminal device

Publications (1)

Publication Number Publication Date
WO2021097624A1 true WO2021097624A1 (en) 2021-05-27

Family

ID=75981116

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/119243 WO2021097624A1 (en) 2019-11-18 2019-11-18 File processing method, file processing apparatus, and terminal device

Country Status (2)

Country Link
CN (1) CN114402286A (en)
WO (1) WO2021097624A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113592964A (en) * 2021-06-30 2021-11-02 未鲲(上海)科技服务有限公司 Picture compression method and related device
WO2023169243A1 (en) * 2022-03-11 2023-09-14 华为技术有限公司 Information processing method and apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101361051A (en) * 2006-06-19 2009-02-04 三星电子株式会社 Information upgrade system and method for ota-capable device
CN102724308A (en) * 2012-06-13 2012-10-10 腾讯科技(深圳)有限公司 Software update method and software update system
CN103713928A (en) * 2013-12-31 2014-04-09 优视科技有限公司 Incremental file generating method, and application program installing file updating method and device
CN104391728A (en) * 2014-12-12 2015-03-04 北京奇虎科技有限公司 Software upgrading delta pack acquiring method, corresponding upgrading method and device
CN105138347A (en) * 2015-07-17 2015-12-09 广东欧珀移动通信有限公司 Difference upgrade patch generating method, software upgrading method and corresponding apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101361051A (en) * 2006-06-19 2009-02-04 三星电子株式会社 Information upgrade system and method for ota-capable device
CN102724308A (en) * 2012-06-13 2012-10-10 腾讯科技(深圳)有限公司 Software update method and software update system
CN103713928A (en) * 2013-12-31 2014-04-09 优视科技有限公司 Incremental file generating method, and application program installing file updating method and device
CN104391728A (en) * 2014-12-12 2015-03-04 北京奇虎科技有限公司 Software upgrading delta pack acquiring method, corresponding upgrading method and device
CN105138347A (en) * 2015-07-17 2015-12-09 广东欧珀移动通信有限公司 Difference upgrade patch generating method, software upgrading method and corresponding apparatus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113592964A (en) * 2021-06-30 2021-11-02 未鲲(上海)科技服务有限公司 Picture compression method and related device
WO2023169243A1 (en) * 2022-03-11 2023-09-14 华为技术有限公司 Information processing method and apparatus

Also Published As

Publication number Publication date
CN114402286A (en) 2022-04-26

Similar Documents

Publication Publication Date Title
CN112765271B (en) Block chain transaction index storage method and device, computer equipment and medium
CN111857550B (en) Method, apparatus and computer readable medium for data deduplication
WO2021114025A1 (en) Incremental data determination method, incremental data determination apparatus, server and terminal device
CN111694589B (en) Upgrade package generation method, device, server and computer readable storage medium
WO2021097624A1 (en) File processing method, file processing apparatus, and terminal device
CN106126256A (en) A kind of driven management method, Apparatus and system
WO2021174836A1 (en) Differential package generation method and apparatus, computer device, and storage medium
CN112947981A (en) Application program resource updating method and device, terminal equipment and server
CN115421745A (en) Equipment remote upgrading method, device, terminal and storage medium
CN111176685A (en) Upgrading method and device
CN112445769A (en) Block chain-based on-chain storage method and device, terminal equipment and medium
CN106775835B (en) Method, server and terminal for acquiring upgrade file
CN109104481B (en) File integrity detection method, file integrity detection device and terminal equipment
CN114303131B (en) File processing method, file processing device and terminal equipment
CN110930253A (en) Intelligent contract internal main key generation method and device, computer equipment and storage medium
WO2021097622A1 (en) File processing method, file processing apparatus and terminal device
WO2021087662A1 (en) Memory allocation method and apparatus, terminal, and computer readable storage medium
WO2021097758A1 (en) Incremental package generation method, incremental package generation apparatus, and server
WO2021114101A1 (en) Method and apparatus for incremental update of file, and terminal and computer-readable storage medium
CN111158994A (en) Pressure testing performance testing method and device
CN112015459A (en) Method and device for upgrading image file, terminal and readable storage medium
CN109670980B (en) Method, system and equipment for processing charging service data
CN112804164B (en) Flow information generation method and device, electronic equipment and computer readable medium
WO2021128269A1 (en) File processing method, file processing device, mobile terminal and server
CN112948105B (en) Gradient transmission method, gradient transmission device and parameter server

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19952969

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 281022)

122 Ep: pct application non-entry in european phase

Ref document number: 19952969

Country of ref document: EP

Kind code of ref document: A1