CN115129728A - File checking method and device - Google Patents

File checking method and device Download PDF

Info

Publication number
CN115129728A
CN115129728A CN202210632963.8A CN202210632963A CN115129728A CN 115129728 A CN115129728 A CN 115129728A CN 202210632963 A CN202210632963 A CN 202210632963A CN 115129728 A CN115129728 A CN 115129728A
Authority
CN
China
Prior art keywords
file
block
equipment
information
blocks
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210632963.8A
Other languages
Chinese (zh)
Inventor
焦梦洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai Co Ltd
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 Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202210632963.8A priority Critical patent/CN115129728A/en
Publication of CN115129728A publication Critical patent/CN115129728A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The specification discloses a method and a device for file verification, wherein the method for file verification comprises the following steps: the method comprises the steps that a first device sends a transmission request for acquiring a file to a second device through a block chain transmission network (BTN) so that the second device returns file metadata; determining block information corresponding to the file according to the file metadata; the blocking information is forwarded to second equipment, so that the second equipment determines each file block according to the blocking information and sends the file block; aiming at each received file block, if the file block is determined to be a predetermined specified block, determining and storing verification information corresponding to the file block; after all the file blocks are received, the verification information of each appointed block is requested from the second equipment, and whether the received file is complete or not is verified according to the verification information of each appointed block requested from the second equipment and the verification information of each appointed block stored locally in the first equipment.

Description

File checking method and device
Technical Field
The present disclosure relates to the field of file transmission technologies, and in particular, to a method and an apparatus for file verification.
Background
With the development of transmission technology, the transmission efficiency of files between terminal devices is also gradually improved, and in order to ensure the integrity of file data in the high-speed transmission process, after transmission is completed, integrity check is usually performed on the whole file to determine whether the received file is consistent with the sent source file, so as to verify whether the received file is complete.
However, the currently adopted method usually performs integrity check on the whole file after transmission is completed, or performs blocking on the file in advance, then performs file transmission, and performs integrity check on each file block after transmission is completed. However, when a number of large files with a size of more than 1GB are processed, the process of performing integrity check on the entire file after transmission is not only time consuming, but also takes up more system resources.
Therefore, how to improve the efficiency of file verification is an urgent problem to be solved.
Disclosure of Invention
The present specification provides a file verification method and a file verification apparatus, so as to improve file verification efficiency.
The technical scheme adopted by the specification is as follows:
the present specification provides a method for file verification, including:
the method comprises the steps that a first device sends a transmission request for acquiring a file to a second device through a block chain transmission network (BTN) so that the second device returns file metadata corresponding to the file;
according to the file metadata, determining the block information corresponding to the file;
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 the file block;
for each received file block, if the file block is determined to be a predetermined specified block, determining and storing check information corresponding to the file block;
after all the file blocks are received, checking information of all the appointed blocks is requested from the second equipment, and whether the received file is complete or not is verified according to the checking information of all the appointed blocks requested from the second equipment and the checking information of all the appointed blocks locally stored in the first equipment.
Optionally, the requesting, from the second device, the check information of each designated block specifically includes:
and forwarding the request for acquiring the check information of each designated block to the second equipment through the BTN so as to request the check information of each designated block from the second equipment.
Optionally, determining each designated partition specifically includes:
selecting the file blocks with the block numbers arranged at the first and the last positions and K file blocks with the block numbers arranged between the first and the last positions as designated blocks, wherein K is a positive integer, and K +2 is smaller than the number of the file blocks.
The present specification provides a method for checking a file, which is applied to a second device for transmitting a file, and includes:
the method comprises the steps that a second device receives a transmission request, sent by a first device through a block chain transmission network (BTN), for acquiring a file, and sends file metadata of the file to the first device, so that the first device determines block information corresponding to the file according to the file metadata;
determining each file block and sending the file block to the first equipment according to the block information sent by the first equipment through a block chain transmission network (BTN), and storing the verification information corresponding to each determined file block;
and in response to a request for acquiring the check information of the designated blocks by the first device, returning the check information of each designated block to the first device, so that the first device verifies whether the received file is complete according to the check information of each designated block requested by the second device and the check information of each designated block locally stored by the first device, wherein the check information of each designated block stored by the second device is requested by the first device to the second device after receiving all the file blocks.
This specification provides a file verification device, including:
the sending module is used for sending a transmission request for acquiring a file to the second equipment by the first equipment through a block chain transmission network (BTN) so as to enable the second equipment to return file metadata corresponding to the file;
the first determining module is used for determining the block information corresponding to the file according to the file metadata;
the 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 file block;
the receiving module is used for determining and storing the verification information corresponding to each received file block if the file block is determined to be a predetermined specified block;
and the verification module requests the verification information of each appointed block from the second equipment after receiving all the file blocks, and verifies whether the received file is complete or not according to the verification information of each appointed block requested from the second equipment and the verification information of each appointed block locally stored by the first equipment.
Optionally, the receiving module is specifically configured to forward, through the BTN, the request for obtaining the check information of each designated block to the second device, so as to request, from the second device, the check information of each designated block.
Optionally, the receiving module is specifically configured to select, as the designated blocks, file blocks with block numbers arranged in a first order and a last order, and K file blocks with block numbers arranged between the first order and the last order, where K is a positive integer and K +2 is smaller than the number of the file blocks.
This specification provides a file verification device, including:
the second device receives a transmission request for acquiring a file, which is sent by the first device through a block chain transmission network (BTN), and sends file metadata of the file to the first device, so that the first device determines block information corresponding to the file according to the file metadata;
the storage module is used for determining each file block and sending the file block to the first equipment according to the block information sent by the first equipment through a block chain transmission network (BTN), and storing the verification information corresponding to each determined file block;
and the returning module is used for responding to a request of the first equipment for acquiring the check information of the specified blocks and returning the check information of each specified block to the first equipment so that the first equipment can verify whether the received file is complete according to the check information of each specified block requested by the second equipment and the check information of each specified block locally stored by the first equipment, wherein the check information of each specified block stored by the second equipment is requested by the first equipment to the second equipment after the first equipment receives all the file blocks.
The present specification provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the above-described method of file verification.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the file verification method described above when executing the program.
The technical scheme adopted by the specification can achieve the following beneficial effects:
in the method for checking a file provided in this specification, a first device determines, for each file partition sent by a second device, whether the file partition is a predetermined designated partition, and if so, stores checking information corresponding to the file partition, where the number of designated partitions is less than the number of all file partitions. And after receiving all the file blocks, the first device requests the check information of all the appointed blocks from the second device, and verifies whether the received file is complete or not according to the check information of the appointed blocks requested from the second device and the check information of the appointed blocks locally stored by the first device.
According to the method, in the process of integrity verification, whether the received file is complete can be verified only according to the verification information locally stored in part of the file blocks (namely, the designated blocks) and the verification information requested from the second device, and compared with the existing scheme that whether the received file is complete is verified according to the verification information of all the file blocks, the method greatly reduces the time required by file verification, and therefore the efficiency of file verification is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the specification and not to limit the specification in a non-limiting sense. On the attached sheet
In the figure:
FIG. 1 is a schematic flow chart diagram of a method for verifying a file provided in the present specification;
FIG. 2 is a schematic flow chart of a method for verifying a file provided in the present specification;
FIG. 3 is a schematic flow chart of file verification provided herein;
FIG. 4 is a schematic view of a document verification apparatus provided herein;
FIG. 5 is a schematic diagram of a document verification apparatus provided herein;
fig. 6 is a schematic diagram of an electronic device corresponding to fig. 1 or fig. 2 provided in the present specification.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without making any creative effort belong to the protection scope of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a file verification method provided in this specification, including the following steps:
s100: the first device sends a transmission request for acquiring the file to the second device through a block chain transmission network (BTN) so that the second device returns file metadata corresponding to the file.
In the process of file transmission, when facing some larger files (such as files above 1 GB), if the second device sending the file directly transmits the whole file at one time, not only the excessive transmission resources (such as network bandwidth, device processor, device memory, etc.) will be occupied, but also a large amount of transmission time will be consumed, which greatly affects the transmission efficiency of the file.
Therefore, the files to be transmitted can be partitioned according to a certain size, each partition is a file partition, the file partitions are transmitted respectively, and after the first device receives all the file partitions, the file partitions can be combined to obtain a complete file.
After the first device receiving the file receives all the file blocks, the first device further needs to perform integrity check on the received file to ensure that the received file is an integral file, and a certain time is consumed in the process of performing integrity check on the file. Based on this, in order to reduce the time for performing integrity check on the file, thereby improving the overall efficiency of file transmission, the present specification provides a method for file check, in which a first device receiving the file may first send a transmission request of the file to a second device transmitting the file.
In this specification, the first device and the second device may be terminal devices such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, and a server, so as to perform file transmission between different devices, and of course, the execution main body for acquiring a file may also be a client installed in the terminal device, which is not limited in this specification.
The first device and the second device may be different combinations of the terminal devices, such as a combination of a mobile phone and a tablet computer, so as to implement file transmission between the terminal devices, or may also be a combination of a mobile phone and a server, so as to implement file downloading from the server by the mobile phone, or of course, may also be a combination between the server and the server.
The first device sends the Transmission request to a block chain Transmission Network (BTN) first, so that the Transmission request is forwarded to the second device through the BTN, and Transmission efficiency and information safety in a file Transmission process are guaranteed. The BTN network is a dedicated data transmission network, which is composed of a plurality of nodes with high computational power, high reliability and high stability, and is specially used for data transmission of a block chain to ensure security and integrity in a data transmission process. Therefore, the first device and the second device may also be devices provided at two nodes in the BTN network.
Since the second device has previously stored therein the file to be transmitted and the file metadata of the file (such as the file size (file _ size) of the file, the Etag tag (file _ Etag) of the file, the data distribution information of the file, etc.), after the second device receives the transmission request, the file metadata may be returned to the first device.
Of course, in practical applications, the second device may 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 does not actively send a transmission request to the second device, so the second device may also not send the 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.
S102: and determining the block information corresponding to the file according to the file metadata.
After the first device receives the file metadata returned by the second device, the blocking information of the file can be determined according to the file metadata.
Specifically, the first device may determine the number of the blocks according to the size of the file, for example, the first device may preset the size of each file block to determine the number of the blocks, where when the whole file is large, the number of the blocks is also relatively large, and when the whole file is small, the number of the blocks is relatively small.
For another example, the first device may directly set the number of blocks, so that when the whole file is large, each block is relatively large, and when the whole file is small, each block is relatively small.
In addition, the first device may also number each file partition according to the actual sequence corresponding to each partition, so as to obtain partition information including a partition number, the number of partitions, and an offset position corresponding to each file partition.
Since it takes too much time to check all the file blocks, the first device may select a part of the file blocks from the file blocks and check only the part of the file blocks.
Specifically, the first device may determine the block numbers of the designated blocks from the block numbers corresponding to the file blocks, and store the block numbers of the designated blocks.
In the process of determining the designated blocks, a part of file blocks can be randomly selected from all the file blocks to serve as the designated blocks, but the number of the designated blocks is smaller than the total number of all the file blocks.
Of course, the first device may also select, as the designated blocks, the file blocks with the block numbers arranged at the first and last bits, and K file blocks with the block numbers arranged between the first and last bits, where K is a positive integer and K +2 is smaller than the number of the file blocks.
It should be emphasized that, in order to improve the efficiency of the subsequent file verification, the value K is less than the number of file blocks except for the file block with the first and last block number, and thus, the value K +2 is less than the total number of file blocks.
In the actual application process, the K value may be different every time the file is transferred, and in addition, when determining the designated block, the first device may randomly select each file block with the block number between the first bit and the last bit. The larger the K value is, the lower the efficiency of subsequent integrity verification will be, but the higher the verification accuracy will be, and conversely, the smaller the K value is, the higher the efficiency of subsequent integrity verification will be, but the lower the verification accuracy will be.
Furthermore, each node in the BTN network has high computational power and stability, and in the verification process, the other file blocks except the K designated blocks are hardly abnormal in the transmission process, so that whether the received file is complete can be judged only by performing integrity verification on the K designated files.
It should be noted that, at this time, the second device has not sent the file partition to the first device, so the specified partition determined here may be a partition number corresponding to the specified partition.
S104: and 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 the file block.
After determining the block information, the first device may first send the block information to the BTN, and then the BTN forwards the block information to the second device.
After receiving the blocking information, the second device may read each corresponding file block in the blocking information according to the offset position corresponding to each file block in the blocking information, so as to determine each file block, thereby completing the blocking processing on the file.
In the process of determining each file block, the second device may further determine check information corresponding to each file block, specifically, the second device may determine the check information corresponding to each file block through a preset encryption Algorithm, where the preset encryption Algorithm may include an information Digest Algorithm (MD5 Message-Digest Algorithm, MD5), MD4, a Secure Hash Algorithm (SHA), and the like, which is not specifically limited in this specification.
Preferably, the second device may hash each file partition by using an MD5 algorithm, so as to obtain an MD5 value corresponding to each file partition, and the MD5 value may serve as the check information corresponding to each file partition.
And then, the second device can store the verification information corresponding to each file block and send each file block to the first device. The second device may sequentially send the file chunks in a specified order, where the order may be a numbering order of chunk numbers corresponding to each file chunk. Of course, the second device may also randomly send each file block to the first device. The second device may calculate and store the check information corresponding to the file chunk every time the second device sends a file chunk to the first device.
In the actual transmission process, the second device may determine the number of the chunks that need to be sent each time according to the limitation of the transmission resource, for example, if the current transmission bandwidth only allows to send 5 file chunks at most each time, the number of the file chunks when the second device sends the file chunks to the first device each time is less than or equal to 5 until all the file chunks are sent. Of course, if the actual transmission resource allows, the second device may also send all the file blocks to the first device at one time. The specific number of each transmission may be set according to actual conditions, and this specification is not particularly limited thereto.
S106: and for each received file block, if the file block is determined to be a predetermined specified block, determining and storing the verification information corresponding to the file block.
When the second device transmits a file to the first device, for each file partition received by the first device, the first device may first determine whether the received file partition is a predetermined designated partition (that is, determine whether a partition number corresponding to the file partition is a previously stored partition number corresponding to the designated partition), and if so, the first device may determine and store check information corresponding to the file partition, where a manner of determining, by the first device, the check information corresponding to the file partition is the same as that of the second device, and this description is not repeated herein.
S108: after receiving all the file blocks, requesting the check information of each designated block from the second device, and verifying whether the received file is complete according to the check information of each designated block requested from the second device and the check information of each designated block locally stored by the first device.
After the first device receives all the file blocks, the file blocks can be combined into a complete file according to the actual sequence, and integrity check is performed on the file, so that the received file is ensured to be consistent with the file sent by the second device.
Specifically, the first device may send a request for obtaining the verification information of the specified file to the BTN, so as to forward the request to the second device through the BTN, thereby requesting the verification information of each specified chunk from the second device.
After the second device receives the request, the second device stores the block numbers corresponding to the specified blocks in advance, so that the second device can directly send the verification information of the file blocks corresponding to the block numbers to the first device. For example, there are 10 file blocks and corresponding block numbers, and if it is determined that the number of the designated block is 1, 3, 5, 7, or 10, the second device may directly send the verification information corresponding to the file block with the number of 1, 3, 5, 7, or 10 to the first device after receiving the request sent by the first device.
After receiving the check information of each designated block, the first device may verify whether the received file is complete according to the check information of each designated block requested from the second device and the check information of each designated block locally stored by the first device.
If the check information of each specified block requested by the second device is matched with the check information of each specified block locally stored by the first device one by one, the received complete file is determined, and if the check information of one specified block is not matched, the received file is not complete.
In addition, the first device may further arrange check information corresponding to each designated block according to a designated sequence (e.g., a sequence of block numbers) to obtain an entire check information, and determine whether the received file is complete according to the entire check information arranged by the check information stored locally in the first device and the entire check information arranged by the check information requested from the second device, and determine that the complete file is received if the two entire check information are consistent.
On the basis, whether the received file is complete or not is further verified according to the overall size of the received file and the size of the file in the file metadata, and if the overall size of the received file is consistent with the size of the source file in the file metadata, the received file is indicated to be a complete file.
And when the first equipment determines that the received file is a complete file, the file transmission is finished.
If the first device determines that the received file is incomplete through the integrity check, the transmission request can be sent to the second device again to obtain the complete file again.
The method for verifying the file provided in the present specification has been described above with the first device as the execution subject, and the present specification will be further described with the second device as the execution subject, as shown in fig. 2.
Fig. 2 is a schematic flowchart of a file verification method provided in this specification.
S200: the second device receives a transmission request for acquiring the file, which is sent by the first device through a block chain 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 according to the file metadata.
After the first device sends a file transmission request through the BTN, the second device may send file metadata of the file to the first device, and then the first device may determine, according to the file metadata, blocking information corresponding to the file, determine a designated block, and send the blocking information to the second device.
S202, according to the block information sent by the first device through the block chain transmission network BTN, determining each file block and sending the file block to the first device, and storing the verification information corresponding to each determined file block.
After the second device receives the blocking information, the second device can perform blocking processing on the file according to the blocking information, so that each file block is determined, the check information corresponding to each file block is calculated and stored, and then each file block is sent to the first device.
When the first device receives each block, it may be determined that each file block is received, and for each received file block, if the first device determines that the file block is an appointed block, the first device may determine the verification information corresponding to the file block, and store the verification information locally. Wherein the number of the specified blocks is less than the number of all file blocks.
S204: and in response to a request for acquiring the check information of the designated blocks by the first device, returning the check information of each designated block to the first device, so that the first device verifies whether the received file is complete according to the check information of each designated block requested by the second device and the check information of each designated block locally stored by the first device, wherein the check information of each designated block stored by the second device is requested by the first device to the second device after receiving all the file blocks.
And when the first equipment receives all the file blocks, sending a request for acquiring the verification information corresponding to each appointed block to the second equipment.
After receiving the request, the second device sends the verification information corresponding to the specified blocks to the first device, so that the first device verifies whether the received file is complete or not according to the verification information of the specified blocks and the verification information of the specified blocks stored locally by the first device.
For easy understanding, the present specification provides a schematic flow chart of file transmission, as shown in fig. 3.
Fig. 3 is a schematic diagram of a file transmission process provided in this specification.
The first equipment sends a transmission request of the file to the second equipment through the BTN, the second equipment returns file metadata of the file to the first equipment according to the transmission request, and then the first equipment determines the block information of the file and determines the number of the specified block according to the file metadata.
And then the first equipment can forward a block request carrying block information through the BTN so as to request each file block to the second equipment, and the second equipment determines each file block and check information corresponding to each file block according to the block information of the file and then sequentially sends each file block to the first equipment.
The first device judges whether the number corresponding to each received file block is the number corresponding to the designated block or not, if so, the first device determines the verification information corresponding to the file block locally through a preset encryption algorithm and stores the verification information locally.
If the first device receives all the file blocks, checking information of the designated blocks is requested to the second device through the BNT, after the first device obtains the checking information corresponding to the designated blocks, if the checking information stored locally is determined to be consistent with the checking information requested from the second device, the size of the received whole file is further compared with the size of the file sent by the second device, if the size is also consistent, the checking is successful, and if the checking information is not consistent or the file sizes are not consistent, the checking is failed.
According to the method, in the process of integrity verification, whether the received file is complete can be verified only by locally storing the verification information and the requested verification information according to partial file blocks (namely, the designated blocks).
In addition, in the process of file transmission, the blocking information is determined by the first device according to the requested file metadata, the second device only needs to read each file block according to the blocking information, and the second device is not needed to determine how to block, so that the overall efficiency of file transmission is further improved.
Based on the same idea, the present specification also provides a corresponding file verification apparatus, as shown in fig. 4.
Fig. 4 is a schematic diagram of a file verification apparatus provided in this specification, including:
a sending module 400, where a first device sends a transmission request for obtaining a file to a second device through a block chain transmission network BTN, so that the second device returns file metadata corresponding to the file;
a first determining module 402, configured to determine, according to the file metadata, blocking information corresponding to the file;
a second determining module 404, configured to forward the block information to the second device through the BTN, so that the second device determines and sends each file block according to the block information;
a receiving module 406, configured to determine and store, for each received file partition, verification information corresponding to the file partition if the file partition is determined to be a predetermined specified partition;
the verifying module 408, after receiving all the file blocks, requests the verification information of each designated block from the second device, and verifies whether the received file is complete according to 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.
Optionally, the receiving module 406 is specifically configured to forward, through the BTN, a request for obtaining the check information of each specified block to the second device, so as to request the check information of each specified block from the second device.
Optionally, the receiving module 406 is specifically configured to select, as the designated blocks, file blocks with block numbers arranged in the first and last bits, and K file blocks with block numbers arranged between the first and last bits, where K is a positive integer and K +2 is less than the number of the file blocks.
Fig. 5 is a schematic diagram of a file verification apparatus provided in this specification, including:
a sending module 500, where a second device receives a transmission request for obtaining a file sent by a first device through a block chain transmission network BTN, and sends file metadata of the file to the first device, so that the first device determines blocking information corresponding to the file according to the file metadata;
the storage module 502 is configured to determine each file partition and send the file partition to the first device according to the partition information sent by the first device through the block chain transmission network BTN, and store the verification information corresponding to each determined file partition;
a returning module 504, configured to, in response to a request for acquiring the check information of the designated block by the first device, return the check information of each designated block to the first device, so that the first device verifies whether the received file is complete according to the check information of each designated block requested by the second device and the check information of each designated block locally stored in the first device, where the check information of each designated block stored in the second device is requested by the first device to the second device after the first device receives all the file blocks.
The present specification also provides a computer readable storage medium storing a computer program, which can be used to execute a method of file verification as provided in fig. 1 or fig. 2.
The present specification also provides a schematic block diagram of an electronic device corresponding to fig. 1 or fig. 2 shown in fig. 6. As shown in fig. 6, 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 hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs the computer program to implement the file checking method described in fig. 1 or fig. 2. Of course, besides the software implementation, this specification does not exclude other implementations, such as logic devices or combination of software and hardware, and so on, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical blocks. For example, a Programmable Logic Device (PLD) (e.g., a Field Programmable Gate Array (FPGA)) is an integrated circuit whose Logic functions are determined by a user programming the Device. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, 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 which include, but are not limited to, the following microcontrollers: the ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, 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.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the system embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A method for file verification, the method being applied to a first device receiving a file, comprising:
the method comprises the steps that a first device sends a transmission request for obtaining a file to a second device through a block chain transmission network (BTN) so that the second device returns file metadata corresponding to the file;
according to the file metadata, determining the block information corresponding to the file;
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 the file block;
for each received file block, if the file block is determined to be a predetermined specified block, determining and storing check information corresponding to the file block;
after receiving all the file blocks, requesting the check information of each designated block from the second device, and verifying whether the received file is complete according to the check information of each designated block requested from the second device and the check information of each designated block locally stored by the first device.
2. The method according to claim 1, wherein requesting the verification information of each designated block from the second device specifically includes:
and forwarding the request for acquiring the check information of each designated block to the second equipment through the BTN so as to request the check information of each designated block from the second equipment.
3. The method of claim 1, wherein determining each designated partition specifically comprises:
selecting the file blocks with the block numbers arranged at the first and the last positions and K file blocks with the block numbers arranged between the first and the last positions as designated blocks, wherein K is a positive integer, and K +2 is smaller than the number of the file blocks.
4. A file verification method is applied to a second device for transmitting files, and comprises the following steps:
the method comprises the steps that a second device receives a transmission request, sent by a first device through a block chain transmission network (BTN), for acquiring a file, and sends file metadata of the file to the first device, so that the first device determines block information corresponding to the file according to the file metadata;
determining each file block and sending the file block to the first equipment according to the block information sent by the first equipment through a block chain transmission network (BTN), and storing the verification information corresponding to each determined file block;
and in response to a request for acquiring the check information of the designated blocks by the first device, returning the check information of each designated block to the first device, so that the first device verifies whether the received file is complete according to the check information of each designated block requested by the second device and the check information of each designated block locally stored by the first device, wherein the check information of each designated block stored by the second device is requested by the first device to the second device after receiving all the file blocks.
5. An apparatus for file verification, comprising:
the sending module is used for sending a transmission request for acquiring a file to the second equipment by the first equipment through a block chain transmission network (BTN) so as to enable the second equipment to return file metadata corresponding to the file;
the first determining module is used for determining the block information corresponding to the file according to the file metadata;
the 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 file block;
the receiving module is used for determining and storing the verification information corresponding to each received file block if the file block is determined to be a predetermined specified block;
and the verification module requests the verification information of each appointed block from the second equipment after receiving all the file blocks, and verifies whether the received file is complete or not according to the verification information of each appointed block requested from the second equipment and the verification information of each appointed block locally stored by the first equipment.
6. The apparatus according to claim 5, wherein the verification module is specifically configured to forward, through the BTN, the request for obtaining the verification information of each of the designated blocks to the second device, so as to request the verification information of each of the designated blocks from the second device.
7. The apparatus according to claim 6, wherein the receiving module is specifically configured to select, as the designated blocks, the file blocks with the block numbers arranged in the first and last order, and K file blocks with the block numbers arranged between the first and last order, where K is a positive integer and K +2 is smaller than the number of the file blocks.
8. An apparatus for file verification, comprising:
the second device receives a transmission request for acquiring a file, which is sent by the first device through a block chain transmission network (BTN), and sends file metadata of the file to the first device, so that the first device determines block information corresponding to the file according to the file metadata;
the storage module is used for determining each file block and sending the file block to the first equipment according to the block information sent by the first equipment through a block chain transmission network (BTN), and storing the verification information corresponding to each determined file block;
and the returning module is used for responding to a request of the first equipment for acquiring the check information of the specified blocks and returning the check information of each specified block to the first equipment so that the first equipment can verify whether the received file is complete according to the check information of each specified block requested by the second equipment and the check information of each specified block locally stored by the first equipment, wherein the check information of each specified block stored by the second equipment is requested by the first equipment to the second equipment after the first equipment receives all the file blocks.
9. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method of any one of the preceding claims 1 to 4.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of claims 1 to 4 when executing the program.
CN202210632963.8A 2022-06-06 2022-06-06 File checking method and device Pending CN115129728A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210632963.8A CN115129728A (en) 2022-06-06 2022-06-06 File checking method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210632963.8A CN115129728A (en) 2022-06-06 2022-06-06 File checking method and device

Publications (1)

Publication Number Publication Date
CN115129728A true CN115129728A (en) 2022-09-30

Family

ID=83377139

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210632963.8A Pending CN115129728A (en) 2022-06-06 2022-06-06 File checking method and device

Country Status (1)

Country Link
CN (1) CN115129728A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116737457A (en) * 2023-06-16 2023-09-12 深圳市青葡萄科技有限公司 Data verification method based on distributed storage

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116737457A (en) * 2023-06-16 2023-09-12 深圳市青葡萄科技有限公司 Data verification method based on distributed storage
CN116737457B (en) * 2023-06-16 2024-03-08 深圳市青葡萄科技有限公司 Data verification method based on distributed storage

Similar Documents

Publication Publication Date Title
CN107040585B (en) Service checking method and device
CN107395665B (en) Block chain service acceptance and service consensus method and device
KR102152556B1 (en) Service processing and consensus method and device
JP6940615B2 (en) Data processing methods and devices
CN107450979B (en) Block chain consensus method and device
KR20190096391A (en) Database status determination method and device, and consistency verification method and device
CN113079200A (en) Data processing method, device and system
CN112087530B (en) Method, device, equipment and medium for uploading data to block chain system
CN110781192B (en) Verification method, device and equipment of block chain data
CN112214519B (en) Data query method, device, equipment and readable medium
CN111767144A (en) Transaction routing determination method, device, equipment and system for transaction data
CN109145053B (en) Data processing method and device, client and server
CN116405554A (en) Network communication method and device, storage medium and electronic equipment
CN110989934B (en) Block chain link point data storage method, block chain system and block chain node
CN111355672A (en) Message forwarding method and device
CN115129728A (en) File checking method and device
CN116305298B (en) Method and device for managing computing power resources, storage medium and electronic equipment
CN115174553A (en) File transmission method and device
CN111796864A (en) Data verification method and device
CN110995447B (en) Data storage method, device, equipment and medium
CN112596733A (en) Method, device, storage medium and electronic equipment for compiling and acquiring file
CN116127148B (en) Data trusted storage method and device, storage medium and electronic equipment
CN115118711A (en) File transmission method and device
CN115134349B (en) Method, device, medium and equipment for executing transmission task
WO2024092932A1 (en) Transaction execution method and blockchain node

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination