A file verification method and device

Through the blockchain transmission network BTN, the file block information is determined first and the verification information of the specified block is transmitted, which solves the problem of long-term verification of large files and realizes efficient file transmission and verification.

CN115129728BActive Publication Date: 2025-08-19ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210632963.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-06
Publication Date
2025-08-19
Estimated Expiration
2042-06-06

AI Technical Summary

Technical Problem

When transferring large files in the prior art, the file integrity verification process takes a long time and occupies a lot of system resources, especially for files above 1GB, resulting in low transmission efficiency.

Method used

Through the blockchain transmission network BTN, the file block information is determined first and the verification information of the specified block is transmitted, and the file integrity is verified based on the locally stored verification information, thereby reducing verification time and resource usage.

Benefits of technology

It improves the efficiency of file verification, reduces the time and system resource consumption of large files, and improves transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115129728B_ABST
    Figure CN115129728B_ABST
Patent Text Reader

Abstract

This specification discloses a method and apparatus for file verification, which includes: a first device sends a transmission request for obtaining a file to a second device through a blockchain transmission network BTN, so that the second device returns file metadata; based on the file metadata, determining block information corresponding to the file; forwarding the block information to the second device, so that the second device determines each file block based on the block information and sends it; for each received file block, if it is determined that the file block is a predetermined designated block, determining and storing verification information corresponding to the file block; after receiving all file blocks, requesting verification information of each designated block from the second device, and verifying whether the received file is complete based on the verification information of each designated block requested from the second device and the verification information of each designated block locally stored by the first device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of file transmission technology, and in particular to a method and device for file verification. Background Art

[0002] With the development of transmission technology, the efficiency of file transmission between terminal devices is gradually improving. In order to ensure the integrity of file data during high-speed transmission, it is usually necessary to perform an integrity check on the entire file after the transmission is completed to determine whether the received file is consistent with the sent source file, thereby verifying whether the received file is complete.

[0003] Current methods typically perform an integrity check on the entire file after the transfer is complete, or pre-transfer the file into chunks before transferring it and then perform an integrity check on each chunk after the transfer is complete. However, for larger files over 1GB, performing an integrity check on the entire file after the transfer is complete is time-consuming and consumes significant system resources.

[0004] Therefore, how to improve the efficiency of file verification is an urgent problem to be solved. Summary of the Invention

[0005] This specification provides a file verification method and a file verification device to improve the efficiency of file verification.

[0006] This manual adopts the following technical solutions:

[0007] This manual provides a file verification method, including:

[0008] The first device sends a transfer request for obtaining a file to the second device via the blockchain transmission network BTN, so that the second device returns file metadata corresponding to the file;

[0009] Determining the block information corresponding to the file according to the file metadata;

[0010] Forwarding the block information to the second device through the BTN, so that the second device determines each file block according to the block information and sends it;

[0011] For each received file block, if it is determined that the file block is a predetermined designated block, then verification information corresponding to the file block is determined and stored;

[0012] After receiving all file blocks, request verification information of each specified block from the second device, and verify whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device.

[0013] Optionally, requesting verification information of each designated block from the second device specifically includes:

[0014] The request for obtaining verification information of each designated block is forwarded to the second device through the BTN, so as to request verification information of each designated block from the second device.

[0015] Optionally, determining each designated block specifically includes:

[0016] The first and last file blocks in block numbering, and K file blocks in block numbering between the first and last are selected as designated blocks, where K is a positive integer and K+2 is less than the number of file blocks.

[0017] This specification provides a file verification method, which is applied to a second device transmitting a file, and includes:

[0018] The second device receives a transmission request for obtaining a file sent by the first device via the blockchain transmission network BTN, and sends file metadata of the file to the first device, so that the first device determines the block information corresponding to the file based on the file metadata;

[0019] Determine each file block based on the block information sent by the first device via the blockchain transmission network BTN, send the block to the first device, and store verification information corresponding to each determined file block;

[0020] In response to the first device's request to obtain verification information of specified blocks, the verification information of each specified block is returned to the first device, so that the first device verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device, wherein the verification information of each specified block stored by the second device is requested by the first device from the second device after receiving all file blocks.

[0021] This specification provides a file verification device, including:

[0022] A sending module, in which the first device sends a transmission request for obtaining a file to the second device via the blockchain transmission network BTN, so that the second device returns file metadata corresponding to the file;

[0023] A first determining module, determining block information corresponding to the file according to the file metadata;

[0024] A second determining module forwards the block information to the second device through the BTN, so that the second device determines each file block according to the block information and sends the block;

[0025] The receiving module determines and stores verification information corresponding to each received file block if it is determined that the file block is a predetermined designated block;

[0026] The verification module requests verification information of each specified block from the second device after receiving all file blocks, and verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device.

[0027] Optionally, the receiving module is specifically configured to forward the request for obtaining verification information of each designated block to the second device through the BTN, so as to request verification information of each designated block from the second device.

[0028] Optionally, the receiving module is specifically used to select the file blocks with the first and last block numbers, and K file blocks with block numbers between the first and last, as designated blocks, where K is a positive integer and K+2 is less than the number of file blocks.

[0029] This specification provides a file verification device, including:

[0030] A sending module, in which the second device receives a transmission request for obtaining a file sent by the first device via the blockchain transmission network BTN, and sends file metadata of the file to the first device, so that the first device determines the block information corresponding to the file based on the file metadata;

[0031] a storage module, which determines each file block based on the block information sent by the first device via the blockchain transmission network BTN, sends the block to the first device, and stores verification information corresponding to each determined file block;

[0032] a return module that, in response to a request from the first device to obtain verification information of a specified block, returns verification information of each specified block to the first device, so that the first device verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device, wherein the verification information of each specified block stored by the second device is requested by the first device from the second device after receiving all file blocks.

[0033] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned file verification method is implemented.

[0034] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned file verification method when executing the program.

[0035] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:

[0036] In the file verification method provided herein, a first device determines, for each file block sent by a second device, whether the file block is a predetermined designated block. If so, verification information corresponding to the file block is stored, and the number of designated blocks is less than the total number of file blocks. After receiving all file blocks, the first device requests verification information for all designated blocks from the second device and verifies the integrity of the received file based on the verification information for the designated blocks requested from the second device and the verification information for the designated blocks stored locally on the first device.

[0037] It can be seen from the above method that in the process of integrity verification, this scheme only needs to verify whether the received file is complete based on the verification information stored locally of some file blocks (i.e., specified blocks) and the verification information requested from the second device. Compared with the existing scheme of verifying whether the received file is complete based on the verification information of all file blocks, the time required for file verification is greatly reduced, thereby improving the efficiency of file verification. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The exemplary embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification.

[0039] In the picture:

[0040] Figure 1A flowchart of a file verification method provided in this manual;

[0041] Figure 2 A flowchart of a file verification method provided in this manual;

[0042] Figure 3 A flowchart of a file verification process provided in this manual;

[0043] Figure 4 A schematic diagram of a document verification device provided in this manual;

[0044] Figure 5 A schematic diagram of a document verification device provided in this manual;

[0045] Figure 6 This manual provides a corresponding Figure 1 or Figure 2 Schematic diagram of electronic equipment. DETAILED DESCRIPTION

[0046] To make the objectives, technical solutions, and advantages of this specification more clear, the following will clearly and completely describe the technical solutions of this specification in conjunction with the specific embodiments of this specification and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this specification.

[0047] The technical solutions provided by the embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0048] Figure 1 This is a flowchart of a file verification method provided in this specification, which includes the following steps:

[0049] S100: The first device sends a transmission request for obtaining a file to the second device through the blockchain transmission network BTN, so that the second device returns file metadata corresponding to the file.

[0050] During the file transfer process, when facing some larger files (such as files larger than 1GB), if the second device sending the file directly transmits the entire file at one time, it will not only occupy too many transmission resources (such as network bandwidth, device processor, device memory, etc.), but also consume a lot of transmission time, greatly affecting the file transmission efficiency.

[0051] Therefore, the file to be transmitted can be divided into blocks according to a certain size, each block is a file block, and then these file blocks are transmitted separately. When the first device receives all the file blocks, these file blocks can be combined to obtain a complete file.

[0052] After a first device receiving a file receives all file blocks, it needs to perform an integrity check on the received file to ensure that the received file is complete. Since this integrity check consumes a certain amount of time, in order to reduce the time required for the integrity check and thereby improve the overall efficiency of file transmission, this specification provides a file verification method, wherein the first device receiving the file can first send a file transfer request to a second device transmitting the file.

[0053] In this specification, the first device and the second device can be terminal devices such as mobile phones, tablets, laptops, desktop computers, servers, etc., so as to transfer files between different devices. Of course, the execution entity for obtaining the file can also be a client installed in the terminal device, and this specification does not make specific restrictions on this.

[0054] Among them, the first device and the second device can be different combinations of the above-mentioned terminal devices, such as a combination of terminal devices such as a mobile phone and a tablet computer to realize file transfer between terminal devices, or a combination such as a mobile phone and a server to realize file downloading from the server by the mobile phone. Of course, it can also be a combination between servers.

[0055] The first device first sends the transmission request to the Blockchain Transmission Network (BTN), which then forwards the request to the second device via BTN to ensure transmission efficiency and information security during the file transfer process. The BTN network is a dedicated data transmission network composed of nodes with high computing power, high reliability, and high stability, specifically designed for blockchain data transmission to ensure security and integrity during the data transmission process. Therefore, the first device and the second device can also be devices located at two nodes in the BTN network.

[0056] Since the second device has pre-stored the file to be transferred and the file metadata of the file (such as the file size (file_size), the file Etag label (file_etag), the file data distribution information, etc.), when the second device receives the above-mentioned transmission request, it can return these file metadata to the first device.

[0057] Of course, in actual applications, the second device can also periodically send some corresponding files or data to the first device to update the files in the first device. In this scenario, the first device will not actively send a transmission request to the second device, so the second device may not send file metadata according to the transmission request sent by the first device, but directly send the file metadata to the first device before sending the corresponding files or data to the first device.

[0058] S102: Determine the block information corresponding to the file according to the file metadata.

[0059] After the first device receives the file metadata returned by the second device, it can determine the block information of the file according to the file metadata.

[0060] Specifically, the first device can determine the number of blocks based on the file size. For example, the first device can pre-set the size of each file block and then determine the number of blocks. When the file as a whole is large, the number of blocks will be relatively large, and when the file as a whole is small, the number of blocks will be relatively small.

[0061] For another example, the first device may also directly set the number of blocks, so that when the overall file is large, each block will also be relatively large, and when the overall file is small, each block will also be relatively small.

[0062] In addition, the first device may also number each file block according to the actual order corresponding to each block, so as to obtain block information including the block number, the number of blocks, and the offset position corresponding to each file block.

[0063] Since it would take too much time to verify all the file blocks, the first device may select some of the file blocks and perform verification only on these file blocks.

[0064] Specifically, the first device may determine the block numbers of the designated blocks from the block numbers corresponding to the various file blocks, and store the block numbers of the designated blocks.

[0065] In the process of determining the designated blocks, a portion of the file blocks may be randomly selected from the various file blocks as the designated blocks, but the number of these designated blocks must be less than the total number of all the file blocks.

[0066] Of course, the first device can also select the file blocks with the first and last block numbers, and K file blocks with block numbers between the first and last, as designated blocks, where K is a positive integer and K+2 is less than the number of file blocks.

[0067] It should be emphasized that in order to improve the efficiency of subsequent file verification, the K value here should be less than the number of file blocks except the file blocks ranked first and last in the block numbering. In this way, the value of K+2 will be less than the total number of file blocks.

[0068] In actual applications, the K value may vary for each file transfer. Furthermore, when determining the designated block, the first device may randomly select the file blocks whose block numbers are between the first and last digits. The larger the K value, the lower the efficiency of the subsequent integrity check, but the higher the accuracy of the check. Conversely, the smaller the K value, the higher the efficiency of the subsequent integrity check, but the lower the accuracy of the check.

[0069] Furthermore, since each node in the BTN network itself has high computing power and stability, during the verification process, it is almost impossible for other file blocks other than the above K specified blocks to have abnormalities during transmission. Therefore, only by performing integrity verification on the above K specified files, it is possible to determine whether the received file is complete.

[0070] It should be noted that, since the second device has not yet sent the file blocks to the first device at this time, the designated block determined here may be the block number corresponding to the designated block.

[0071] S104: Forward the block information to the second device via the BTN, so that the second device determines each file block according to the block information and sends the block.

[0072] After determining the block information, the first device may first send the block information to the BTN, which then forwards it to the second device.

[0073] After receiving the above-mentioned block information, the second device can read each file block corresponding to the block information according to the offset position corresponding to each file block in the block information, thereby determining each file block to complete the block processing of the file.

[0074] In the process of the second device determining each file block, it can also determine the verification information corresponding to each file block. Specifically, the second device can determine the verification information corresponding to each file block through a preset encryption algorithm, wherein the preset encryption algorithm can include a message digest algorithm (MD5 Message-Digest Algorithm, MD5), MD4, a secure hash algorithm (Secure Hash Algorithm, SHA), etc., and this manual does not make specific limitations on this.

[0075] Preferably, the second device may use the MD5 algorithm to hash each file block, thereby obtaining an MD5 value corresponding to each file block, and the MD5 value may be used as verification information corresponding to each file block.

[0076] The second device can then save the verification information corresponding to each file block and send each file block to the first device. The second device can send each file block sequentially in a specified order, where the order can be the numbering sequence of the block numbers corresponding to each file block. Of course, the second device can also send each file block to the first device randomly. Each time the second device sends a file block to the first device, it can calculate and store the verification information corresponding to that file block.

[0077] During the actual transmission process, the second device can determine the number of file blocks to be sent each time based on transmission resource limitations. For example, if the current transmission bandwidth only allows a maximum of five file blocks to be sent at a time, the second device must ensure that the number of file blocks is less than or equal to five each time it sends a file block to the first device, until all file blocks have been sent. Of course, if the actual transmission resources allow, the second device can also send all file blocks to the first device at once. The specific number of file blocks to be transmitted each time can be set based on actual circumstances and is not specifically limited in this specification.

[0078] S106: For each received file block, if it is determined that the file block is a predetermined designated block, verification information corresponding to the file block is determined and stored.

[0079] When the second device transfers a file to the first device, for each file block received by the first device, the first device can first determine whether the received file block is a predetermined designated block (that is, determine whether the block number corresponding to the file block is the block number corresponding to the previously stored designated block). If so, the first device can determine the verification information corresponding to the file block and store the verification information. The way the first device determines the verification information corresponding to the file block is the same as that of the second device, and this manual will not go into details here.

[0080] S108: After receiving all file blocks, request verification information of each specified block from the second device, and verify whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored in the first device.

[0081] After the first device receives all the file blocks, it can combine these file blocks into a complete file in actual order and perform an integrity check on the file to ensure that the received file is consistent with the file sent by the second device.

[0082] Specifically, the first device may send a request for obtaining verification information of a specified file to the BTN, so that the BTN forwards the request to the second device, thereby requesting verification information of each specified block from the second device.

[0083] When the second device receives the request, since it has already stored the block numbers corresponding to the specified blocks, it can directly send the verification information for the file blocks corresponding to these block numbers to the first device. For example, if there are 10 file blocks and their corresponding block numbers, and if it is determined that the specified blocks are numbered 1, 3, 5, 7, and 10, then after receiving the request from the first device, the second device can directly send the verification information corresponding to the file blocks numbered 1, 3, 5, 7, and 10 to the first device.

[0084] After receiving the verification information of each designated block, the first device can verify whether the received file is complete based on the verification information of each designated block requested from the second device and the verification information of each designated block locally stored in the first device.

[0085] Among them, if the verification information of each specified block requested from the second device matches the verification information of each specified block stored locally on the first device one by one, it is determined that a complete file has been received. If the verification information of as long as one specified block does not match, it means that the received file is incomplete.

[0086] In addition, the first device can also arrange the verification information corresponding to each specified block in a specified order (such as the order of the block numbers) to obtain an overall verification information, and judge whether the received file is complete based on the overall verification information formed by the arrangement of each verification information locally stored on the first device and the overall verification information formed by the arrangement of each verification information requested from the second device. If the above two overall verification information are consistent, it is determined that the complete file has been received.

[0087] On this basis, the integrity of the received file is further verified based on the overall size of the received file and the size of the file in the file metadata. If the overall size of the received file is consistent with the size of the source file in the file metadata, it means that the received file is a complete file.

[0088] When the first device determines that the received file is a complete file, the file transfer is completed.

[0089] If the first device determines through integrity check that the received file is incomplete, it may resend a transmission request to the second device to reacquire the complete file.

[0090] The above is a description of the file verification method provided in this specification with the first device as the execution subject. The following is a further description of this specification with the second device as the execution subject. Figure 2 shown.

[0091] Figure 2 The following is a flowchart of a file verification method provided in this manual.

[0092] S200: The second device receives a transmission request for obtaining a file sent by the first device through the blockchain transmission network BTN, and sends file metadata of the file to the first device, so that the first device determines the block information corresponding to the file based on the file metadata.

[0093] After the first device sends a file transfer request through the blockchain transmission network BTN, the second device can send the file metadata of the file to the first device. The first device can then determine the block information corresponding to the file based on the file metadata, as well as the designated block, and send the block information to the second device.

[0094] S202 determines each file block according to the block information sent by the first device through the blockchain transmission network BTN, sends the block to the first device, and stores the verification information corresponding to each determined file block.

[0095] After receiving the block information, the second device can block the file according to the block information, thereby determining each file block, calculating the verification information corresponding to each file block and saving the verification information, and then sending each file block to the first device.

[0096] Each time the first device receives a block, it may determine that after receiving each file block, for each received file block, if the first device determines that the file block is a designated block, the first device may determine verification information corresponding to the file block and store the verification information locally, wherein the number of the designated blocks is less than the number of all file blocks.

[0097] S204: In response to the first device's request to obtain verification information of specified blocks, the verification information of each specified block is returned to the first device, so that the first device verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device, wherein the verification information of each specified block stored by the second device is requested by the first device from the second device after receiving all file blocks.

[0098] After receiving all the file blocks, the first device sends a request to the second device to obtain verification information corresponding to each specified block.

[0099] After receiving the request, the second device sends the verification information corresponding to the specified block to the first device, so that the first device verifies whether the received file is complete based on the verification information of the specified block and the verification information of the specified block stored locally on the first device.

[0100] For ease of understanding, this manual provides a flowchart of file transfer, such as Figure 3 shown.

[0101] Figure 3 This is a schematic diagram of the file transfer process provided in this manual.

[0102] Among them, the first device sends a file transfer request to the second device through BTN, and the second device returns the file metadata of the file to the first device based on the transfer request. Then the first device determines the file block information and the number of the specified block based on the file metadata.

[0103] The first device can then forward the block request carrying the block information through BTN to request each file block from the second device. The second device determines each file block and the verification information corresponding to each file block based on the block information of the file, and then sends each file block to the first device in sequence.

[0104] For each file block received, the first device will first determine whether the number corresponding to the file block is the number corresponding to the specified block. If so, it will determine the verification information corresponding to the file block locally through a preset encryption algorithm and store the verification information locally.

[0105] If the first device receives all the file blocks, it requests the verification information of the specified block from the second device through BNT. After the first device obtains the verification information corresponding to the specified block, if it determines that the locally stored verification information is consistent with the verification information requested from the second device, it further compares the size of the received entire file with the size of the file sent by the second device. If the size is also consistent, the verification is successful. If the above verification information is inconsistent or the file size is inconsistent, the verification fails.

[0106] It can be seen from the above method that in the process of integrity verification, this scheme only needs to verify whether the received file is complete based on the verification information stored locally of some file blocks (i.e., specified blocks) and the requested verification information. Compared with the existing scheme of verifying whether the received file is complete based on the verification information of all file blocks, the time required for integrity verification is greatly reduced, thereby improving the overall efficiency of file transmission.

[0107] In addition, during the file transfer process, this solution is to determine the block information based on the requested file metadata by the first device, and the second device only needs to read each file block based on the block information. The second device does not need to determine how to block, which further improves the overall efficiency of file transfer.

[0108] The above is one or more methods for implementing file verification in this specification. Based on the same idea, this specification also provides a corresponding file verification device, such as Figure 4 shown.

[0109] Figure 4 A schematic diagram of a file verification device provided in this manual includes:

[0110] In a sending module 400, the first device sends a transmission request for obtaining a file to the second device via the blockchain transmission network BTN, so that the second device returns file metadata corresponding to the file;

[0111] A first determining module 402 determines the block information corresponding to the file according to the file metadata;

[0112] The second determining module 404 forwards the block information to the second device through the BTN, so that the second device determines each file block according to the block information and sends the block;

[0113] The receiving module 406 determines and stores verification information corresponding to each received file block if the file block is determined to be a predetermined designated block;

[0114] The verification module 408, after receiving all the file blocks, requests verification information of each specified block from the second device, and verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device.

[0115] Optionally, the receiving module 406 is specifically configured to forward the request for obtaining verification information of each designated block to the second device through the BTN, so as to request the verification information of each designated block from the second device.

[0116] Optionally, the receiving module 406 is specifically used to select the file blocks with the first and last block numbers, and K file blocks with block numbers between the first and last, as designated blocks, where K is a positive integer and K+2 is less than the number of file blocks.

[0117] Figure 5 A schematic diagram of a file verification device provided in this manual includes:

[0118] A sending module 500, in which the second device receives a transmission request for obtaining a file sent by the first device via the blockchain transmission network BTN, and sends file metadata of the file to the first device, so that the first device determines the block information corresponding to the file based on the file metadata;

[0119] The storage module 502 determines each file block based on the block information sent by the first device via the blockchain transmission network BTN, sends the block to the first device, and stores verification information corresponding to each determined file block;

[0120] The return module 504 returns the verification information of each specified block to the first device in response to the request of the first device to obtain the verification information of the specified block, so that the first device verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device, wherein the verification information of each specified block stored by the second device is requested by the first device to the second device after receiving all file blocks.

[0121] This specification also provides a computer-readable storage medium, which stores a computer program that can be used to execute the above Figure 1 or Figure 2 Provides a file verification method.

[0122] This manual also provides Figure 6 The one shown corresponds to Figure 1 or Figure 2 Schematic diagram of the electronic equipment. Figure 6 As mentioned above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 or Figure 2 Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0123] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.

[0124] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the means for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as both a software module implementing the method and a structure within the hardware component.

[0125] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0126] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0127] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0128] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0129] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0131] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0132] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0133] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0134] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0135] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Thus, this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0136] This specification may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.

[0137] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.

[0138] The foregoing is merely an example of the present invention and is not intended to limit the present invention. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims of the present invention.

Claims

1. A file verification method, the method being applied to a first device receiving a file, comprising: The first device sends a transfer request for obtaining a file to the second device via the blockchain transmission network BTN, so that the second device returns file metadata corresponding to the file; Determining the block information corresponding to the file according to the file metadata; Forwarding the block information to the second device through the BTN, so that the second device determines each file block according to the block information and sends it; For each received file block, if it is determined that the file block is a predetermined designated block, determining and storing verification information corresponding to the file block; wherein the number of the designated blocks is less than the total number of file blocks sent by the second device; After receiving all file blocks, request verification information of each specified block from the second device, and verify whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device.

2. The method according to claim 1, requesting verification information of each designated block from the second device, specifically comprising: The request for obtaining verification information of each designated block is forwarded to the second device through the BTN, so as to request verification information of each designated block from the second device.

3. The method according to claim 1, wherein determining each designated block comprises: The first and last file blocks with block numbers, and K file blocks with block numbers between the first and last are selected as designated blocks, where K is a positive integer and K+2 is less than the number of file blocks.

4. A file verification method, the method being applied to a second device for transmitting a file, comprising: The second device receives a transmission request for obtaining a file sent by the first device via the blockchain transmission network BTN, and sends file metadata of the file to the first device, so that the first device determines the block information corresponding to the file based on the file metadata; Determine each file block based on the block information sent by the first device via the blockchain transmission network BTN, send the block to the first device, and store verification information corresponding to each determined file block; In response to the first device's request to obtain verification information of specified blocks, the verification information of each specified block is returned to the first device, so that the first device verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device, wherein the verification information of each specified block stored by the second device is requested by the first device to the second device after receiving all file blocks, and the number of the specified blocks is less than the total number of file blocks sent by the second device.

5. A file verification device, comprising: A sending module, in which the first device sends a transmission request for obtaining a file to the second device via the blockchain transmission network BTN, so that the second device returns file metadata corresponding to the file; A first determining module, determining block information corresponding to the file according to the file metadata; A second determining module forwards the block information to the second device through the BTN, so that the second device determines each file block according to the block information and sends the block; a receiving module, for each received file block, determining and storing verification information corresponding to the file block if it is determined that the file block is a predetermined designated block; wherein the number of the designated blocks is less than the total number of file blocks sent by the second device; The verification module requests verification information of each specified block from the second device after receiving all file blocks, and verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device.

6. The apparatus according to claim 5, wherein the verification module is specifically configured to forward the request for obtaining verification information of each designated block to the second device through the BTN, so as to request verification information of each designated block from the second device.

7. The device according to claim 6, wherein the receiving module is specifically configured to select the first and last file blocks with block numbers, and K file blocks with block numbers between the first and last, as designated blocks, wherein: K is a positive integer, and K+2 is less than the number of the file blocks.

8. A file verification device, comprising: A sending module, in which the second device receives a transmission request for obtaining a file sent by the first device via the blockchain transmission network BTN, and sends file metadata of the file to the first device, so that the first device determines the block information corresponding to the file based on the file metadata; a storage module, which determines each file block based on the block information sent by the first device via the blockchain transmission network BTN, sends the block to the first device, and stores verification information corresponding to each determined file block; A return module, in response to the first device's request to obtain verification information of specified blocks, returns the verification information of each specified block to the first device, so that the first device verifies whether the received file is complete based on the verification information of each specified block requested from the second device and the verification information of each specified block locally stored by the first device, wherein the verification information of each specified block stored by the second device is requested by the first device to the second device after receiving all file blocks, and the number of the specified blocks is less than the total number of file blocks sent by the second device.

9. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 4.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 4 when executing the program.

Citation Information

Patent Citations

  • Method and device for performing data verification

    CN108234583A

  • Data processing method and device based on distributed storage, equipment and medium

    CN112559637A