File transmission method, computer readable medium and equipment

By embedding preset password bytes in file transfer and combining multi-threaded transmission and retransmission mechanisms, data integrity and security issues in file transfer are solved, improving the security and reliability of transmission.

CN120281764APending Publication Date: 2025-07-08XIAMEN RGBLINK SCI & TECH CO LTD

Patent Information

Application Number
CN202510753587.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

Existing file transfer technology cannot effectively detect the integrity and security of sharded data in an open network environment, and it is prone to packet loss due to network problems, affecting the accuracy and reliability of the data.

Method used

By hashing the slice file and embedding preset password bytes, using multi-threaded concurrent transmission and retransmission mechanisms, the receiver performs hash comparison to confirm that the transmission is successful or triggers the retransmission request.

Benefits of technology

It realizes data integrity verification and tamper-proof, improves transmission security, and reduces the impact of packet loss on transmission through multi-threaded transmission, and improves reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120281764A_ABST
    Figure CN120281764A_ABST
Patent Text Reader

Abstract

The invention discloses a file transmission method, a computer readable medium and equipment, the file transmission method is applied to file synchronization equipment, preset password bytes are pre-stored in the file synchronization equipment, a file to be transmitted is sliced, and a sliced file set is generated; performing Hash calculation on each slice file in the slice file set to generate a first Hash value set, the Hash calculation of the slice files including embedding preset password bytes in file data; sending the first hash set to another file synchronization device; and sending the slice files in the slice file set to another file synchronization device through multi-thread concurrent transmission, so that the other file synchronization device performs hash verification on the slice files in combination with pre-stored preset password bytes, and when the verified hash value set is matched with the corresponding hash value in the first hash value set, transmission succeeds. Otherwise, triggering a retransmission request of the corresponding slice. According to the transmission method disclosed by the invention, double improvement of safety and reliability is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of file transmission, and in particular, to a file transmission method, a computer-readable medium, and a device. Background Art

[0002] With the rapid development of cloud storage and file transmission technologies, users have put forward higher requirements for the efficiency, reliability, and security of file transmission. As shown in a file transmission method and device disclosed in a Chinese patent application with publication number CN119652883A, based on the resumable upload method, it optimizes the transmission process by slicing files and using historical upload information. Its core idea is that when the file to be uploaded meets the conditions for resumable upload, the file is divided into multiple slices to generate a slice set, and an upload secret key is generated for the slice set; the matching slice set is screened out from the historical upload information through the upload secret key and slice parameters, and after determining the differential slices, the differential slice data is uploaded using multiple threads, and the historical slices and the differential slices are merged into the target file. This method can effectively utilize the slices uploaded historically and avoid the waste of storage space and consumption of traffic resources caused by repeated uploads. However, in practical applications, it still has the following problems: it mainly focuses on the matching of slices and the upload of differential slices, but does not perform integrity verification on the slice data during the transmission process; when the slices are tampered with or damaged during the transmission process, it is impossible to effectively detect and ensure the correctness of the data. Especially in an open network environment, the data security cannot be fully guaranteed. In addition, during the file transmission process, due to factors such as network congestion and line problems, packet loss often occurs. Packet loss refers to the situation where some data packets fail to reach the destination successfully during the data transmission process, resulting in incomplete received data and affecting the accuracy and reliability of the data. Summary of the Invention

[0003] To solve the above technical problems, the present invention provides a file transmission method, a computer-readable medium, and a device. Among them, the file transmission method is applied to a file synchronization device, and the file synchronization device pre-stores preset password bytes. The method includes: Slice the file to be transmitted to generate a slice file set; Perform a hash calculation on each slice file in the slice file set to generate a first hash value set, where the hash calculation of the slice file includes embedding the preset password bytes in the file data; Send the first hash set to another file synchronization device; Send the slice files in the slice file set to another file synchronization device through multi-threaded concurrent transmission, so that the other file synchronization device combines the pre-stored preset password bytes to perform hash verification on the slice files. When the verified hash value set matches the corresponding hash value in the first hash value set, it is confirmed that the transmission is successful; otherwise, a retransmission request for the corresponding slice file is triggered.

[0004] Preferably, the method for embedding the preset password bytes includes: inserting the preset password bytes at the head and / or tail of the slice file.

[0005] Preferably, the method for performing hash verification on the slice files includes: Performing hash calculation on the received slice files using the same password byte embedding rule as the preset password bytes to generate a second hash value set; Comparing the second hash value set with the first hash value set item by item; When there is a mismatched hash value, send a retransmission instruction containing the slice file number to the file synchronization device.

[0006] Preferably, the size of the slice data is 1M - 6M.

[0007] The present invention provides a file transmission method applied to a file synchronization device. The file synchronization device pre-stores preset password bytes. The method includes: Receiving a first hash set and a slice file set sent by another file synchronization device. The slice file set is generated by the other file synchronization device slicing the file to be transmitted, and the first hash set is generated by the other file synchronization device performing hash calculation on each slice file in the slice file set, where the hash calculation of the slice file includes embedding preset password bytes in the file data; Combining the pre-stored preset password bytes to perform hash verification on the slice files. When the verified hash value set matches the corresponding hash value in the first hash value set, it is confirmed that the transmission is successful; otherwise, a retransmission request for the corresponding slice file is triggered.

[0008] Preferably, the method for embedding the preset password bytes includes: inserting the preset password bytes at the head and / or tail of the slice file.

[0009] Preferably, the method for performing hash verification on the slice files includes: Performing hash calculation on the received slice files using the same password byte embedding rule as the preset password bytes to generate a second hash value set; Comparing the second hash value set with the first hash value set item by item; When there is a mismatched hash value, send a retransmission instruction containing the slice file number to the file synchronization device.

[0010] Preferably, the size of the slice data is 1M - 6M.

[0011] The present invention provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, the file transfer method described above is implemented.

[0012] The present invention provides a file synchronization device that employs the file transfer method described above, including: A storage unit that pre-stores preset password bytes; A processing unit configured to slice the file to be transferred to generate a set of sliced files; A calculation unit configured to perform a hash calculation on each sliced file in the set of sliced files to generate a first set of hash values, wherein the hash calculation includes embedding the preset password bytes in the storage unit into the sliced file data; A communication unit configured to transmit the first set of hash values and the set of sliced files to another file synchronization device, or receive the first set of hash values and the set of sliced files sent by another file synchronization device; A verification unit configured to perform a hash calculation on the set of sliced files in the receiving mode, wherein the hash calculation includes embedding the preset password bytes in the storage unit into the sliced file data, and comparing the calculation result with the first set of hash values, and generating a retransmission request or a transmission completion confirmation signal according to the comparison result.

[0013] The file transfer method provided by the present invention realizes a double improvement in transmission security and reliability by combining file slicing processing with preset password bytes and through a multi-threaded transmission and retransmission mechanism. Description of the Drawings

[0014] Figure 1 It is a flowchart of an embodiment of the file transfer method provided by the present invention; Figure 2 It is a flowchart of another embodiment of the file transfer method provided by the present invention; Figure 3 It is a block diagram of the file synchronization device provided by the present invention. Detailed Embodiments

[0015] In order to make the technical means, creative features, achieved objectives and functions realized by the present invention easy to understand, the following describes the present invention in further detail with reference to specific embodiments. However, the following embodiments are only the preferred embodiments of the present invention, not all of them. Based on the embodiments in the implementation manners, other embodiments obtained by those skilled in the art without creative efforts all fall within the protection scope of the present invention. The experimental methods in the following embodiments are all conventional methods unless otherwise specified. The materials, reagents, etc. used in the following embodiments can all be obtained from commercial channels unless otherwise specified.

[0016] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "upper", "lower", "inner", "outer", "front end", "rear end", "both ends", "one end", "the other end", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation to the present invention. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.

[0017] In the description of the present invention, it should be noted that unless otherwise clearly specified and defined, the terms "installed", "provided with", "connected", etc. should be understood in a broad sense. For example, "connected" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal connection of two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.

[0018] In addition, the drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus the repeated description thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0019] The present invention provides an embodiment of a file transmission method, a computer-readable medium, and a device. Among them, the file transmission method is applied to a file synchronization device. The file synchronization device prestores preset password bytes. The method includes: Slice the file to be transmitted to generate a set of sliced files; Perform hash calculation on each slice file in the slice file set to generate a first hash value set, where the hash calculation of the slice file includes embedding preset password bytes in the file data; Send the first hash set to another file synchronization device; Send the slice files in the slice file set to another file synchronization device through multi-threaded concurrent transmission, so that the other file synchronization device performs hash verification on the slice files in combination with the preset password bytes stored in advance. When the verified hash value set matches the corresponding hash values in the first hash value set, it is confirmed that the transmission is successful; otherwise, a retransmission request for the corresponding slice file is triggered.

[0020] Specifically, as Figure 1 shown, the file transmission method is applied to a file synchronization device, and the file synchronization device includes but is not limited to a local synchronization device and a cloud synchronization device; the file synchronization device stores preset password bytes in advance, and the method includes: Slice the file to be transmitted to generate a slice file set. In this step, a fixed slice size can be set in advance, and the slice size includes but is not limited to 1M - 10M, such as 1MB, 2M, 3M, 4M, etc.; the method of slicing the file belongs to the prior art and will not be elaborated here; taking a file to be transmitted of 199.6M as an example, slice it with a slice size of 2M, and the slice file sizes are file a1 (2M), file a2 (2M)... file a99 (2M), file a100 (1.6M). When the size of the last slice is less than the set slice size, directly take the actual size as the size of the last slice. In this way, the original file is split into 100 slice files, where the sizes of the first 99 slice files are all 2M, and the size of the last slice file is 1.6M; Perform hash calculation on each slice file in the slice file set to generate a first hash value set, where the hash calculation of the slice file includes embedding preset password bytes in the file data. In this step, the method of embedding preset password bytes includes: the file synchronization devices agree in advance to insert preset password bytes at the head and / or tail of the slice file; if it is agreed to insert preset password bytes at the head of the slice file, when the file is sent, hash the slice file with the preset password inserted at the head, and the hash algorithm includes but is not limited to SHA-224, SHA-256, SHA-384, and SHA-512; if SHA-256 is used to hash the above slice file set, the first hash value set generated includes hash values K1, K2,... K99, K100; Send the first hash set (hash values K1, K2,... K99, K100) to another file synchronization device; The sliced files in the sliced file set (file a1 (2M), file a2 (2M),... file a99 (2M), file a100 (1.6M)) are sent to another file synchronization device through multi-threaded concurrent transmission, so that the other file synchronization device performs hash verification on the sliced files in combination with the preset password bytes stored in advance. When the set of verified hash values matches the corresponding hash values in the first hash value set, it is confirmed that the transmission is successful; otherwise, a retransmission request for the corresponding sliced file is triggered. In this step, the number of transmission threads can be set to include, but not limited to, 3, 4, 5, etc. When starting file transmission, multiple threads are automatically enabled and process the sending task. When a thread finishes sending the current slice, it releases the thread and automatically starts sending the next slice until all sliced files are sent. The other file synchronization device receives the sliced files and performs hash verification on the sliced files in combination with the same preset password bytes as those of the sending-end file synchronization device stored in advance. Specifically, in this step, the method for performing hash verification on the sliced files includes: performing hash calculation on the received sliced files by using the same preset password as that of the sending-end file synchronization device and the same password byte embedding rule to generate a second hash value set (hash value H1, hash value H2,..., hash value H99, hash value H100). Compare the second hash value set (hash value H1, hash value H2,..., hash value H99, hash value H100) with the first hash value set (hash value K1, hash value K2,..., hash value K99, hash value K100) item by item. When there are mismatched hash values, send a retransmission instruction containing the sliced file number to the file synchronization device until the entire file transmission is completed.

[0021] The file transmission method provided by the embodiment of the present invention realizes a double improvement in transmission security and reliability by combining file slicing processing with preset password bytes and through multi-threaded transmission and retransmission mechanisms. The specific technical effects are reflected in the following aspects: Data integrity verification and anti-tampering enhancement By embedding preset password bytes into the hash calculation process of sliced files, a double security verification system is constructed: on the one hand, the preset password bytes participate in the hash operation as the only key, so that each slice generates a first hash value with device feature recognition, and attackers cannot forge valid hash values without knowing the password bytes; on the other hand, the receiving end realizes shard-level integrity verification by comparing the hash value sets, can accurately identify the shard data tampered with or damaged during transmission, and avoid synchronizing junk files from insecure or untrusted devices. Compared with the traditional verification method that only relies on shard matching, this mechanism refines the tampering detection granularity to the data bit level of a single shard, and can effectively resist man-in-the-middle attacks and data pollution in an open network environment.

[0022] Improving Transmission Reliability Against Packet Loss The multi-threaded concurrent transmission mechanism synergizes with file fragmentation and retransmission strategies: By transmitting fragmented data in parallel through multiple threads, not only is the overall transmission efficiency significantly improved, but more importantly, the impact range of packet loss in a single transmission channel is reduced through fragmented transmission; When the receiving end detects a hash value mismatch, it can locate the damaged or lost fragments and trigger a targeted retransmission request, avoiding the full retransmission caused by the overall verification failure in traditional resume-download technology; In an environment with the same network packet loss rate, this mechanism can improve the effective transmission success rate and reduce the amount of retransmitted data.

[0023] Preferably, the file synchronization device at the sending end and / or the receiving end detects the network situation. When the file synchronization device at the sending end determines that the network is abnormal or there is a sudden power failure, it releases the task and stops sending slices, and starts a timing task to attempt to restart the synchronization task at a set periodic time (such as every 10 seconds, which can be set according to the actual situation); A large file synchronization setting must be completed within a set time (such as seven days, which can be set according to the actual situation). If the synchronization cannot be completed within the set time, both the file synchronization devices at the sending end and the receiving end will delete all the slices that have been synchronized. If synchronization is still required, it needs to be manually initiated again to ensure the security of file transmission.

[0024] Preferably, the size of the sliced data is 1M - 6M. Within this fragmentation range, it is possible to effectively control the amount and / or number of data retransmissions caused by network anomalies while improving file transmission efficiency.

[0025] Preferably, in the above slicing step, the slice size can be adjusted according to factors such as network transmission speed, storage capacity, and performance of the file synchronization device. When processing a large number of files, it is possible to distribute the number of slices more evenly, facilitating subsequent multi-threaded transmission management.

[0026] An embodiment of the present invention provides a file transmission method, as Figure 2 shown, applied to a file synchronization device. The file synchronization device pre-stores preset password bytes. The method includes: Receiving a first hash set and a sliced file set sent by another file synchronization device. The sliced file set is generated by the other file synchronization device slicing the file to be transmitted. The first hash set is generated by the other file synchronization device performing a hash calculation on each sliced file in the sliced file set, where the hash calculation of the sliced file includes embedding preset password bytes in the file data; Perform hash verification on the sliced file in combination with pre-stored preset password bytes. When the verified hash value set matches the corresponding hash value in the first hash value set, confirm that the transmission is successful; otherwise, trigger a retransmission request for the corresponding sliced file. The file slicing and hash calculation methods in this embodiment are the same as those in the above embodiments and will not be elaborated here.

[0027] An embodiment of the present invention provides a computer-readable medium, on which a computer program is stored. When the computer program is executed by a processor, the file transmission method described above is implemented.

[0028] As Figure 3 shown, the present invention provides a file synchronization device, which adopts the file transmission method described above, including: A storage unit that pre-stores preset password bytes; A processing unit for slicing the file to be transmitted to generate a set of sliced files; A calculation unit for performing hash calculation on each sliced file in the set of sliced files to generate a first hash value set, where the hash calculation includes embedding the preset password bytes in the storage unit into the sliced file data; A communication unit for transmitting the first hash value set and the set of sliced files to another file synchronization device, or receiving the first hash value set and the set of sliced files sent by another file synchronization device; A verification unit for performing hash calculation on the set of sliced files in the receiving mode, where the hash calculation includes embedding the preset password bytes in the storage unit into the sliced file data, comparing the calculation result with the first hash value set, and generating a retransmission request or a transmission completion confirmation signal according to the comparison result.

[0029] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A file transfer method, applied to a file synchronization device, characterized in that, The file synchronization device pre-stores preset password bytes, and the method includes: Slice the file to be transmitted to generate a set of sliced files; Perform hash calculation on each sliced file in the set of sliced files to generate a first set of hash values, where the hash calculation of the sliced file includes embedding preset password bytes in the file data; Send the first hash set to another file synchronization device; Send the sliced files in the set of sliced files to another file synchronization device through multi-threaded concurrent transmission, so that the other file synchronization device combines the pre-stored preset password bytes to perform hash verification on the sliced files. When the verified set of hash values matches the corresponding hash values in the first set of hash values, it is confirmed that the transmission is successful; otherwise, a retransmission request for the corresponding sliced file is triggered.

2. The file transfer method according to claim 1, wherein: The method of embedding the preset password bytes includes: inserting the preset password bytes at the head and / or tail of the sliced file.

3. The file transfer method according to claim 1, wherein: The method of performing hash verification on the sliced files includes: Perform hash calculation on the received sliced files using the same password byte embedding rule as the preset password bytes to generate a second set of hash values; Compare the second set of hash values with the first set of hash values item by item; When there are mismatched hash values, send a retransmission instruction containing the sliced file number to the file synchronization device.

4. The file transfer method according to claim 1, wherein: The size of the sliced data is 1M - 6M.

5. A file transfer method, applied to a file synchronization device, characterized in that, The file synchronization device pre-stores preset password bytes, and the method includes: Receive the first hash set and the set of sliced files sent by another file synchronization device. The set of sliced files is generated by another file synchronization device slicing the file to be transmitted, and the first hash set is generated by another file synchronization device performing hash calculation on each sliced file in the set of sliced files, where the hash calculation of the sliced file includes embedding preset password bytes in the file data; Combine the pre-stored preset password bytes to perform hash verification on the sliced files. When the verified set of hash values matches the corresponding hash values in the first set of hash values, it is confirmed that the transmission is successful; otherwise, a retransmission request for the corresponding sliced file is triggered.

6. The file transfer method according to claim 5, wherein: The method of embedding the preset password bytes includes: inserting the preset password bytes at the head and / or tail of the sliced file.

7. The file transfer method according to claim 5, wherein: The method of performing hash verification on the sliced files includes: Perform hash calculation on the received sliced files using the same password byte embedding rule as the preset password bytes to generate a second set of hash values; Compare the second set of hash values with the first set of hash values item by item; When there are mismatched hash values, send a retransmission instruction containing the sliced file number to the file synchronization device.

8. The file transfer method according to claim 5, characterized in that: The size of the sliced data is 1M - 6M.

9. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the file transmission method according to any one of claims 1 - 8.

10. A file synchronization device, characterized in that, Adopt the file transmission method according to any one of claims 1 - 8, including: A storage unit that pre-stores preset password bytes; A processing unit for slicing the file to be transmitted to generate a set of sliced files; A calculation unit for performing hash calculation on each slice file in the slice file set to generate a first hash value set, where the hash calculation includes embedding preset password bytes in the storage unit into the slice file data; A communication unit for transmitting the first hash value set and the slice file set to another file synchronization device, or receiving the first hash value set and the slice file set sent by another file synchronization device; A verification unit for performing hash calculation on the slice file set in the receiving mode, where the hash calculation includes embedding preset password bytes in the storage unit into the slice file data, comparing the calculation result with the first hash value set, and generating a retransmission request or a transmission completion confirmation signal according to the comparison result.

Citation Information

Patent Citations

  • File transmission method and device

    CN119652883A

  • Secure file transmission management method and system

    CN109428899A

  • Wasm and web worker-based multi-thread file hashing method

    CN116933331A

  • File uploading method and computer equipment

    CN117857536A

  • Ultra-large file uploading method and device, electronic equipment and storage medium

    CN118660047A

Cited By

  • Data synchronization method and system

    CN120896949A