WO2022028486A1 - 共享文件的方法、装置和*** - Google Patents

共享文件的方法、装置和*** Download PDF

Info

Publication number
WO2022028486A1
WO2022028486A1 PCT/CN2021/110599 CN2021110599W WO2022028486A1 WO 2022028486 A1 WO2022028486 A1 WO 2022028486A1 CN 2021110599 W CN2021110599 W CN 2021110599W WO 2022028486 A1 WO2022028486 A1 WO 2022028486A1
Authority
WO
WIPO (PCT)
Prior art keywords
hash value
file
current
blockchain
package
Prior art date
Application number
PCT/CN2021/110599
Other languages
English (en)
French (fr)
Inventor
穆长春
狄刚
钱友才
卿苏德
陈庆接
杜金钊
Original Assignee
中国人民银行数字货币研究所
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
Priority claimed from CN202010772425.XA external-priority patent/CN111984612B/zh
Priority claimed from CN202010772434.9A external-priority patent/CN111984614B/zh
Priority claimed from CN202010772432.XA external-priority patent/CN111984613B/zh
Priority claimed from CN202010773252.3A external-priority patent/CN111984616B/zh
Application filed by 中国人民银行数字货币研究所 filed Critical 中国人民银行数字货币研究所
Priority to EP21852328.0A priority Critical patent/EP4180984A1/en
Publication of WO2022028486A1 publication Critical patent/WO2022028486A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the present disclosure relates to the field of computer technology, and in particular, to a method, apparatus and system for sharing files.
  • the first embodiment of the present disclosure provides a method and apparatus for sharing files, which can acquire files to be shared to form at least two file compression packages; perform blockchain uploading on the at least two file compression packages operation, and obtain at least two first hash values corresponding to the at least two file compressed packages from the blockchain; take the at least two first hash values as the current hash value, and perform the following operations in a loop: Until the number of the current hash values is 1: select a pair of current hash values from the at least two current hash values, and generate an intermediate hash value based on the selected pair of the current hash values, Perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain; use the second hash value as the current hash value; use the current hash value
  • the hash value is used as the root hash value, and the hash value is sent; the hash values of each level form a binary tree structure.
  • the root hash value two current hash values are obtained, and the cyclic execution is performed until the file compressed package corresponding to each current hash value is obtained; and then the shared file in the file compressed package is obtained;
  • the technical means of compressing multiple files into a file package partially overcomes the technical problem that the network resource burden is too high due to the large number of files, and improves the efficiency of file uploading and sharing by concurrently uploading each file compressed package to the chain;
  • the binary tree structure is used to store the hash value, and the root hash value is shared to obtain the shared file, which improves the security of the shared file.
  • a method for sharing files is provided, which is characterized by comprising: acquiring a file to be shared, and forming at least two file compression packages; The two file compressed packages perform the blockchain on-chain operation, and obtain at least two first hash values corresponding to the at least two file compressed packages from the blockchain; the at least two first hash values As the current hash value, the following operations are performed cyclically until the number of the current hash values is 1: from the at least two current hash values, a pair of current hash values is selected, based on the selected pair of all generating an intermediate hash value from the current hash value, performing a blockchain on-chain operation on the intermediate hash value, and obtaining a corresponding second hash value from the blockchain; using the second hash value as the the current hash value; take the current hash value as the root hash value, and send the hash value.
  • a method for sharing files includes: receiving a current hash value; and cyclically executing the following steps until the current hash value is obtained.
  • the file compression package corresponding to the hash value determine that there is a file compression package hash value that is the same as the current hash value on the blockchain, if so, execute A1; otherwise, execute A2;
  • A1 from the block
  • A2 Determine two lower-level hash values corresponding to the current hash value, and use the lower-level hash value as the current hash value.
  • a device for sharing files which is characterized by comprising: a file compression package uploading module, a node hash value obtaining module, and a root hash value get module;
  • the file compression package uploading module is used to obtain the files to be shared and form at least two file compression packages; perform blockchain chaining operation on the at least two file compression packages, and obtain the file compression package from the blockchain. at least two first hash values corresponding to at least two file compression packages respectively;
  • the node hash value acquisition module is configured to use the at least two first hash values as current hash values, and perform the following operations cyclically until the number of the current hash values is 1: from the at least two first hash values Among the current hash values, the current hash values are selected in pairs, an intermediate hash value is generated based on the selected pair of the current hash values, the blockchain on-chain operation is performed on the intermediate hash values, and the The blockchain obtains the corresponding second hash value; uses the second hash value as the current hash value;
  • the root hash value obtaining module is configured to use the current hash value as the root hash value and send the hash value.
  • an apparatus for sharing files which is characterized by comprising: acquiring a shared file module; wherein,
  • the module for obtaining a shared file is used to receive the current hash value; the following steps are executed cyclically until a file compressed package corresponding to the current hash value is obtained; and it is determined that there is a file corresponding to the current hash value on the blockchain
  • a system 900 for sharing files including the device 700 for sharing files provided in the third aspect, and the file sharing device 700 provided in the fourth aspect above.
  • Device 800 the file sharing device 700 provided in the fourth aspect above.
  • an electronic device for sharing files which is characterized by comprising: one or more processors; and a storage device for storing one or more processors
  • a program when the one or more programs are executed by the one or more processors, causes the one or more processors to implement the method as described in any one of the above methods for sharing files.
  • a computer-readable medium on which a computer program is stored characterized in that, when the program is executed by a processor, the above-mentioned shared file is realized Any of the methods described in the method.
  • the first embodiment in the above disclosure has the following advantages or beneficial effects: obtaining files to be shared, forming at least two file compression packages;
  • the chain obtains at least two first hash values corresponding to the at least two file compressed packages respectively; takes the at least two first hash values as the current hash value, and performs the following operations cyclically until the current hash value is reached.
  • the number of values is 1: from the at least two current hash values, a current hash value is selected in pairs, an intermediate hash value is generated based on the selected pair of the current hash values, and an intermediate hash value is generated based on the selected pair of the current hash values.
  • the root hash value two current hash values are obtained, and the cyclic execution is performed until the file compressed package corresponding to each current hash value is obtained; and then the shared file in the file compressed package is obtained. Because the technical means of compressing multiple files into a file package partially overcomes the technical problem of the high burden of network resources caused by the large number of files, by uploading each file compressed package to the chain at the same time, the file uploading and sharing efficiency is improved. Efficiency; use the binary tree structure to store the hash value, and share the root hash value to obtain the shared file, which improves the security of the shared file.
  • the second embodiment of the present disclosure provides a method and device for sharing a file, which can obtain a file to be shared, form a file compression package, perform a blockchain on-chain operation on the file compression package, obtain a corresponding first hash value, select A set number of first hash values are uploaded to the chain and the current hash value is obtained; after looping until the root hash value is obtained, the current hash values of each level are stored in a set number of forked tree structures. Based on the root hash value, traverse the hash value of the node of the bifurcated tree structure to obtain the shared files in the file compressed package; by compressing multiple files into a file compressed package, the burden of network resources caused by the large number of files is partially overcome.
  • the efficiency of file uploading and sharing is improved by concurrently uploading the compressed packages of each file to the chain; using the bifurcated tree structure to store and share the root hash value, obtain the shared file through the root hash value, and improve the file security.
  • a method for sharing files is provided, which is characterized by comprising: acquiring files to be shared, forming multiple file compression packages; compressing the files The package performs the blockchain on-chain operation, and obtains at least three first hash values corresponding to the file compression package from the blockchain; the first hash value is used as the current hash value, and the following operations are performed cyclically: Until the number of the current hash values is 1: from the at least three current hash values, select a set number of current hash values respectively, and generate an intermediate hash value based on the selected set number of current hash values.
  • Hash value perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain; when there is the current hash value that has not been selected and has not been selected When the number of the current hash values that have been passed is less than the set number, an intermediate hash value is generated based on the current hash value that has not been selected, and the blockchain on-chain operation is performed on the intermediate hash value , and obtain the corresponding second hash value from the blockchain; take the second hash value as the current hash value; the set number is an integer greater than 2; take the current hash value as root hash, and send said hash.
  • a method for sharing a file characterized in that it includes: receiving a current hash value; and cyclically executing the following steps until the current hash value is obtained.
  • the file compression package corresponding to the hash value determine that there is a file compression package hash value that is the same as the current hash value on the blockchain, if so, execute A1; otherwise, execute A2;
  • A1 from the block
  • A2 Determine each lower-level hash value corresponding to the current hash value, and use the lower-level hash value as the current hash value.
  • a device for sharing files which is characterized by comprising: a file compression package uploading module, a node hash value obtaining module, and a root hash value get module;
  • the file compression package uploading module is used to obtain the files to be shared to form a plurality of file compression packages; perform the blockchain chaining operation on the file compression package, and obtain the corresponding file compression package from the blockchain at least three first hash values of ;
  • the upper-level hash value acquisition module is configured to use the first hash value as the current hash value, and perform the following operations cyclically until the number of the current hash values is 1: from the at least three current hash values Among the values, a set number of current hash values are respectively selected, an intermediate hash value is generated based on the selected set number of current hash values, the blockchain on-chain operation is performed on the intermediate hash value, and the The blockchain obtains the corresponding second hash value; when there is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the set number, based on the unselected current hash value
  • the selected current hash value generates an intermediate hash value, performs a blockchain on-chain operation on the intermediate hash value, and obtains a corresponding second hash value from the blockchain;
  • the hash value is used as the current hash value; the set number is an integer greater than 2;
  • the root hash value obtaining module is configured to use the current hash value as the root hash value and send the hash value.
  • an apparatus for sharing files which is characterized by comprising: acquiring a file module on the chain; wherein,
  • the module for obtaining the file on the chain is used to receive the current hash value; the following steps are performed cyclically until the file compressed package corresponding to the current hash value is obtained; The hash value of the file compressed package with the same value, if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine the current each lower-level hash value corresponding to the hash value, and the lower-level hash value is used as the current hash value.
  • a system for sharing files including the device for sharing files provided in the third aspect of the second embodiment, and the fourth embodiment of the second embodiment.
  • the means for sharing files provided by the aspect;
  • an electronic device for sharing files which is characterized by comprising: one or more processors; and a storage device for storing one or more processors
  • a program when the one or more programs are executed by the one or more processors, causes the one or more processors to implement the method as described in any one of the above methods for sharing files.
  • a computer-readable medium on which a computer program is stored characterized in that, when the program is executed by a processor, the above-mentioned shared file is realized Any of the methods described in the method.
  • the second embodiment in the above disclosure has the following advantages or beneficial effects: obtaining a file to be shared, forming a file compression package, performing a blockchain on-chain operation on the file compression package, obtaining a corresponding first hash value, selecting and setting The number of first hash values are uploaded to the chain and the current hash value is obtained; after looping until the root hash value is obtained, the current hash value of each level is stored in a set number of forked tree structures. Based on the root hash value, traverse the hash value of the node of the bifurcated tree structure to obtain the shared files in the file compressed package; by compressing multiple files into a file compressed package, the burden of network resources caused by the large number of files is partially overcome.
  • the efficiency of file uploading and sharing is improved by concurrently uploading the compressed packages of each file to the chain; using the bifurcated tree structure to store and share the root hash value, obtain the shared file through the root hash value, and improve the file security.
  • the third embodiment of the present disclosure provides a method and apparatus for sharing files, which acquires files to be shared, performs blockchain on-chain operations on file compressed packages within a set period, and dynamically groups the hash values of the file compressed packages. Perform the blockchain on-chain operation on the first hash value of each group and obtain the current hash value; loop until the root hash value is obtained, and the hash values of each level form a bifurcated tree structure with a dynamically variable number of leaves.
  • a method for sharing files is provided, which is characterized by comprising: acquiring files to be shared within a set period, and forming multiple file compression packages; The multiple file compressed packages are grouped to obtain at least two groups of file compressed packages; the blockchain on-chain operation is performed on each group of the file compressed packages, and the file compressed packages contained in each group are obtained from the blockchain The first hash value corresponding to the package; an intermediate hash value is generated based on the first hash value included in each group, and the blockchain on-chain operation is performed on the intermediate hash value respectively, and the block chain is obtained from the block chain.
  • the chain obtains the corresponding second hash value; using the second hash value as the current hash value, the following operations are performed cyclically until the number of the current hash values is 1: from the at least two current hash values In the value, a predefined number of current hash values are selected, an intermediate hash value is generated based on the selected predefined number of said current hash values, the blockchain on-chain operation is performed on the intermediate hash value, and the The blockchain obtains the corresponding second hash value; when there is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the predefined number, based on the unselected
  • the selected current hash value generates an intermediate hash value, performs a blockchain on-chain operation on the intermediate hash value, and obtains a corresponding second hash value from the blockchain; Two hash values are used as the current hash value; the predefined number is an integer greater than 1; the current hash value is used as the root hash value, and the current hash
  • a method for sharing files which is characterized by comprising: receiving a current hash value; cyclically executing the following steps until the current hash value is obtained.
  • the file compression package corresponding to the hash value determine that there is a file compression package hash value that is the same as the current hash value on the blockchain, if so, execute A1; otherwise, execute A2;
  • A1 from the block
  • A2 Determine each lower-level hash value corresponding to the current hash value, and use the lower-level hash value as the current hash value.
  • a device for sharing files which is characterized by comprising: a file compression package uploading module, a current hash value obtaining module and a root hash value get module;
  • the file compression package on-chain module is used to obtain files to be shared within a set period to form multiple file compression packages; group the multiple file compression packages to obtain at least two groups of file compression packages; Group the file compressed package to perform the blockchain on-chain operation, and obtain the first hash value corresponding to the file compressed package included in each group from the blockchain;
  • the current hash value acquisition module is configured to generate an intermediate hash value based on the first hash value included in each group, perform a blockchain on-chain operation on the intermediate hash value respectively, and retrieve the data from the block chain respectively.
  • the block chain obtains the corresponding second hash value; using the second hash value as the current hash value, the following operations are performed cyclically until the number of the current hash values is 1: from the at least two current hash values Among the values, a predefined number of current hash values are selected, an intermediate hash value is generated based on the selected predefined number of the current hash values, the blockchain on-chain operation is performed on the intermediate hash value, and Obtain the corresponding second hash value from the blockchain; when there is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the predefined number, based on The current hash value that has not been selected generates an intermediate hash value, performs a blockchain on-chain operation on the intermediate hash value,
  • the root hash value obtaining module is configured to use the current hash value as the root hash value and send the current hash value.
  • an apparatus for sharing files which is characterized by comprising: acquiring a file module on the chain; wherein,
  • the described acquisition chain file module is used to receive the current hash value; the following steps are performed in a loop, until the file compressed package corresponding to the current hash value is obtained;
  • A1 Obtain the file compressed package corresponding to the current hash value from the blockchain
  • A2 Determine each lower-level hash value corresponding to the current hash value, and use the lower-level hash value as the current hash value.
  • a system for sharing files including the device for sharing files provided in the third aspect of the third embodiment, and the fourth embodiment of the third embodiment. the means for sharing files provided by the aspect;
  • an electronic device for sharing files which is characterized by comprising: one or more processors; and a storage device for storing one or more processors
  • a program when the one or more programs are executed by the one or more processors, causes the one or more processors to implement the method as described in any one of the above methods for sharing files.
  • a computer-readable medium on which a computer program is stored characterized in that, when the program is executed by a processor, the above-mentioned shared file is realized Any of the methods described in the method.
  • the third embodiment in the above-mentioned disclosure has the following advantages or beneficial effects: obtaining the file to be shared, performing the blockchain on-chain operation on the file compressed package within the set period, and comparing the first hash value obtained from the blockchain. Carry out grouping, perform the blockchain on-chain operation according to the first hash value of each group, and obtain the current hash value; loop until the root hash value is obtained, and the hash values of each level form a bifurcated tree structure.
  • the fourth embodiment of the present disclosure provides a method and device for updating a shared file, which can locally replace the shared file stored on the blockchain in a tree-like structure, upload the replaced file compressed package on the chain, and obtain the corresponding A new hash value; and through a loop operation for the new hash value and the hash value associated with the tree structure, a new root hash value is obtained; through the new root hash value, traverse the tree structure node It partially overcomes the problem of related nodes on the blockchain and the re-upload of file certificates caused by updating a small number of files, saving the burden of network resources and improving the efficiency of updating shared files.
  • a method for updating a shared file characterized in that it includes: acquiring an update file, and searching for a file to be updated according to the file name of the update file; According to the update file, a first file compressed package is formed, and a blockchain on-chain operation is performed on the first file compressed package, and a first hash value corresponding to the first file compressed package is obtained from the blockchain; The first hash value is used to replace the second hash value in the fork tree in the blockchain, and the second file compressed package corresponding to the second hash value includes the to-be-updated file; the fork The tree includes at least three hash values; according to the structure of the fork tree, determine at least one third hash value in the fork tree that is associated with the second hash value and located at an upper level of the second hash value Hash value; the upper level is the level close to the root hash value in the fork tree; at least one fourth hash value is
  • a method for updating a shared file which is characterized by comprising:
  • A1 Obtain the file compressed package corresponding to the sub-hash value from the blockchain
  • A2 Determine the sub-hash value corresponding to the sub-hash value, and use the sub-hash value as the sub-hash value.
  • an apparatus for updating a shared file characterized in that it includes: a file updating module, a hash value updating module, and a root hash value updating module; in,
  • the file update module is used to obtain an update file, and search for a file to be updated according to the file name of the update file; form a first file compression package according to the update file, and execute a block on the first file compression package On-chain operation, obtain the first hash value corresponding to the first file compressed package from the blockchain;
  • the hash value update module is configured to replace the second hash value in the fork tree in the blockchain with the first hash value, and the second file compression package corresponding to the second hash value includes: the file to be updated; the fork tree includes at least three hash values; according to the structure of the fork tree, it is determined that the fork tree is associated with the second hash value and located in the first At least one third hash value of the upper level of the second hash value; the upper level is the level close to the root hash value in the fork tree; according to the first hash value and the structure of the fork tree, obtain at least one a fourth hash value, where the at least one fourth hash value is in one-to-one correspondence with the position of the at least one third hash value in the fork tree; the corresponding position is replaced by the fourth hash value the third hash value of ;
  • the root hash value updating module is configured to use the fourth highest hash value as a new root hash value, and send the new root hash value.
  • an apparatus for updating a shared file characterized in that it includes: acquiring an update file module; wherein,
  • the obtaining and updating file module is used for receiving the root hash value; determining the sub-hash value corresponding to the root hash value; and cyclically executing the following steps until the file compressed package corresponding to the sub-hash value is obtained,
  • the file compressed package includes an update file; it is determined that there is a hash value of the file compressed package that is the same as the sub-hash value on the blockchain, and if so, execute A1; otherwise, execute A2; A1: from the block Obtain the file compressed package corresponding to the sub-hash value on the chain; A2: Determine the lower-level hash value corresponding to the sub-hash value, and use the lower-level hash value as the sub-hash value.
  • a system for sharing files which includes the device for updating a shared file provided in the third aspect of the fourth embodiment, and the third aspect of the fourth embodiment.
  • the device for updating shared files provided in four aspects;
  • an electronic device for updating shared files which is characterized by comprising: one or more processors; and a storage device for storing one or more processors a program, when the one or more programs are executed by the one or more processors, so that the one or more processors implement the method as described in any one of the above-mentioned methods for updating a shared file.
  • a computer-readable medium on which a computer program is stored characterized in that, when the program is executed by a processor, the above-mentioned update sharing is implemented The method described in any of the methods of the document.
  • the fourth embodiment in the above disclosure has the following advantages or beneficial effects: by partially replacing the shared files stored on the blockchain in a tree-like structure, the replaced files can be compressed on the chain and the corresponding new files can be obtained. Hash value; and obtain a new root hash value through a loop operation for the new hash value and the hash value associated with the tree structure; traverse the hash value of the tree structure node through the new root hash value value, and then obtain the shared update file; it partially overcomes the problem of related nodes on the blockchain caused by updating a small number of files and the re-upload of file certificates, which saves the burden of network resources and improves the efficiency of updating shared files.
  • FIG. 1 is a schematic flowchart of a method for storing a shared file provided by a first embodiment of the present disclosure
  • FIG. 2 is a schematic flowchart of obtaining a shared file provided by the first embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of storing a shared file hash value using a binary tree structure provided by the first embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of storing a shared file hash value using a binary tree structure provided by the first embodiment of the present disclosure
  • FIG. 5 is a schematic flowchart of obtaining a shared file provided by the first embodiment of the present disclosure
  • FIG. 6 is a schematic flowchart of a shared file provided by the first embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of an apparatus for sharing files provided by the first embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of an apparatus for acquiring a shared file provided by the first embodiment of the present disclosure
  • FIG. 9 is a schematic structural diagram of a system for acquiring a shared file provided by the first embodiment of the present disclosure.
  • FIG. 10 is a schematic flowchart of a method for storing a shared file provided by a second embodiment of the present disclosure
  • FIG. 11 is a schematic flowchart of obtaining a shared file provided by the second embodiment of the present disclosure.
  • FIG. 12 is a schematic diagram of storing a shared file hash value using a multi-tree structure provided by the second embodiment of the present disclosure
  • FIG. 13 is a schematic flowchart of obtaining a shared file provided by the second embodiment of the present disclosure.
  • 15 is a schematic diagram of storing a shared file hash value using a multi-tree structure provided by the second embodiment of the present disclosure
  • 16 is a schematic structural diagram of an apparatus for sharing files provided by a second embodiment of the present disclosure.
  • FIG. 17 is a schematic structural diagram of an apparatus for acquiring a shared file provided by a second embodiment of the present disclosure.
  • FIG. 18 is a schematic structural diagram of a system for acquiring a shared file provided by the second embodiment of the present disclosure.
  • FIG. 19 is a schematic flowchart of a method for storing a shared file provided by a third embodiment of the present disclosure.
  • FIG. 20 is a schematic flowchart of obtaining a shared file according to a third embodiment of the present disclosure.
  • 21 is a schematic diagram of storing a shared file hash value using a predefined time range and a multi-tree structure provided by the third embodiment of the present disclosure
  • FIG. 22 is a schematic flowchart of obtaining a shared file according to a third embodiment of the present disclosure.
  • FIG. 23 is a schematic flowchart of a shared file provided by a third embodiment of the present disclosure.
  • FIG. 24 is a schematic structural diagram of an apparatus for sharing files provided by a third embodiment of the present disclosure.
  • 25 is a schematic structural diagram of an apparatus for acquiring a shared file provided by a third embodiment of the present disclosure.
  • 26 is a schematic structural diagram of a system for acquiring a shared file provided by a third embodiment of the present disclosure.
  • FIG. 27 is a schematic flowchart of a method for updating a file provided by a fourth embodiment of the present disclosure.
  • FIG. 28 is a schematic flowchart of obtaining an update file provided by the fourth embodiment of the present disclosure.
  • 29 is a schematic diagram of storing a shared file hash value using a tree structure provided by the fourth embodiment of the present disclosure.
  • FIG. 30 is a schematic diagram of using a tree structure to store and update a file hash value provided by the fourth embodiment of the present disclosure.
  • FIG. 31 is a schematic flowchart of obtaining an update file provided by the fourth embodiment of the present disclosure.
  • FIG. 32 is a schematic flowchart of acquiring and updating a shared file according to an embodiment of the fourth embodiment of the present disclosure.
  • FIG. 33 is a schematic structural diagram of an apparatus for updating a shared file provided by a fourth embodiment of the present disclosure.
  • 34 is a schematic structural diagram of an apparatus for acquiring and updating a shared file provided by a fourth embodiment of the present disclosure.
  • 35 is a schematic structural diagram of a system for acquiring and updating shared files provided by the fourth embodiment of the present disclosure.
  • 36 is an exemplary system architecture diagram to which embodiments of the present disclosure may be applied;
  • FIG. 37 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present disclosure.
  • the first embodiment of the present disclosure provides a method for storing shared files, and the method may include the following steps:
  • Step S101 Acquire the files to be shared to form at least two file compression packages; perform a blockchain on-chain operation on the at least two file compression packages, and obtain the at least two file compression packages corresponding to the at least two file compression packages from the blockchain at least two first hash values of .
  • the files to be shared are transaction files generated by an electronic bank, statement files generated by electronic banks, order files generated by an electronic mall, etc.; further, the files to be shared are obtained to form at least two file compression packages, including : Obtain the files to be shared within a predefined time range, form at least two file packages, and determine the number of files in the file packages according to the network bandwidth.
  • a predefined time range can be determined according to the number of shared files received within a time range, so as to form a reasonable number of files received according to the time range, for example, transaction files generated by an electronic bank within one hour
  • the pre-defined time range can be set according to the business scenario and the number of files generated, for example, one day, one hour, etc. , one minute, etc.
  • obtain the files to be shared for example, obtain the files to be shared within a predefined time range, and form at least two file packages.
  • Each file package contains the number of files.
  • the file package is compressed to form multiple file compression packages.
  • the compression method can use compression tools, such as gzip, winRAR, etc. The specific method used in the present disclosure for compression Not limited.
  • compression and encryption operations are respectively performed on the file package to form the file compression package.
  • forming at least two file compression packages also includes performing a compression operation and an encryption operation, which improves the security of files through encryption, especially improves the security of files with high security requirements, such as statements between electronic banks and the like.
  • the encryption method can be encrypted by using compression software, and also can be encrypted by using an operating system or encryption software. The present disclosure does not limit the specific methods of compression and encryption.
  • the concurrent blockchain uploading operation is performed on each file compressed package, because each file compressed package does not have a dependent transaction relationship, the concurrent on-chain operation of the file compressed package is performed; that is, the file compressed package is executed.
  • Blockchain concurrent on-chain operations It is understandable that due to the limitation of resources such as network bandwidth, the uploading operation of multiple file compressed packages can be performed in batches, and the file compressed packages in each batch are concurrently uploaded to the chain. The efficiency of file uploading is improved; further, the blockchain uploading operation is performed on the at least two file compressed packages, and at least two first file corresponding to the at least two file compressed packages are obtained from the blockchain.
  • Hash value wherein, the file compressed package can be used as a transaction to perform the blockchain on-chain operation, and the hash value returned for the transaction can be obtained from the blockchain, and the hash value is the first value of the file compressed package.
  • the hash value that is, the first hash value corresponding to the file compressed package, that is, the first hash value corresponding to the file compressed package is obtained from the blockchain; further, the blockchain used may be an alliance Chain, private chain, etc.
  • This disclosure does not limit the type of blockchain. This disclosure does not limit the specific tools or methods used to perform blockchain on-chain.
  • Step S102 Take the at least two first hash values as the current hash value, and perform the following operations cyclically until the number of the current hash values is 1: from the at least two current hash values, form For selecting the current hash value, an intermediate hash value is generated based on the selected pair of the current hash values; the blockchain on-chain operation is performed on the intermediate hash value, and the corresponding second hash value is obtained from the blockchain.
  • Hash value take the second hash value as the current hash value.
  • an intermediate hash value is generated based on the selected pair of the current hash values, and the blockchain is executed on the intermediate hash value.
  • On-chain operation specifically, to generate an intermediate hash value based on the selected pair of current hash values, two (a pair) of current hash values can be combined to generate an intermediate hash value, or two (a pair of) current hash values can be combined to generate an intermediate hash value.
  • the calculation of the current hash value generates an intermediate hash value, and the present disclosure does not limit the specific method for generating the intermediate hash value based on a pair of current hash values.
  • an intermediate hash value is generated based on the selected pair of the current hash values, and the blockchain on-chain operation is performed on the intermediate hash value; and a corresponding second hash value is obtained from the blockchain, wherein , the intermediate hash value can be used as a transaction to perform the chain operation, and the hash value returned for the transaction can be obtained from the blockchain, and the hash value is the second hash value; A similar operation for the second hash value (ie, the current hash value) until the root hash value is obtained.
  • the first hash value and the second hash value are used as the current hash value; it can be understood that, according to the above description, the hash value of each level is obtained through the loop until the unique root is obtained. Hash value (that is, until the number of the current hash value is 1), the first hash value and the second hash value of each level form a hash value storage structure of a binary tree.
  • Step S103 Use the current hash value as the root hash value, and send the hash value.
  • the root hash value is obtained after looping, and the root hash value is sent.
  • the root hash value is sent to the acquirer who has the permission to acquire the shared file, and the acquirer with the permission may be one or more parties; for example, the file is predefined by Bank A and Bank B. Statements generated within the time range; if the root hash value is generated after steps S101 to S103, the root hash value is sent to Bank A and Bank B who have access rights to these statement files; obviously , using this operation to further improve the security of the file.
  • the first embodiment of the present disclosure provides a method for acquiring a shared file, and the method may include the following steps:
  • Step S201 Receive the current hash value; perform the following steps in a loop until the file compressed package corresponding to the current hash value is obtained; determine that there is a file compressed package that is the same as the current hash value on the blockchain. If yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine the two subordinates corresponding to the current hash value hash value, and use the lower-level hash value as the current hash value.
  • the description of the method of cyclically executing the method for obtaining the files in the file compression package corresponding to each of the file compression package hash values from the blockchain is consistent with the examples described in steps S501 to S503 , and will not be repeated here.
  • the first embodiment of the present disclosure provides a method for storing a shared file and a hash value using a binary tree structure, and the method may include the following steps:
  • Step S301 Obtain the first hash value corresponding to each file compressed package
  • step S101 The description about generating the file compression package and obtaining the corresponding first hash value is consistent with step S101, and will not be repeated here; as shown in FIG. , respectively obtain the corresponding first hash value 1-first hash value 4.
  • Step S302 Select the first hash value in pairs, perform a blockchain on-chain operation on the selected pair of the current hash values, obtain the corresponding second hash value from the blockchain, and add the first hash value to the blockchain.
  • Two hash values are used as the current hash value; the at least two first hash values are used as the current hash value, and the following operations are performed cyclically until the number of the current hash values is 1: from the at least two Among the two current hash values, the current hash values are selected in pairs, an intermediate hash value is generated based on the selected pair of the current hash values, the blockchain on-chain operation is performed on the intermediate hash values, and Obtain the corresponding second hash value from the blockchain; use the second hash value as the current hash value.
  • step S302 describes the process of obtaining the second hash value of each level by looping (and taking the second hash value as the current hash value).
  • three levels are used to describe the Hash values, which are level 1, level 2, and level 3.
  • the blockchain is operated on the chain, and the corresponding second hash value is obtained from the blockchain; as shown in Figure 3, based on the first hash value 1 (current hash value) of the file compression package 1 and the file compression package 2
  • the first hash value 2 (current hash value) of the first hash value 2 (current hash value) generates an intermediate hash value, executes the blockchain on-chain operation on the intermediate hash value, and obtains the corresponding second hash value (for example, the second hash value) from the blockchain Hash value 1); an intermediate hash value is generated based on the first hash value 3 of the file compressed package 3 and the first hash value 4 of the file compressed package 4, and the blockchain on-chain operation is performed on the intermediate hash value , and obtain the corresponding second hash value (for example, the second hash value 2) from the
  • an intermediate hash value is generated based on the selected pair of the current hash values, the blockchain on-chain operation is performed on the intermediate hash value, and the corresponding second hash value is obtained from the blockchain;
  • the second hash value is used as the current hash value.
  • step S302 is executed; the second hash value based on level 2 1 (the current hash value) and the second hash value 2 (the current hash value) generate an intermediate hash value; perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding first hash value from the blockchain.
  • the second hash value that is, to obtain the second hash value (current hash value) of level 3. It is judged again whether the number of current hash values is 1, and it is known that the number of current hash values is 1, and the current hash value is used as the root hash value.
  • the number of current hash values based on each level of the binary tree structure may be an odd number or an even number; when the number of the current hash values is an even number, from the at least two current hash values In the value, select the current hash value in pairs, generate an intermediate hash value for the selected pair of the current hash value, perform the blockchain on-chain operation on the intermediate hash value, and obtain from the blockchain The corresponding second hash value; in the case that each of the current hash values has been selected, the second hash value is used as the current hash value.
  • the current hash value (first hash value) contained in level 1 is an even number (4), for example, it is generated based on the first hash value 1 and the first hash value 2
  • Intermediate hash value perform the blockchain on-chain operation on the intermediate hash value and obtain the second hash value 1; generate the intermediate hash value based on the first hash value 3 and the first hash value 4,
  • the intermediate hash value performs the blockchain on-chain operation and obtains the second hash value 2; wherein, the first hash value 1 and the first hash value 2 are paired selections; the first hash value 3 and the first hash value Hash value 4 is also selected in pairs; wherein, the first hash value 1, the first hash value 2, the first hash value 3 and the first hash value 4 are used as the current hash value; it can be seen that in When each of the current hash values (the first hash value 1, the first hash value 2, the first hash value 3 and the first hash value 4 are all selected
  • step S401-step S404 When the number of the current hash value is an odd number other than 1, the description is consistent with step S401-step S404, and details are not repeated here.
  • Step S303 Obtain a root hash value, and send the root hash value.
  • the level of the binary tree is determined by the number of hash values of the file compression package; and the number of hash values of the file compression package is related to the number of files related to the generated business. Not limited.
  • the first embodiment of the present disclosure provides a method for storing a shared file and a hash value using a binary tree structure.
  • the method may include the following steps:
  • Step S401 Obtain a first hash value corresponding to each file compression package.
  • step S101 The description about generating the file compressed package and obtaining the corresponding first hash value is consistent with step S101, and will not be repeated here; as shown in FIG. Operate and obtain the corresponding first hash value 1-first hash value 5.
  • Step S402 Select the first hash value in pairs, generate an intermediate hash value based on the selected pair of the current hash values, perform a blockchain on-chain operation on the intermediate hash value, and retrieve the hash value from the blockchain. Obtain a corresponding second hash value, and use the second hash value as the current hash value.
  • Step S403 It is judged that the number of the current hash value is not 1, then step S402 is executed.
  • steps S402 to S403 describe the process of obtaining the second hash value (current hash value) of each layer by looping, as shown in Figure 4;
  • the hash value is used as the current hash value, and then the current hash value (first hash value) is selected in pairs, and an intermediate hash value is generated based on the selected pair of the current hash values.
  • the value performs the blockchain on-chain operation, and obtains the corresponding second hash value from the blockchain; further, the number of current hash values at each level based on the binary tree structure can be odd or even; when When the number of the current hash values is an odd number other than 1, select a pair of current hash values from the at least two current hash values, and generate an intermediate hash value based on the selected pair of the current hash values value, perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain; when the number of the current hash values that are not selected is 1, the The second hash value and the unselected one current hash value are used as the current hash value.
  • perform the blockchain on-chain operation on the selected pair of the current hash values, and obtain the corresponding second hash value from the blockchain for example: compress the first Hash value 1 (current hash value) and the first hash value 2 (current hash value) of file compressed package 2 generate an intermediate hash value, perform blockchain on-chain operation on the intermediate hash value, and obtain The corresponding second hash value, that is, obtain the second hash value 1; another example: generate an intermediate hash based on the first hash value 3 of the file compressed package 3 and the first hash value 4 of the file compressed package 4 value, perform the blockchain on-chain operation on the intermediate hash value and obtain the corresponding second hash value from the blockchain, for example, obtain the second hash value 2; the first hash value 5 (the current hash value ) is the unselected current hash value; and if the number of the unselected current hash values is 1, then the second hash value and the unselected 1
  • the current hash value is used as the current hash value, that is,
  • step S402 is executed; further, based on the selection
  • the generated pair of the current hash value generates an intermediate hash value, performs the blockchain on-chain operation on the intermediate hash value, and obtains the corresponding second hash value from the blockchain, for example: based on the second hash value
  • the hash value 1 (current hash value) and the first hash value 5 (current hash value) generate an intermediate hash value, perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding hash value from the blockchain.
  • the second hash value for example, obtain the second hash value 2 (current hash value); further, as can be seen from FIG. 4 , the second hash value 1 (current hash value) is the current hash value that is not selected. If the number of the unselected current hash values is 1, then the second hash value (second hash value 2) and the unselected 1 The current hash value (second hash value 1) is used as the current hash value; cyclically, it is judged again whether the number of current hash values is 1, and it is known that the number of current hash values is 1, then the current hash value is determined as 1. Hash value as the root hash value.
  • the following operations are performed cyclically until the number of the current hash values is 1: from the at least two current hash values, pairwise Select the current hash value, generate an intermediate hash value based on the selected pair of the current hash values, perform a blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain Hash value; take the second hash value as the current hash value.
  • Step S404 Send the root hash value.
  • the level of the binary tree is determined by the number of hash values of the file compression package; and the number of hash values of the file compression package is related to the number of files related to the generated business. Not limited.
  • the first embodiment of the present disclosure provides a method for obtaining a shared file based on a hash value of a binary tree structure.
  • the method may include the following steps:
  • Step S501 Receive the current hash value.
  • the current hash value is the root hash value.
  • Step S502-Step S503 Obtain a file compression package.
  • the current hash value (root hash value) is obtained, and it is determined that the same file compression package hash value as the current hash value (root hash value) exists on the blockchain. It can be known that If there is no file compression package hash value that is the same as the current hash value (root hash value), then execute A2: determine the two lower-level hash values corresponding to the current hash value, and assign the lower-level hash values to the hash values.
  • the value is used as the current hash value, that is, two lower-level hash values corresponding to the current hash value (root hash value) are determined, which are respectively lower-level hash value 1 and lower-level hash value 2;
  • the lower hash values (lower hash value 1 and lower hash value 2) are used as the current hash value.
  • the circular judgment determines that there is the same file compression package hash value as the current hash value (lower-level hash value 1 and lower-level hash value 2) on the blockchain; as shown in Figure 5, for the lower-level hash value 1.
  • the lower-level hash value 2 does not have the same file compression package hash value as the current hash value (lower-level hash value 1 and lower-level hash value 2), then execute A2: determine that the current hash value corresponds to two lower-level hash values, and use the lower-level hash value as the current hash value; determine that the two lower-level hash values corresponding to the current hash value (level 2: lower-level hash value 1) are respectively lower-level hash values Hash value 1 and lower-level hash value 2; the circular judgment determines that there is a file compression package that is the same as the current hash value (level 1: lower-level hash value 1 and lower-level hash value 2) on the blockchain haha value; then execute A1: obtain the file compressed package corresponding to the
  • each obtained file compressed package perform decompression and decryption operations, and the methods of decompression and decryption echo the methods of compression and encryption; that is, obtain the file compressed package corresponding to the current hash value.
  • decompression and decryption operations and the methods of decompression and decryption echo the methods of compression and encryption; that is, obtain the file compressed package corresponding to the current hash value.
  • the level of the binary tree is determined by the number of hash values of the file compression package; and the number of hash values of the file compression package is related to the number of files related to the generated business. Not limited.
  • the first embodiment of the present disclosure provides a process for sharing files, and the process includes the following steps:
  • step S601-step S603 the process of uploading the shared file to the chain is described by step S601-step S603; the process of obtaining the shared file by the acquirer of the shared file is described by step S604;
  • the shared file acquirer may be an enterprise directly related to the shared file in business, for example: Bank 1, Bank 2, Bank 3, and so on.
  • Step S601 Acquire the files to be shared to form at least two file compression packages; perform a blockchain on-chain operation on the at least two file compression packages, and obtain the at least two file compression packages corresponding to the at least two file compression packages from the blockchain at least two first hash values of .
  • step S101 the description about the formation of the file compression package and the uploading of the chain is consistent with step S101, and will not be repeated here; further, obtaining the file to be shared, and forming at least two file compression packages, including: obtaining the file within a predefined time range.
  • the files to be shared are formed into at least two file packages, and the number of files in the file packages is determined according to the network bandwidth. Compressing and encrypting the file package are respectively performed to form the file compression package.
  • a concurrent blockchain uploading operation is performed on the file compressed package.
  • Step S602 Take the at least two first hash values as the current hash value, and perform the following operations cyclically until the number of the current hash values is 1: from the at least two current hash values, For the selection of the current hash value, an intermediate hash value is generated based on the selected pair of the current hash values, the blockchain on-chain operation is performed on the intermediate hash value, and the corresponding second hash value is obtained from the blockchain.
  • Hash value take the second hash value as the current hash value.
  • step S102 the description about obtaining the root hash value through circulation is consistent with step S102, and details are not repeated here.
  • Step S603 Use the current hash value as the root hash value, and send the hash value.
  • step S103 the description about sending the root hash value is consistent with step S103, and details are not repeated here.
  • Step S604 Receive the current hash value; perform the following steps in a loop until the file compressed package corresponding to the current hash value is obtained; determine that a file compressed package with the same current hash value exists on the blockchain Hash value, if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine the two corresponding to the current hash value the lower-level hash value, and use the lower-level hash value as the current hash value.
  • the corresponding file compression package includes: acquiring the file compression package corresponding to the current hash value, performing decompression and decryption operations on the file compression package, and obtaining the files in the file compression package.
  • the first embodiment of the present disclosure provides an apparatus 700 for sharing files, including: a file compression package uploading module 701 , a node hash value obtaining module 702 and a root hash value obtaining module 703 ; in,
  • the file compression package uploading module 701 is used to obtain the files to be shared and form at least two file compression packages; perform the blockchain chaining operation on the at least two file compression packages, and obtain all the files from the blockchain. at least two first hash values corresponding to the at least two file compression packages respectively;
  • the node hash value obtaining module 702 is configured to use the at least two first hash values as current hash values, and perform the following operations cyclically until the number of the current hash values is 1: starting from the at least one Among the two current hash values, the current hash values are selected in pairs, an intermediate hash value is generated based on the selected pair of the current hash values, the blockchain on-chain operation is performed on the intermediate hash values, and Obtain the corresponding second hash value from the blockchain; use the second hash value as the current hash value;
  • the root hash value obtaining module 703 is configured to use the current hash value as the root hash value and send the hash value.
  • the node hash value obtaining module 702 further includes, when the number of the current hash values is an even number, selecting a pair of current hash values from the at least two current hash values, based on The selected pair of the current hash values generate an intermediate hash value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain; In the case that all current hash values have been selected, the second hash value is used as the current hash value.
  • the node hash value obtaining module 702 further includes selecting a pair of current hash values from the at least two current hash values when the number of the current hash values is an odd number other than 1 , generate an intermediate hash value based on the selected pair of the current hash values, perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain;
  • the unselected current hash value is 1, the second hash value and the unselected one current hash value are used as the current hash value.
  • the file compression package uploading module 701 is further configured to acquire files to be shared and form at least two file compression packages, including: acquiring files to be shared within a predefined time range to form at least two file packages , and determine the number of files in the file package according to the network bandwidth.
  • the file compression package uploading module 701 is further configured to perform compression and encryption operations on the file package respectively to form the file compression package.
  • the file compressed package on-chain module 701 is further configured to perform a blockchain concurrent on-chain operation on the file compressed package.
  • the first embodiment of the present disclosure provides an apparatus 800 for sharing files, including: acquiring a shared file module 801; wherein,
  • the acquiring shared file module 801 is used to receive the current hash value; the following steps are performed cyclically until the file compressed package corresponding to the current hash value is acquired; The hash value of the file compressed package with the same value, if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine the current two lower-level hash values corresponding to the hash value, and the lower-level hash value is used as the current hash value.
  • the obtaining shared file module 801 is further configured to obtain the file compressed package corresponding to the current hash value, including: obtaining the file compressed package corresponding to the current hash value, and compressing the file The package performs decompression and decryption operations to obtain the files in the file archive.
  • the first embodiment of the present disclosure also provides an electronic device for sharing files, including: one or more processors; and a storage device for storing one or more programs, when the one or more programs are stored by the one or multiple processors to execute, so that the one or more processors implement the method provided by any of the above embodiments.
  • the first embodiment of the present disclosure further provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the method provided by any of the foregoing embodiments.
  • the first embodiment of the present disclosure provides a system 900 for sharing files, including: a file sharing apparatus 700 provided by the first embodiment of the present disclosure and a system 900 provided by the first embodiment of the present disclosure Device 800 for sharing files.
  • the second embodiment of the present disclosure provides a method for storing a shared file, and the method may include the following steps:
  • Step S1001 Acquire the files to be shared to form multiple file compression packages; perform a blockchain on-chain operation on the file compression packages, and obtain at least three first hashes corresponding to the file compression packages from the blockchain value.
  • the file to be shared can be a transaction file generated by an electronic bank, a statement file generated by an electronic bank, an order file generated by an electronic mall, etc.
  • the present disclosure does not limit the format and content of the file with sharing; further , obtaining files to be shared to form multiple file compression packages, including: obtaining files to be shared within a predefined time range, forming at least three file packages, and determining the number of files in the file packages according to network bandwidth.
  • the embodiment of the present disclosure is based on the hash values corresponding to multiple file compression packages, and after looping through the hash values of each level to upload the chain and obtain the hash value of the next level, thereby forming a multi-fork tree hash value value structure, the number of forks of the multi-fork tree is at least 3, that is, the set number is an integer greater than 2; that is, at least three first files corresponding to the file compressed package are obtained from the blockchain Hash value; it can be understood that the number of file compressed packages can be based on the number of shared files received within a time range, that is, to obtain files to be shared generated within a predefined time range, for example, within one hour Transaction documents generated by an electronic bank, statement documents generated by two electronic banks within an hour, order documents generated by an electronic mall within one day, etc.
  • the predefined time range can be based on business scenarios and the number of documents generated. to set, for example, one day, one hour, one minute, etc.
  • the present disclosure does not limit the specific content of
  • obtain the files to be shared for example, obtain the files to be shared within a predefined time range to form at least three file packages, and determine the number of files in each of the file packages according to the network bandwidth, and form them respectively.
  • At least three file compression packages obtain the number of files generated within the predefined time range, combined with factors such as network bandwidth, divide the files into multiple file packages, and compress the file packages respectively to form File compression package; the number of files contained in the file package is set according to the size of the file, so the number in the file package is variable. According to the total amount in a time range, each file is determined by obtaining the bandwidth of the network The number of files contained in the package, and further, the file package is compressed to form a plurality of file compressed packages;
  • Compressing and encrypting the file package are respectively performed to form the file compression package.
  • at least three file compression packages are formed, and the compression operation and encryption operation are also performed, and the security of the files is improved by encryption, especially, the security requirements of documents such as statements between electronic banks and other documents are improved.
  • Security the encryption method can be encrypted by using compression software, such as gzip, WinRAR, etc.; the encryption method can be encrypted by using compression software, and can also be encrypted by using the operating system or encryption software. The specific method is not limited.
  • the concurrent blockchain uploading operation is performed on each file compressed package, because each file compressed package does not have a dependent transaction relationship, the concurrent on-chain operation of the file compressed package is performed; that is, the file compressed package is executed.
  • Blockchain concurrent on-chain operations It is understandable that due to the limitation of resources such as network bandwidth, the uploading operation of multiple file compressed packages can be performed in batches, and the file compressed packages in each batch are concurrently uploaded to the chain.
  • the efficiency of file uploading is improved; further, the blockchain uploading operation is performed on the at least three file compressed packages, and at least three first hash values corresponding to the at least three file compressed packages are obtained respectively;
  • the file compressed package can be used as a transaction to perform the blockchain on-chain operation, and the hash value returned for the transaction can be obtained from the blockchain respectively, and the hash value is the first hash value corresponding to the file compressed package.
  • the blockchain used may be a consortium chain, a private chain, etc., and the type of the blockchain is not limited in this disclosure.
  • the present disclosure does not limit the specific tools or methods used to perform blockchain on-chain.
  • Step S1002 take the first hash value as the current hash value, and perform the following operations cyclically until the number of the current hash values is 1: from the at least three current hash values, select and set respectively A number of current hash values, an intermediate hash value is generated based on the selected set number of current hash values, the blockchain on-chain operation is performed on the intermediate hash value, and the corresponding second hash value is obtained from the blockchain.
  • Hash value when there is the current hash value that has not been selected and the number of the current hash value that has not been selected is less than the set number, based on the current hash value that has not been selected Generate an intermediate hash value from the hash value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain; use the second hash value as the current hash value.
  • Greek value the set number is an integer greater than 2.
  • an intermediate hash value is generated based on the selected set number of current hash values, and the block chain is executed on the intermediate hash value.
  • On-chain operation and obtain the corresponding second hash value from the blockchain; specifically, based on the selected set number of current hash values to generate intermediate hash values, the set number of current hash values can be combined
  • the intermediate hash value may also be generated by calculating a set number of current hash values. The present disclosure does not limit the specific method for generating the intermediate hash value based on the set number of current hash values.
  • the intermediate hash value can be used as a transaction to perform the blockchain on-chain operation, and the second hash value returned for the transaction can be obtained from the blockchain respectively; this step is repeated to obtain the second hash value of each level.
  • the set number is an integer greater than 2, for example, 3, 4, 10, 100, 1000, the set number is used to set the number of forks of the multi-tree structure, and the set number can be based on business scenarios or file compression
  • the specific value of the set number is not limited in the present disclosure.
  • the first hash value and the second hash value are used as the current hash value; it can be understood that, according to the above description, the hash values of each level are obtained through the loop until the unique root hash value is obtained.
  • Hash value that is, until the number of the current hash value is 1
  • the hash value storage structure of a tree (a set number of forked trees).
  • the number of hash values of the file compressed package is 99, corresponding to 99 first hash values; the set number is 5; then the first hash value is used as the current hash value, and the cycle is executed
  • the following operations are performed until the number of the current hash value is 1: that is, the 99 first hash values are used as the current hash value and the following operations are performed cyclically: from the 99 hash values, a set number of ( For example: 5) current hash values, and based on the selected set number (for example: 5) current hash values, an intermediate hash value is generated, and the blockchain on-chain operation execution area is performed on the intermediate hash value.
  • the block chain is operated on the chain, and the corresponding second hash value is obtained from the block chain; it is understandable that 5 current hash values are selected from the 99 first hash values, and according to the selected 5 hash values Generate an intermediate hash value from the hash value, perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain. Through the above operation, it can be known that 19 second hash values are obtained.
  • 20 second hash values are obtained from 99 first hash values. Further, the 20 second hash values are used as the current hash value, and the above steps are executed cyclically. Further, similar to It can be known that among the 20 current hash values, 5 (set number) are selected to generate intermediate hash values, the blockchain up-chain operation is performed on the intermediate hash values, and the corresponding down-links are obtained from the blockchain. For the second hash value of one level, four second hash values (current hash values) are obtained; further, one second hash value is obtained, that is, up to the number of the current hash values is 1; cyclic execution stops.
  • the first hash value is taken as the current hash value, and the following operations are performed cyclically until the number of the current hash values is 1: from the at least three current hash values, respectively select a set number of a current hash value, generate an intermediate hash value based on the selected set number of current hash values, perform a blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain Value; when there is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the set number, based on the current hash value that has not been selected value to generate an intermediate hash value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain; use the second hash value as the current hash value value; the set number is an integer greater than 2.
  • Step S1003 Use the current hash value as the root hash value, and send the hash value.
  • the storage structure of the multi-fork tree that is, the set number of fork trees
  • the root hash value is obtained and the root hash value is sent; further, the schematic diagram of FIG. 15 is used below.
  • the set number is N; and the number in each circle represents the identification of the current hash value of each level, assuming that before the root hash value is obtained, the current hash value of each level is
  • the number of hash values is not less than the set number, and the set number N of current hash values are respectively selected, and according to the selected set number of the current hash values, intermediate hash values are respectively generated, and the intermediate hash values are respectively generated.
  • the hash value performs the blockchain on-chain operation, and obtains a plurality of corresponding second hash values from the blockchain; the above operations are performed cyclically, after M levels, the current number of hash values is 1, that is, the root is obtained.
  • Hash value further, there are two methods for sending the root hash value: 1) sending the root hash value through the blockchain to the acquirer who has the permission to obtain the shared file; 2) sending the root hash value by other means
  • the root hash value is given to the acquirer who has the permission to acquire the shared file, such as official email, etc.
  • the root hash value is sent to the acquirer who has the permission to acquire the shared file
  • the The party can be one or more parties; for example: the document is a statement generated by bank A and bank B within a predefined time range; after step S1001-step S1003, a root hash value is generated, then the root hash value is generated.
  • the values are sent to Bank A and Bank B who have access to these statement files; obviously, using this operation further increases the security of the files.
  • the second embodiment of the present disclosure provides a method for acquiring a shared file, and the method may include the following steps:
  • Step S1101 Receive the current hash value; perform the following steps in a loop until the file compressed package corresponding to the current hash value is obtained; determine that a file compressed package with the same current hash value exists on the blockchain Hash value, if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine each subordinate corresponding to the current hash value hash value, and use the lower-level hash value as the current hash value.
  • the description of the method for obtaining the file in the file compression package corresponding to the file compression package hash value from the blockchain is consistent with the example described in steps S1301-S1303, here No longer.
  • the third embodiment of the present disclosure provides a method for storing a shared file and a hash value using a multi-tree structure, and the method may include the following steps:
  • Step S1201 Obtain a first hash value corresponding to each file compression package.
  • step S1001 the description about generating the file compressed package and obtaining the corresponding first hash value is consistent with step S1001, and details are not repeated here.
  • 10 file compression packages are included. It can be understood that the number of file compression packages can be tens, hundreds, tens of thousands, hundreds of thousands, millions, tens of millions, etc.; In order to specifically describe steps S1201 to S1203, this example uses a set number of 4 as an example, that is, a 4-ary tree structure; according to the file compressed packages 1-10, the first hash values 1-10 are obtained respectively.
  • Step S1202-Step S1203 Obtain the second hash value.
  • step S1202-step S1203 describes the cyclically executed operation of obtaining the second hash value (current hash value); specifically, for the sake of illustration, as shown in FIG.
  • the hash values are level 1, level 2, and level 3 respectively; as shown in Figure 3, the example contains 10 first hash values; if the number is set to 4, the first hash value is used as the current hash value.
  • Hash value perform the following operations in a loop until the number of the current hash value is 1; from the 10 first hash values, select 4 first hash values respectively, and based on these 4 first hash values Generate an intermediate hash value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain; for example, based on the first hash value 1-4, obtain the first hash value.
  • Second hash value 1 based on the first hash value 5-8, the second hash value 2 is obtained; the first hash value 9, the first hash value 10 (10 minus 2 groups, each group 4 number, the remainder is 2) is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the set number, 2 ⁇ 4, then based on the two
  • the first hash value (the first hash value 9, the first hash value 10) obtains the corresponding second hash value 3; that is, the first hash value is used as the current hash value, and the following operations are performed cyclically , until the number of the current hash values is 1: from the at least three current hash values, select a set number of current hash values respectively, and generate an intermediate hash value based on the selected set number of current hash values.
  • Hash value perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain; when there is the current hash value that has not been selected and has not been selected When the number of the selected current hash values is less than the set number, generate an intermediate hash value based on the unselected current hash value, and perform blockchain on-chain on the intermediate hash value operation, and obtain the corresponding second hash value from the blockchain; use the second hash value as the current hash value; the set number is an integer greater than 2.
  • Step S1203 Obtain the root hash value.
  • step S1202 it can be seen that there are three second hash values in level 2, and the second hash values are used as the current hash value; the operation of step S1202 is further performed to obtain the The second hash value; because the number of the second hash value (current hash value) is 1, the current hash value is used as the root hash value; it can be understood that the number of levels of the multi-fork tree is set It is determined by the number of file compression package hash values (first hash values); and the number of file compression package hash values is related to the number of files related to the generated business.
  • the number of values (first hash values) is not limited.
  • the second embodiment of the present disclosure provides a method for obtaining a shared file based on a hash value of a multi-tree structure, and the method may include the following steps:
  • steps S1301-S1303 take the example described in steps S1201-S1203 as an example to illustrate the method for obtaining a shared file based on a hash value of a multi-tree structure
  • Step S1301 According to the current hash value (root hash value).
  • the current hash value is received; it is determined that a file compressed package hash value that is the same as the current hash value exists on the blockchain; as shown in FIG. 13 , it is determined that the blockchain does not exist on the blockchain.
  • the hash value of the file compressed package with the same current hash value, that is, the current hash value is not the hash value of the file compressed package then determine the set number of lower-level hash values corresponding to the current hash value, and Take the lower-level hash value as the current hash value; the lower-level hash values of the current hash value are respectively lower-level hash value 1, lower-level hash value 2, and lower-level hash value 3; Hash value as the current hash value.
  • Step S1302-Step S1303 Circularly execute the acquisition of the lower-level hash value.
  • obtaining the file compressed package corresponding to the current hash value includes: obtaining the file compressed package corresponding to the current hash value, performing decompression and decryption operations on the file compressed package, and obtaining the compressed file in the file compressed package. Specifically, for each obtained file compressed package, decompression and decryption operations are performed, and the decompression and decryption methods correspond to the compression and encryption methods.
  • the level of the set number of fork trees is determined by the number of hash values of the file compressed package and the number of settings; and the number of hash values of the file compressed package is related to the number of files related to the generated business.
  • the number and the number of hash values of file archives are not limited.
  • the second embodiment of the present disclosure provides a process for sharing files, and the process includes the following steps:
  • the process of uploading the shared file to the chain is described using steps S1401 to S1403; the process of obtaining the shared file by the acquirer of the shared file is described using steps S1404 to S1405;
  • the acquirer of the shared file may be an enterprise directly related to the shared file in business, for example: Bank 1, Bank 2, Bank 3, etc.
  • Step S1401 Acquire files to be shared, and form multiple file compression packages.
  • acquiring files to be shared to form multiple file compression packages includes: acquiring files to be shared within a predefined time range, forming at least three file packages, and determining the number of files in the file packages according to network bandwidth. Further, compression and encryption operations are respectively performed on the file package to form the file compression package. A concurrent blockchain uploading operation is performed on the file compressed package.
  • Step S1402 Take the first hash value as the current hash value, and perform the following operations cyclically until the number of the current hash values is 1: from the at least three current hash values, select and set respectively A number of current hash values, an intermediate hash value is generated based on the selected set number of current hash values, the blockchain on-chain operation is performed on the intermediate hash value, and the corresponding second hash value is obtained from the blockchain.
  • Hash value when there is the current hash value that has not been selected and the number of the current hash value that has not been selected is less than the set number, based on the current hash value that has not been selected Generate an intermediate hash value from the hash value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain; use the second hash value as the current hash value.
  • Greek value the set number is an integer greater than 2.
  • step S1002 the description about obtaining the root hash value through circulation is consistent with step S1002, and details are not repeated here.
  • Step S1403 Use the current hash value as the root hash value, and send the hash value.
  • step S1003 the description about sending the root hash value is consistent with step S1003, and details are not repeated here.
  • Step S1404 Receive the current hash value; perform the following steps in a loop until the file compressed package corresponding to the current hash value is obtained; determine that a file compressed package with the same current hash value exists on the blockchain Hash value, if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine each subordinate corresponding to the current hash value hash value, and use the lower-level hash value as the current hash value.
  • the file compression package includes: obtaining the file compression package corresponding to the current hash value, performing decompression and decryption operations on the file compression package, and obtaining the files in the file compression package.
  • the second embodiment of the present disclosure provides an apparatus 1600 for sharing files, including: a file compression package uploading module 1601, a node hash value obtaining module 2602, and a root hash value obtaining module 1603; wherein,
  • the file compression package uploading module 1601 is used to obtain the files to be shared and form a plurality of file compression packages; perform blockchain chaining operation on the file compression package, and obtain the file compression package from the blockchain corresponding at least three first hash values;
  • the upper-level hash value obtaining module 1602 is configured to use the first hash value as the current hash value, and perform the following operations cyclically until the number of the current hash values is 1: from the at least three current hash values Among the hash values Among the hash values, a set number of current hash values are respectively selected, an intermediate hash value is generated based on the selected set number of current hash values, the blockchain on-chain operation is performed on the intermediate hash values, and Obtain the corresponding second hash value from the blockchain; when there is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the set number, based on The current hash value that has not been selected generates an intermediate hash value, performs a blockchain on-chain operation on the intermediate hash value, and obtains a corresponding second hash value from the blockchain; Two hash values are used as the current hash value; the set number is an integer greater than 2;
  • the root hash value obtaining module 1603 is configured to use the current hash value as the root hash value and send the hash value.
  • a second embodiment of the present disclosure provides an apparatus 1700 for sharing files, including: a module 1701 for obtaining on-chain files; wherein,
  • the on-chain file acquisition module 1701 is used to receive the current hash value; the following steps are performed cyclically until the file compressed package corresponding to the current hash value is obtained; The hash value of the file compressed package with the same hash value, if yes, execute A1; otherwise, execute A2; A1: obtain the file compressed package corresponding to the current hash value from the blockchain; A2: determine the each lower-level hash value corresponding to the current hash value, and the lower-level hash value is used as the current hash value.
  • a system 1800 for sharing files provided by the second embodiment of the present disclosure includes: the apparatus 1600 for sharing files provided by the second embodiment of the present disclosure and the apparatus for sharing files provided by the second embodiment of the present disclosure 1700.
  • a second embodiment of the present disclosure further provides an electronic device for sharing files, including: one or more processors; and a storage device for storing one or more programs, when the one or more programs are stored by the one or multiple processors to execute, so that the one or more processors implement the method provided by any of the above embodiments.
  • the second embodiment of the present disclosure further provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the method provided in any of the foregoing embodiments.
  • a third embodiment of the present disclosure provides a method for storing shared files, and the method may include the following steps:
  • Step S1901 Acquire the files to be shared within a set period to form multiple file compression packages; group the multiple file compression packages to obtain at least two groups of file compression packages; perform an execution area for each group of the file compression packages
  • the block chain is operated on the chain, and the first hash value corresponding to the file compressed package contained in each group is obtained from the block chain.
  • the file to be shared can be a transaction file generated by an electronic bank, a statement file generated by an electronic bank, an order file generated by an electronic mall, etc.
  • the present disclosure does not limit the format and content of the file with sharing; Files to be shared within a fixed period, the files to be shared are generated within a set period, for example, transaction files generated by an electronic bank within one hour, and statement files generated by two electronic banks within an hour , order documents generated by the electronic mall within one day, etc., the set period can be set according to the business scenario and the number of generated documents, for example, one day, one hour, 30 minutes, etc.; The content is not limited.
  • acquiring the files to be shared within the set period, and forming multiple file compression packages includes: acquiring the files to be shared within the set period, forming multiple file packages, and determining the file size of the files in the file package according to the network bandwidth. quantity. Further, acquiring the files to be shared within a predefined time range, forming a plurality of file compression packages according to the number and size of the files, and also performing a compression operation and an encryption operation, which improves the security of the files through encryption, especially The purpose is to improve the security of files that have high security requirements, such as statements between electronic banks and the like; that is, compression and encryption operations are respectively performed on the file package to form the file compression package.
  • the encryption method may be encrypted by using compression software, and may also be encrypted by using an operating system or encryption software. The present disclosure does not limit the specific methods of compression and encryption.
  • the multiple file compressed packages are grouped to obtain at least two groups of file compressed packages; specifically, there are two methods for grouping:
  • the first method take a plurality of the file compressed packages formed in the set segment period as a group of file compressed packages, and obtain at least two sets of file compressed packages, and the set period includes at least two set segment periods .
  • the set period includes at least two of the set segment periods, for example, the set segment period is 5 minutes, and the set period is 30 minutes, it can be seen that the set period includes 6 set segment periods; Further, a plurality of said file compression packages formed within 5 minutes are used as a group of file compression packages; a plurality of said file compression packages formed within another 5 minutes are used as another group of file compression packages; understandable Yes, there is a temporal sequence between each preset segment period; that is, taking a plurality of the file compressed packages formed respectively in at least two preset segment periods as a group of file compressed packages, at least two groups of files are obtained.
  • the set period includes at least two set segment periods; it can be understood that this method is to dynamically form a file compressed package; therefore, the number of each group of file
  • the second method group the plurality of file compressed packages according to the set number of files to obtain at least two groups of file compressed packages.
  • the set number of files is defined according to the total amount of files to be shared and the scene. For example, if the set number of files is 1000, then every 1000 file compression packages form a group, for example, the set period is 30 minutes , 10,000 file compression packages are formed within 30 minutes, and according to the set number of files 1000, they are divided into 10 groups of file compression packages; that is, the multiple file compression packages are grouped according to the set number of files, and at least two groups are obtained.
  • File zip package is defined according to the total amount of files to be shared and the scene. For example, if the set number of files is 1000, then every 1000 file compression packages form a group, for example, the set period is 30 minutes , 10,000 file compression packages are formed within 30 minutes, and according to the set number of files 1000, they are divided into 10 groups of file compression packages; that is, the multiple file compression packages are grouped according to the set number of files, and at least
  • the blockchain on-chain operation is performed for each group of the file compressed packages, wherein the file compressed package can be used as a transaction to perform the blockchain on-chain operation, and the returned data for the transaction can be obtained from the blockchain respectively.
  • Hash value this hash value is the first hash value corresponding to the file compressed package;
  • Each file compressed package in each group performs the blockchain on-chain operation, respectively, and obtains the corresponding first hash value from the blockchain.
  • the first hash value is the hash value of the file compressed package, for example, If there are 1000 file compressed packages in group 1, the corresponding 1000 first hash values are obtained; further, an intermediate hash value is generated based on the first hash value included in each group, and the intermediate hash values are respectively
  • the hash value performs the blockchain on-chain operation, and obtains the corresponding second hash value from the blockchain respectively; specifically, generating an intermediate hash value based on the first hash value included in each group can The included first hash values are combined to generate an intermediate hash value, or an intermediate hash value can be generated by operating on each first hash value.
  • first hash values of group 1 After calculating Generate an intermediate hash value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain;
  • the specific method for generating the intermediate hash value is not limited.
  • the intermediate hash value generated by the first hash value included in each group can be used as a transaction to perform the blockchain on-chain operation, and the second hash value returned for the transaction can be obtained from the blockchain respectively;
  • the present disclosure does not limit the numerical values of the set period, the set segment period, and the set number of files.
  • performing a blockchain on-chain operation on each group of the file compressed packages further includes: performing a blockchain concurrent on-chain operation on the file compressed packages included in each group. Because there is no transaction-dependent relationship between the file archives included in each group, the concurrent uploading operation of the file archives is performed; The chain operation can be carried out in batches, and each batch of file compressed packages is concurrently uploaded to the chain. Through the concurrent operation of the chain, the efficiency of file chaining is improved; among them, the blockchain used can be a consortium chain, private chain
  • the present disclosure does not limit the type of blockchain. The present disclosure does not limit the specific tools or methods used to perform blockchain on-chain operations.
  • Step S1902 take the second hash value as the current hash value, and perform the following operations cyclically until the number of the current hash values is 1: from the at least two current hash values, select a predefined number a current hash value, generate an intermediate hash value based on the selected predefined number of the current hash values, perform a blockchain on-chain operation on the intermediate hash value, and obtain the corresponding first hash value from the blockchain Two hash values; when there is the current hash value that has not been selected, and the number of the current hash values that have not been selected is less than the predefined number, based on the current hash value that has not been selected The hash value generates an intermediate hash value, performs a blockchain on-chain operation on the intermediate hash value, and obtains a corresponding second hash value from the blockchain; using the second hash value as the The current hash value; the predefined number is an integer greater than 1.
  • a total of 10 groups of file compressed packages are divided, and the corresponding first hash value is obtained for each file compressed package in each group.
  • the first hash value is the hash value of the file compressed package.
  • Generate an intermediate hash value based on the first hash value included in each group respectively perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain respectively;
  • the first hash value included in each group can be used as a transaction to perform the blockchain on-chain operation, and the second hash value returned for the transaction can be obtained from the blockchain respectively; for example, according to each of the 10 groups.
  • the first hash value of a group for example, group 1 contains 1000 file compressed packages, it corresponds to 1000 first hash values, an intermediate hash value is generated based on the 1000 first hash values, and the The intermediate hash value performs the blockchain on-chain operation, and obtains a corresponding second hash value from the blockchain. Similarly, 10 second hash values are obtained respectively according to the first hash value of each group.
  • the following operations are performed cyclically; until the number of the current hash values is 1: from the at least two current hash values, select a predefined number a current hash value, generate an intermediate hash value based on the selected predefined number of the current hash values, perform a blockchain on-chain operation on the intermediate hash value, and obtain the corresponding first hash value from the blockchain Two hash values; wherein, the intermediate hash value is generated based on the selected predefined number of current hash values, and the intermediate hash value can be generated by combining the selected predefined number of current hash values, or by Operate on the selected predefined number of current hash values to generate an intermediate hash value, use the intermediate hash value as a transaction to perform the blockchain on-chain operation, and obtain the corresponding second hash value from the blockchain ;
  • the present disclosure does not limit the specific method for generating the intermediate hash value from the selected predefined number of current hash values.
  • the number of the current hash value that has not been selected is less than the predefined number, based on the current hash value that has not been selected value to generate an intermediate hash value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain; use the second hash value as the current hash value value.
  • the predefined number is an integer greater than 1, for example, 2, 3, 4, 10, 100, 1000, and the predefined number is used for the number of forks of the tree structure formed by the second hash value.
  • the predefined number can be based on The specific value of the predefined quantity is not limited in the present disclosure.
  • the second hash value is used as the current hash value; it can be understood that, according to the above description, the hash value of each level is obtained through the loop until the unique root hash value is obtained (that is, until the The current number of hash values is 1), forming a tree-like hash value storage structure.
  • the complexity of acquiring the file is improved, thereby improving the security of the file.
  • a predefined number eg, 5
  • a block is executed according to the selected predefined number of said current hash values On-chain operation, and obtain the corresponding second hash value from the blockchain; it is understandable that a predefined number (5) of current hash values are selected from the 99 second hash values, and the selected The 5 hash values of , perform the blockchain on-chain operation, and obtain the corresponding second hash value from the blockchain.
  • 19 second hash values are obtained.
  • 95 (19*5) of the 99 current hash values correspond to 19 second hash values, and there are 4 current hash values that have not been selected and have not been selected.
  • an intermediate hash value is generated based on the 4 current hash values, the blockchain on-chain operation is performed on the intermediate hash value, and the data is retrieved from the blockchain.
  • the selected current hash value generates an intermediate hash value, performs a blockchain on-chain operation on the intermediate hash value, and obtains a corresponding second hash value from the blockchain.
  • the above example steps describe that 20 second hash values are obtained based on 99 current hash values, and the 20 second hash values are used as the current hash value, and the above steps are executed cyclically. Similarly, it can be known that 20 Among the current hash values, 5 (pre-defined number) are selected to perform the blockchain on-chain operation, and the second hash value corresponding to the next level is obtained from the blockchain. It can be seen that 4 second hash values have been obtained.
  • Step S1903 Use the current hash value as the root hash value, and send the current hash value.
  • step S1902 After looping, the root hash value is obtained and the root hash value is sent.
  • the root hash value is sent to the acquirer with the permission to obtain the shared file, and the acquirer with the permission may be one or more parties;
  • the file is the statements generated by bank A and bank B within a predefined time range; after step S1901-step S1903, the root hash value is generated, then the root hash value is sent to these statements The file has access to Bank A and Bank B; obviously, using this operation further improves the security of the file.
  • a further example of the flow of steps S1901-S1903 is shown in FIG. 31 .
  • a third embodiment of the present disclosure provides a method for acquiring a shared file, and the method may include the following steps:
  • Step S2001 Receive the current hash value; cyclically execute the following steps until the file compressed package corresponding to the current hash value is obtained; determine that there is a file compressed package that is the same as the current hash value on the blockchain Hash value, if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine each subordinate corresponding to the current hash value Hash value, and use the lower-level hash value as the current hash value. Specifically, according to the root hash value, obtain the file compression package corresponding to the file compression package hash value from the blockchain The description of the file method is consistent with the example described in steps S2201 to S2203, and details are not repeated here.
  • a third embodiment of the present disclosure provides a method for storing a shared file hash value using a multi-fork tree structure, and the method may include the following steps:
  • Step S2101 Perform a blockchain on-chain operation on the file compressed package of group 1, and obtain n first hash values corresponding to the file compressed package included in each group from the blockchain.
  • group 1 includes file compression package 1-file compression package n; it can be understood that, according to the two grouping methods described in step S1902, file compression package 1-file compression package n may be a set point Each file compressed package formed in the segment period; it can also be a set number of file compressed packages, and n is the set number of files; further, perform the blockchain on-chain operation for each file compressed package in group 1 , and obtain the first hash value corresponding to the file compressed package contained in each group from the blockchain; for example, perform the blockchain on-chain operation on the file compressed package 1, and obtain the corresponding first hash value from the blockchain Hash value, where the file compression package 1 can be used as a transaction to perform the blockchain on-chain operation, and the first hash value for the transaction can be obtained from the blockchain, for example: the first hash value 1; and so on , perform the blockchain on-chain operation on the file compressed package n, and obtain the corresponding first hash value n from the blockchain; it is understandable that the number of file compressed
  • Step S2102 Perform the blockchain on-chain operation on the first hash value included in group 1, and obtain the corresponding second hash value 1 from the blockchain; as described in step S2101, according to the There are n file compressed packages, and the first hash values corresponding to the n file compressed packages are obtained, that is, the first hash value 1-the first hash value n; further, an intermediate hash value is generated based on the n first hash values Hash value, respectively perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value (second hash value 1) from the blockchain;
  • the number is 1; that is, a second hash value is obtained according to each first hash value of a group; that is, an intermediate hash value is generated based on the first hash value included in each group, and the The intermediate hash value performs the blockchain on-chain operation, and obtains the corresponding second hash value from the blockchain respectively.
  • Step S2103 Perform a blockchain on-chain operation on the file compressed package of group 2, and obtain m first hash values corresponding to the file compressed package included in group 2 from the blockchain.
  • Step S2104 Generate an intermediate hash value based on the first hash value included in group 2, perform a blockchain on-chain operation on the intermediate hash value respectively, and obtain a corresponding second hash value from the blockchain 2;
  • step S2103-step S2104 is similar to that of step S2101-step S2102; it can be understood that, as in the two grouping methods described in step S1902, file compression package 1-file compression package m can be formed within a set segment period. Each file compression package of ; it can also be a set number of file compression packages, then m is the set number of files.
  • n and n in steps S2101-step S2102 can be different values; when using the grouping method of setting the number of files, m and steps S2101-step S2102 In the The n is the same value; both are equal to the set number of files.
  • Step S2105 Perform a blockchain on-chain operation on the file compressed package in group 3, and obtain a first hash value corresponding to the file compressed package included in group 3 from the blockchain.
  • Step S2106 Generate an intermediate hash value based on the first hash value included in group 3, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain 3.
  • step S2105-step S2106 is similar to the description of step S2103-step S2104; it will not be repeated here.
  • Step S2107 Obtain the current hash value.
  • the second hash value 1, the second hash value 2, and the second hash value 3 obtained in step S2101-step S2106 are used as the current hash value; a predefined number (for example: 2) current hash values are selected. Hash value, and perform the blockchain on-chain operation for the selected predefined number of the current hash values (for example: the second hash value 1 and the second hash value 2 of level 1), and extract the block from the block.
  • the chain obtains the corresponding second hash value (for example: the second hash value 1 of level 2); further, when there is the current hash value (second hash value 3) that has not been selected, and the When the number of the selected current hash values is less than the predefined number (1 ⁇ 2), an intermediate hash value is generated based on the unselected current hash value, and the intermediate hash value is Perform the blockchain on-chain operation, and obtain the corresponding second hash value from the blockchain (for example: Level 2 second hash value 2).
  • the following operations are performed cyclically until the number of the current hash values is 1: from the at least two current hash values, select a predefined number of The current hash value, generating an intermediate hash value based on the selected predefined number of the current hash values, performing the blockchain on-chain operation on the intermediate hash value, and obtaining the corresponding second hash value from the blockchain Hash value; when there is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the predefined number, based on the current hash value that has not been selected Generate an intermediate hash value from the desired value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain; use the second hash value as the current Hash value; the predefined number is an integer greater than 1.
  • Step S2108 Use the current hash value as the root hash value.
  • the current hash value is used as the root hash value, and the current hash value is sent.
  • the current hash value is taken as the root hash value, and the current hash value is sent.
  • the third embodiment of the present disclosure provides a method for obtaining a shared file based on a hash value of a multi-tree structure, and the method may include the following steps:
  • steps S2201-S2203 take the example described in steps S2101-S2103 as an example to illustrate the method for obtaining a shared file based on a hash value of a multi-tree structure;
  • Step S2201 According to the current hash value (root hash value).
  • the current hash value is received; it is determined that the same hash value of the file compressed package as the current hash value exists on the blockchain.
  • Step S2202 cyclically execute the operation of obtaining the lower-level hash value
  • the following describes an example of the process of traversing the hash values of each layer below the root hash value and obtaining a file compressed package; specifically, as shown in Figure 22, receiving the current hash value (subordinate hash value 1, subordinate hash value 2) ; determine that there is no file compression package hash value identical to the current hash value (subordinate hash value 1) on the blockchain; then determine each subordinate hash value corresponding to the current hash value, and Taking the lower-level hash value as the current hash value, for example: determining that each sub-hash value corresponding to lower-level hash value 1 (level 2) is lower-level hash value 1-lower-level hash value 2 (level 3) ; Further, determine that there is the same file compression package hash value (subordinate hash value 1-subordinate hash value a) as the current hash value (subordinate hash value 2) on the blockchain; then from The file compression package corresponding to the current hash value is obtained on the blockchain; they are respectively file compression package 1-file compression package a; further, for the
  • Corresponding file compressed package determine that there is a file compressed package hash value that is the same as the current hash value on the blockchain, if so, execute A1; otherwise, execute A2; A1: Obtained from the blockchain A file compressed package corresponding to the current hash value; A2: Determine each lower-level hash value corresponding to the current hash value, and use the lower-level hash value as the current hash value.
  • Step S2204 Obtain the file compressed package and the files in the file compressed package according to the first hash value of the file compressed package. Specifically, obtaining the file compressed package corresponding to the current hash value includes: acquiring the file compressed package corresponding to the current hash value, performing decompression and decryption operations on the file compressed package, and obtaining the file compressed package Specifically, for each obtained file compressed package, decompression and decryption operations are performed, and the decompression and decryption methods correspond to the compression and encryption methods.
  • the third embodiment of the present disclosure provides a process for sharing files, and the process includes the following steps:
  • the process of uploading the shared file to the chain is described by steps S2301-S2303; the process of obtaining the shared file by the acquirer of the shared file is described by step S2304;
  • the shared file acquirer may be an enterprise directly related to the shared file in business, for example: Bank 1, Bank 2, Bank 3, and so on.
  • Step S2301 Acquire files to be shared within a set period to form multiple file compression packages; group the multiple file compression packages to obtain at least two groups of file compression packages; perform an execution area for each group of the file compression packages
  • the block chain is operated on the chain, and the first hash value corresponding to the file compressed package contained in each group is obtained from the block chain.
  • the description about the formation of the file compressed package and the uploading of the chain is consistent with step S1901, and will not be repeated here; further, the multiple file compressed packages are grouped to obtain at least two groups of file compressed packages; including: A plurality of the file compressed packages formed in the set segment period are taken as a group of file compressed packages to obtain at least two groups of file compressed packages, and the set period includes at least two set segment periods.
  • the grouping of the plurality of file compression packages to obtain at least two groups of file compression packages includes: grouping the plurality of file compression packages according to the set number of files to obtain at least two groups of file compression packages.
  • acquiring files to be shared within a set period to form multiple file compression packages including: acquiring files to be shared within a set period, forming multiple file packages, and determining files in the file package according to network bandwidth. quantity.
  • compression and encryption operations are respectively performed on each group of the file packages to form the file compression package.
  • a blockchain concurrent on-chain operation is performed on the file archives contained in each group.
  • Step S2302 Generate an intermediate hash value based on the first hash value included in each group, respectively perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain respectively. Greek value. Taking the second hash value as the current hash value, the following operations are performed cyclically until the number of the current hash values is 1: from the at least two current hash values, a predefined number of current hash values are selected.
  • Hash value generate an intermediate hash value based on the selected predefined number of the current hash values, perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain value; when there is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the predefined number, based on the current hash value that has not been selected Generate an intermediate hash value, perform a blockchain on-chain operation on the intermediate hash value, and obtain a corresponding second hash value from the blockchain; use the second hash value as the current hash value; the predefined number is an integer greater than 1.
  • step S1902 the description about obtaining the second hash value (current hash value) is consistent with step S1902, and details are not repeated here.
  • Step S2303 Use the current hash value as the root hash value, and send the current hash value.
  • Step S2304 Receive the current hash value; perform the following steps in a loop until the file compressed package corresponding to the current hash value is obtained; determine that there is a file compressed package that is the same as the current hash value on the blockchain Hash value, if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine each subordinate corresponding to the current hash value hash value, and use the lower-level hash value as the current hash value.
  • the method includes: obtaining a file compression package corresponding to the current hash value, performing decompression and decryption operations on the file compression package, and obtaining files in the file compression package.
  • the third embodiment of the present disclosure provides an apparatus 2400 for sharing files, including: a file compression package uploading module 2401, a current hash value obtaining module 2402, and a root hash value obtaining module 2403; wherein,
  • the file compression package uploading module 2401 is used to obtain files to be shared within a set period to form multiple file compression packages; group the multiple file compression packages to obtain at least two groups of file compression packages; A group of the file compression packages performs the blockchain on-chain operation, and obtains the first hash value corresponding to the file compression package included in each group from the blockchain;
  • the current hash value acquisition module 2402 is configured to generate an intermediate hash value based on the first hash value included in each group, perform a blockchain on-chain operation on the intermediate hash value, and retrieve the hash value from the The blockchain obtains the corresponding second hash value; using the second hash value as the current hash value, the following operations are performed cyclically until the number of the current hash values is 1: from the at least two current hash values Among the hash values Among the hash values, a predefined number of current hash values are selected, an intermediate hash value is generated based on the selected predefined number of the current hash values, and a blockchain on-chain operation is performed on the intermediate hash values, And obtain the corresponding second hash value from the blockchain; when there is the current hash value that has not been selected, and the number of the current hash value that has not been selected is less than the predefined number, Generate an intermediate hash value based on the current hash value that has not been selected, perform a blockchain on-chain operation on the intermediate
  • the root hash value obtaining module 2403 is configured to use the current hash value as the root hash value and send the current hash value.
  • a third embodiment of the present disclosure provides an apparatus 2500 for sharing files, including: a module 2501 for obtaining on-chain files;
  • the module 2501 for obtaining files on the chain is used to receive the current hash value; the following steps are executed cyclically until the file compressed package corresponding to the current hash value is obtained; If it is, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Confirm each lower-level hash value corresponding to the current hash value, and the lower-level hash value is used as the current hash value.
  • the third embodiment of the present disclosure provides a system 2600 for sharing files, including: the apparatus 2400 for sharing files provided by the third embodiment of the present disclosure and the apparatus for sharing files provided by the third embodiment of the present disclosure 2500.
  • a third embodiment of the present disclosure also provides an electronic device for sharing files, including: one or more processors; and a storage device for storing one or more programs, when the one or more programs are stored by the one or multiple processors to execute, so that the one or more processors implement the method provided by any of the above embodiments.
  • the third embodiment of the present disclosure further provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the method provided in any of the foregoing embodiments.
  • a fourth embodiment of the present disclosure provides a method for storing and updating a shared file, and the method may include the following steps:
  • Step S2701 Obtain an update file, and search for the file to be updated according to the file name of the update file; form a first file compression package according to the update file, and perform a blockchain on-chain operation on the first file compression package, Obtain the first hash value corresponding to the first file compressed package from the blockchain;
  • the file to be updated when the update file is obtained, the file to be updated can be searched according to the file name of the update file; the file to be updated can exist in a file compressed package can also exist in multiple file compression packages, wherein the file compression package to which the file to be updated belongs can be obtained from a local storage medium synchronized with the blockchain, or obtained from the blockchain; further, the said According to the update file, forming the first file compression package includes: searching for the second file package where the file to be updated is located according to the file name of the update file, when the second file package includes other files other than the file to be updated When the file is created, a first file package is generated according to the other files and the update file.
  • file compression package 1 (for the second file package corresponding to the second file package)
  • the file name of the package) contains 100 files, among which, "file 99.aa” is a file to be updated, and the other 99 files are files that do not need to be updated, then, replace the update file "file 99.aa” update the file with the same file name, and generate a new file package (ie, the first file package) with other 99 files (that is, including other files except the file to be updated); further, for the The first file package performs compression and encryption operations to form the first file package. It is understandable that each file compression package is already included on the blockchain;
  • the first file compressed package performs a blockchain on-chain operation on the first file compressed package, and obtain a first hash value corresponding to the first file compressed package from the blockchain; the first file on the chain is compressed
  • the package is a compressed package containing the updated file and replaces the original file compressed package; wherein, the first file compressed package can be used as a transaction to perform the blockchain chaining operation, and the hash returned for the transaction can be obtained from the blockchain value, the hash value is the first hash value of the file compressed package, that is, the first hash value corresponding to the first file compressed package, and the blockchain used can be a consortium chain, a private chain, etc.
  • the present disclosure does not limit the type of blockchain.
  • the present disclosure does not limit the specific tools or methods used to perform blockchain on-chain.
  • Step S2702 Use the first hash value to replace the second hash value in the fork tree in the blockchain, and the second file compressed package corresponding to the second hash value includes the file to be updated;
  • the fork tree includes at least three hash values; according to the structure of the fork tree, it is determined that at least one of the fork tree is associated with the second hash value and located at an upper level of the second hash value.
  • a third hash value the upper level is a level close to the root hash value in the fork tree; at least one fourth hash value is obtained according to the first hash value and the structure of the fork tree, so The at least one fourth hash value is in a one-to-one correspondence with the position of the at least one third hash value in the fork tree; the third hash value corresponding to the position is replaced with the fourth hash value value.
  • the first hash value is used to replace the second hash value in the fork tree in the blockchain, and the second file compressed package corresponding to the second hash value includes the to-be-updated file;
  • the fork The tree includes at least three hash values; according to the structure of the fork tree, determine at least one third hash value in the fork tree that is associated with the second hash value and located at an upper level of the second hash value Hash value; the upper level is the level close to the root hash value in the fork tree; at least one fourth hash value is obtained according to the first hash value and the structure of the fork tree, the at least one The fourth hash value corresponds one-to-one with the position of the at least one third hash value in the fork tree; the third hash value corresponding to the position is replaced with the fourth hash value.
  • FIG. 29 shows a tree structure that does not contain an update file
  • FIG. 30 shows an update containing an update based on the tree structure of FIG. 29 The tree structure of the file.
  • step S2901 shown in FIG. 29 the hash value of the second file package 2 is the second hash value in the fork tree; correspondingly, in step S3001 shown in FIG. 30 , the hash value of the first file package 2 The value is the first hash value in the fork tree; wherein, the first file compression package (the first file compression package 2) corresponding to the first hash value (the first file compression package 2 hash value) in step S3001 Update files are included.
  • the second file compression package (second file compression package 2) corresponding to the second hash value (the second file compression package 2 hash value) in step S2901 contains the file to be updated with the same file name;
  • a hash value replaces the second hash value in the fork tree in the blockchain, and the second file compressed package corresponding to the second hash value includes the file to be updated; further, as shown in Figure 29 and Figure 2
  • the fork tree shown in 30 contains 11 hash values respectively; that is, the fork tree includes at least three hash values; it can be understood that the fork tree may be a set number of forks A tree, for example, a binary tree, a ten-fork tree, a hundred-fork tree, etc.; it may also be an unfixed number of fork trees, and the present disclosure does not limit the specific shape and content of the fork tree.
  • step S2 According to the structure of the fork tree, determine at least one third hash value in the fork tree that is associated with the second hash value and is located at an upper level of the second hash value; the upper level is the level close to the root hash value in the fork tree; in step S2902 shown in FIG. 29 , the second hash value (the second file compressed package) of the fork tree (the fork tree shown in FIG. 29 ) is determined 2 hash value) and at least one third hash value (as shown in FIG.
  • the superior value is the third hash value 1, the third hash value 2, the root hash value), and as shown in Figure 29, with respect to the second hash value (the second file compressed package 2 hash value),
  • the level where the third hash value 1 is located is a level close to the root hash value; compared with the third hash value 1, the level where the third hash value 2 is located is a level close to the root hash value.
  • S3 Obtain at least one fourth hash value according to the first hash value and the structure of the fork tree, where the at least one fourth hash value and the at least one third hash value are in the The positions in the fork tree are in one-to-one correspondence; the third hash value corresponding to the position is replaced by the fourth hash value;
  • step S3002 shown in FIG. 30 according to the determination of the first hash value (the hash value of the first file compressed package 2 shown in FIG. 30 ) and the fork tree structure ( FIG. 29 or The fork tree shown in FIG. 30 ), obtain at least one fourth hash value (the fourth hash value 1 shown in FIG. 30 ), the at least one fourth hash value (the fourth hash value shown in FIG. 30 ) Four hash values 1) and the at least one third hash value (as shown in FIG. 29, the third hash value 1) are in the fork tree (the fork tree shown in FIG. 29 or FIG. 30) The positions in the one-to-one correspondence;
  • the method for obtaining at least one fourth hash value is: based on the hash value of the first file compressed package 2 (that is, the first Hash value) and the hash values of other file compression packages at the same level (level 1) to generate an intermediate hash value, execute the intermediate hash value on the blockchain and obtain the corresponding fourth hash value.
  • the intermediate hash value can be used as a transaction to perform the chain operation, and the hash value returned for the transaction can be obtained from the blockchain, and the hash value is the fourth hash value; further, based on the first hash value
  • the fourth hash value 1 and the third hash value 3 at the same level generate an intermediate hash value, perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding fourth hash value, such as the fourth hash value 2 , through layer-by-layer iteration until a new root hash value is obtained; further, each of the third hash values corresponding to the positions is replaced by each of the fourth hash values, as shown in FIG. 30 .
  • Step S2703 Use the fourth hash value of the highest level as a new root hash value, and send the new root hash value.
  • the fourth hash value of the highest level is used as the new root hash value (step S3004 shown in FIG. 30 (step S3004 shown in FIG. 30 , corresponding to step S2904 shown in FIG. 29 );
  • send the new root hash value there are two methods for sending the new root hash value: 1) Send the new root hash value through the block chain to the person who has the permission to obtain and update the shared file The acquirer; 2) Send the new root hash value to the acquirer who has the permission to acquire and update the shared file by other means, such as: official email, etc.; it is understandable that the new root hash value is sent To the acquirer who has the permission to acquire and update the shared file, the acquirer with the permission may be one or more parties; for example: the update file is the statement generated by bank A and bank B within a predefined time range; in step S2701 - A new root hash value is generated after step S2703, then the new root hash value is sent to Bank A and Bank B that have access rights to these updated statement
  • the fourth embodiment of the present disclosure provides a method for obtaining and updating a shared file, and the method may include the following steps:
  • Step S2801 Receive a root hash value; determine a sub-hash value corresponding to the root hash value; perform the following steps in a loop until a file compression package corresponding to the sub-hash value is obtained, where the file compression package includes Update the file; determine that there is the same file compression package hash value as the sub-hash value on the blockchain, if so, execute A1; otherwise, execute A2; A1: Obtain the sub-hash value from the blockchain A file compression package corresponding to the hash value; A2: Determine the lower-level hash value corresponding to the sub-hash value, and use the lower-level hash value as the sub-hash value.
  • obtaining the update file in the update file compressed package corresponding to the sub-hash value includes: obtaining the update file compressed package corresponding to the sub-hash value, Perform decompression and decryption operations on the update file compressed package described above to obtain the update files in the file package. Specifically, decompression and decryption operations are performed for each obtained file compression package, and the decompression and decryption methods correspond to the compression and encryption methods.
  • the fourth embodiment of the present disclosure provides a method for obtaining and updating a shared file based on a tree-structured hash value.
  • the method may include the following steps:
  • Step S3101 According to the received root hash value.
  • the root hash value is received; the sub-hash value corresponding to the root hash value is determined; it can be understood that the root hash value is a new root hash value;
  • the sub-hash values corresponding to the hash value are respectively lower-level hash value 1 and lower-level hash value 2.
  • Step S3102-Step S3103 Circularly execute the acquisition of the lower-level hash value.
  • Steps S3102-S3103 are described below to perform cyclic execution until the file compression package containing the update file corresponding to the sub-hash value is obtained; specifically, as shown in FIG. 5 , first determine the corresponding sub-hash value Whether it is the hash value of the file compression package containing the update file, for the lower-level hash value 1: determine that the same sub-hash value (level 2, lower-level hash value 1) does not exist on the blockchain The file compression package hash value, the file compression package includes the update file; then determine the subordinate hash value corresponding to the sub-hash value (level 2, subordinate hash value 1), and use the subordinate hash value As the sub-hash value, for example, each sub-hash value corresponding to the lower-level hash value 1 is determined to be lower-level hash value 1 and lower-level hash value 2 (belonging to level 3).
  • the corresponding sub-hash value is the hash value of the file compression package containing the update file; for the lower-level hash value 2: determine that the current hash value (level) does not exist on the blockchain. 2: lower-level hash value 2) the same file compression package hash value (the file compression package includes the update file), it can be seen from the example in FIG. 5 that the lower-level hash value 2 of level 2 and the file compression package 2 hash value are: same.
  • each sub-hash value corresponding to the lower-level hash value 1 (level 2) is further determined to be lower-level hash value 1 (level 3) and lower-level hash value 2 (level 3); further, determine the block
  • a file compression package hash value update file compression package 2 hash value, the update file compression package includes an update file
  • the traversal operation can be stopped; that is, receiving the root hash value; determining the sub-hash value corresponding to the root hash value; and cyclically executing the following steps until the The file compression package corresponding to the sub-hash value, the file compression package includes an update file; determine that the same file compression package hash value as the sub-hash value exists on the blockchain, and if so, execute A1; Otherwise, execute A2;
  • Step S3104 Obtain the update file compressed package and the update file.
  • the update file compressed package is obtained; further, the obtained file compressed package corresponding to the current hash value includes: obtaining the file compressed package corresponding to the current hash value, Perform decompression and decryption operations on the file compressed package, and obtain the files in the file compressed package; specifically, for each obtained file compressed package, perform decompression and decryption operations, and the methods of decompression and decryption and compression and encryption. correspond.
  • the fourth embodiment of the present disclosure provides a process for updating a shared file, and the process includes the following steps:
  • step S3204 is used to describe the process by which the update file acquirer obtains the update shared file; for example, execute
  • the update file on the chain can be the bank headquarters, and the acquirer of the update shared file can be an enterprise directly related to the update file in business, such as: Bank 1, Bank 2, Bank 3, etc.
  • Step S3201 Obtain the update file, and search for the file to be updated according to the file name of the update file; form a first file compression package according to the update file, and perform a blockchain on-chain operation on the first file Obtain the first hash value corresponding to the first file compressed package.
  • the description about the first file compression package containing the update file is consistent with step S2701, and details are not repeated here; further, the first file compression package formed according to the update file includes: according to the update file Find the second file package where the file to be updated is located with the file name, and when the second file package includes other files except the file to be updated, generate the first file according to the other files and the update file. file package. Still further, performing compression and encryption operations on the first file package to form the first file package.
  • Step S3202 Use the first hash value to replace the second hash value in the fork tree in the blockchain, and the second file compressed package corresponding to the second hash value includes the file to be updated;
  • the fork tree includes at least three hash values; according to the structure of the fork tree, it is determined that at least one of the fork tree is associated with the second hash value and located at an upper level of the second hash value.
  • a third hash value the upper level is a level close to the root hash value in the fork tree; at least one fourth hash value is obtained according to the first hash value and the structure of the fork tree, so The at least one fourth hash value is in a one-to-one correspondence with the position of the at least one third hash value in the fork tree; the third hash value corresponding to the position is replaced with the fourth hash value value.
  • Step S3203 Perform the blockchain on-chain operation on the first hash value and the fourth hash value respectively, take the fourth hash value of the highest level as the new root hash value, and send the new root hash value.
  • step S2703 the description about generating a new root hash value is consistent with step S2703, and will not be repeated here.
  • Step S3204 Receive the root hash value; determine the sub-hash value corresponding to the root hash value; perform the following steps in a loop until the file compression package corresponding to the sub-hash value is obtained, where the file compression package includes Update the file; determine that there is the same file compression package hash value as the sub-hash value on the blockchain, if so, execute A1; otherwise, execute A2; A1: Obtain the sub-hash value from the blockchain A file compression package corresponding to the hash value; A2: Determine the lower-level hash value corresponding to the sub-hash value, and use the lower-level hash value as the sub-hash value.
  • acquiring the update file in the update file compressed package corresponding to the sub-hash value includes: acquiring the update file compressed package corresponding to the sub-hash value, and performing decompression and decryption operations on the update file compressed package , to get the updated files in the package.
  • the fourth embodiment of the present disclosure provides an apparatus 3300 for updating a shared file, including: a file updating module 3301, a hash value updating module 3302, and a root hash value updating module 3303; wherein,
  • the file update module 3301 is used to obtain an update file, and search for the file to be updated according to the file name of the update file; form a first file compression package according to the update file, and execute the area for the first file compression package
  • the blockchain on-chain operation is to obtain the first hash value corresponding to the first file compressed package from the blockchain;
  • the hash value update module 3302 is configured to use the first hash value to replace the second hash value in the fork tree in the blockchain, and the second file compression package corresponding to the second hash value including the file to be updated;
  • the fork tree includes at least three hash values; according to the structure of the fork tree, it is determined that the fork tree is associated with the second hash value and located in the At least one third hash value of the upper level of the second hash value; the upper level is the level close to the root hash value in the fork tree; according to the first hash value and the structure of the fork tree, obtain at least one A fourth hash value, the at least one fourth hash value corresponds to the position of the at least one third hash value in the fork tree one-to-one; the fourth hash value is used to replace the corresponding position. the corresponding third hash value;
  • the root hash value updating module 3303 is configured to use the fourth highest-level hash value as a new root hash value, and send the new root hash value.
  • the file update module 3301 further includes: searching for the second file package where the file to be updated is located according to the file name of the update file, when the second file package includes files other than the file to be updated When other files are present, a first file package is generated according to the other files and the update file.
  • the file updating module 3301 is further configured to perform compression and encryption operations on the first file package to form the first file compressed package.
  • a fourth embodiment of the present disclosure provides an apparatus 3400 for updating a shared file, including: a module 3401 for obtaining an update file; wherein,
  • the acquiring and updating file module 3401 is used for receiving the root hash value; determining the sub-hash value corresponding to the root hash value; and cyclically executing the following steps until the file compression package corresponding to the sub-hash value is acquired , the file compression package includes an update file; determine that there is a hash value of the file compression package that is the same as the sub-hash value on the blockchain, if so, execute A1; otherwise, execute A2; A1: from the area Obtain the file compressed package corresponding to the sub-hash value on the block chain; A2: Determine the sub-hash value corresponding to the sub-hash value, and use the sub-hash value as the sub-hash value.
  • the acquiring update file module 3401 is further configured to acquire the update file in the update file compressed package corresponding to the sub-hash value, including: acquiring the update file compressed package corresponding to the sub-hash value, Perform decompression and decryption operations on the update file compressed package to obtain the update file in the file package.
  • a fourth embodiment of the present disclosure provides a system 3500 for updating a shared file, including: an apparatus 3300 for updating a shared file and an apparatus 3400 for updating a shared file.
  • a fourth embodiment of the present disclosure further provides an electronic device for updating a shared file, including: one or more processors; and a storage device for storing one or more programs, when the one or more programs are One or more processors execute, so that the one or more processors implement the method provided by any of the above embodiments.
  • the fourth embodiment of the present disclosure further provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the method provided in any of the foregoing embodiments.
  • FIG. 36 shows an exemplary system architecture 3600 of a method for sharing a file or an apparatus for sharing a file to which embodiments of the present disclosure may be applied.
  • the system architecture 3600 may include terminal devices 3601 , 3602 , 3603 , a network 3604 and a server 3605 .
  • the network 3604 is the medium used to provide the communication link between the terminal devices 3601 , 3602 , 3603 and the server 3605 .
  • the network 3604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
  • the user can use the terminal devices 3601, 3602, 3603 to interact with the server 3605 through the network 3604 to receive or send messages and the like.
  • Various client applications may be installed on the terminal devices 3601 , 3602 and 3603 , such as enterprise application clients, web browser applications, search applications, instant messaging tools, and email clients.
  • Terminal devices 3601, 3602, 3603 may be various electronic devices having a display screen and supporting the running of various client applications, including but not limited to smart phones, tablet computers, laptop and desktop computers, and the like.
  • the server 3605 may be a server that provides various services, for example, a background management server that supports the requests for obtaining files made by users using the terminal devices 3601 , 3602 , and 3603 .
  • the background management server can upload and store the file to be shared, process the request for obtaining the file, and return the file to the terminal device.
  • the method for sharing files provided by the embodiments of the present disclosure is generally performed by the server 3605 , and accordingly, the apparatus for sharing files is generally set in the server 3605 .
  • terminal devices, networks and servers in FIG. 36 are merely illustrative. There can be any number of terminal devices, networks and servers according to implementation needs.
  • FIG. 37 shows a schematic structural diagram of a computer system 3700 suitable for implementing the terminal device of the embodiment of the present disclosure.
  • the terminal device shown in FIG. 37 is only an example, and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
  • a computer system 3700 includes a central processing unit (CPU) 3701, which can be loaded into a random access memory (RAM) 3703 according to a program stored in a read only memory (ROM) 3702 or a program from a storage section 3708 Instead, various appropriate actions and processes are performed.
  • RAM random access memory
  • ROM read only memory
  • various programs and data required for the operation of the system 3700 are also stored.
  • the CPU 3701, the ROM 3702, and the RAM 3703 are connected to each other through a bus 3704.
  • An input/output (I/O) interface 3705 is also connected to bus 3704 .
  • the following components are connected to the I/O interface 3705: an input section 3706 including a keyboard, a mouse, etc.; an output section 3707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 3708 including a hard disk, etc. ; and a communication section 3709 including a network interface card such as a LAN card, a modem, and the like.
  • the communication section 3709 performs communication processing via a network such as the Internet.
  • Drivers 3710 are also connected to I/O interface 3705 as needed.
  • a removable medium 3737 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 3737 as needed so that a computer program read therefrom is installed into the storage section 3708 as needed.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods illustrated in the flowcharts.
  • the computer program may be downloaded and installed from the network via the communication portion 3709, and/or installed from the removable medium 3737.
  • CPU central processing unit
  • the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more functions for implementing the specified logical function(s) executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • the modules and/or units involved in the embodiments of the present disclosure may be implemented in a software manner, and may also be implemented in a hardware manner.
  • the described modules and/or units can also be provided in the processor, for example, it can be described as: a processor includes a file compression package uploading module, a node hash value obtaining module and a root hash value obtaining module; wherein, The names of these modules do not limit the module itself under certain circumstances.
  • the file compression package uploading module can also be described as "a module that forms a file compression package and performs the uploading operation according to the received files. ".
  • a processor includes a module for obtaining on-chain files; wherein, the name of the module does not constitute a limitation on the module itself under certain circumstances, for example, the module for obtaining on-chain files can also be described as "The module that obtains the files contained in the file archive based on the hash value of the file archive".
  • the present disclosure also provides a computer-readable medium.
  • the computer-readable medium may be included in the device described in the above-mentioned embodiments, or it may exist alone without being assembled into the device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by a device, the device includes:
  • Receive the current hash value ; perform the following steps in a loop until the file compressed package corresponding to the current hash value is obtained; determine that there is a file compressed package hash value that is the same as the current hash value on the blockchain , if yes, execute A1; otherwise, execute A2; A1: Obtain the file compression package corresponding to the current hash value from the blockchain; A2: Determine the two lower-level hashes corresponding to the current hash value value, and use the lower-level hash value as the current hash value.
  • the first hash value is used as the current hash value, and the following operations are performed cyclically until the number of the current hash values is 1: from the at least three current hash values, a set number of current hash values are selected respectively.
  • Hash value perform blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain; use the second hash value as the current hash value;
  • the set number is an integer greater than 2; the current hash value is taken as the root hash value, and the hash value is sent.
  • Receive the current hash value ; perform the following steps in a loop until the file compressed package corresponding to the current hash value is obtained; determine that there is a file compressed package hash value that is the same as the current hash value on the blockchain , if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine each lower-level hash value corresponding to the current hash value , and use the lower-level hash value as the current hash value.
  • the files to be shared within the set period to form multiple file compression packages group the multiple file compression packages to obtain at least two sets of file compression packages; execute the block chain on each group of the file compression packages chain operation, and obtain the first hash value corresponding to the file compressed package included in each group from the blockchain; generate an intermediate hash value based on the first hash value included in each group, respectively
  • the intermediate hash value performs the blockchain on-chain operation, and obtains the corresponding second hash value from the blockchain respectively; the second hash value is used as the current hash value, and the following operations are performed cyclically until the current hash value is
  • the number of hash values is 1: from the at least two current hash values, a predefined number of current hash values are selected, and an intermediate hash value is generated based on the selected predefined number of said current hash values, Perform the blockchain on-chain operation on the intermediate hash value, and obtain the corresponding second hash value from the blockchain; when there is the current hash value that has not been selected, and the When the number of
  • Receive the current hash value ; perform the following steps in a loop until the file compressed package corresponding to the current hash value is obtained; determine that there is a file compressed package hash value that is the same as the current hash value on the blockchain , if yes, execute A1; otherwise, execute A2; A1: Obtain the file compressed package corresponding to the current hash value from the blockchain; A2: Determine each lower-level hash value corresponding to the current hash value , and use the lower-level hash value as the current hash value.
  • the second file compression package includes the file to be updated; the fork tree includes at least three hash values; at least one third hash value that is associated and located at the upper level of the second hash value; the upper level is a level close to the root hash value in the fork tree; according to the first hash value and the fork
  • the structure of the tree obtain at least one fourth hash value, the at least one fourth hash value and the position of the at least one third hash value in the fork tree one-to-one correspondence; using the fourth hash value
  • the hash value replaces the third hash value corresponding to the position; the highest-level fourth hash value is
  • the technical means of compressing multiple files into a file package partially overcomes the technical problem that the network resource burden is too high due to the large number of files.
  • Improve the efficiency of file uploading and sharing (including updating) use multiple data structures to store hash values and share root hash values to obtain shared files, which improves the security of shared files.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种共享文件的方法、装置和***,主要涉及计算机技术领域。所述方法包括:获取待共享的文件,对形成的文件压缩包执行区块链上链操作;根据压缩包文件名及其哈希值计算生成根哈希值;根据根哈希值,获取区块链中的各个文件压缩包;通过采用将多个文件压缩成文件压缩包,部分克服了因为文件数量大造成的网络资源负担过高的技术问题,通过将各个文件压缩包并发上链,提高了文件上链和共享的效率;通过利用二叉树结构、多叉树结构、动态树结构等数据结构存储或更新文件,并分享根哈希值,以通过根哈希值以及各个节点哈希值获取共享文件,提高了文件的安全性。

Description

共享文件的方法、装置和***
本申请要求于2020年8月4日提交的题为“一种共享文件的方法、装置和***”的中国专利申请No.202010772432.X、于2020年8月4日提交的题为“一种共享文件的方法、装置和***”的中国专利申请No.202010772434.9、于2020年8月4日提交的题为“一种共享文件的方法、装置和***”的中国专利申请No.202010772425.X、以及于2020年8月4日提交的题为“一种更新共享文件的方法、装置和***”的中国专利申请No.202010773252.3的优先权,在此全文引用上述中国专利申请公开的内容以作为本申请的一部分。
技术领域
本公开涉及计算机技术领域,尤其涉及共享文件的方法、装置和***。
背景技术
在企业的业务流程中,往往需要共享业务所需要的文件,尤其是涉及到企业与企业之间的业务,随着区块链技术的发展,企业之间可以基于区块链共享文件,所采用的方法主要有:1.将所有的共享文件当作交易上链并进行广播实现共享,2.将文件保存在中心化数据库中,将文件的电子存证上链并进行广播实现共享。
在实现本公开过程中,发明人发现现有技术中至少存在如下问题:
利用方法1的方法,当文件的数量较大时,造成网络资源的使用率过高从而导致文件上链的效率减低;方法2,利用中心化的数据库保存文件,当文件为安全性较高的文件时,会存在一定的安全风险。
发明内容
有鉴于此,本公开第一实施例提供一种共享文件的方法和装置,能够获取待共享的文件,形成至少两个文件压缩包;对所述至少两个 文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;将所述当前哈希值作为根哈希值,并发送所述哈希值;所述各个层级的哈希值形成二叉树结构。根据所述根哈希值,获取两个当前哈希值,经过循环执行,直至获取到所述每一个当前哈希值所对应的文件压缩包;进而获取文件压缩包中的共享文件;因为采用将多个文件压缩成文件包的技术手段,部分克服了因为文件数量大造成的网络资源负担过高的技术问题,通过将各个文件压缩包并发上链,提高了文件上链和共享的效率;利用二叉树结构存储哈希值,分享根哈希值进而获取共享文件,提高了共享文件的安全性。
为实现上述目的,根据本公开第一实施例的第一方面,提供了一种共享文件的方法,其特征在于,包括:获取待共享的文件,形成至少两个文件压缩包;对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;将所述当前哈希值作为根哈希值,并发送所述哈希值。
为实现上述目的,根据本公开第一实施例的第二方面,提供了一种共享文件的方法,其特征在于,包括:接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是, 执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
为实现上述目的,根据本公开第一实施例的第三方面,提供了一种共享文件的装置,其特征在于,包括:文件压缩包上链模块、节点哈希值获取模块和根哈希值获取模块;其中,
所述文件压缩包上链模块,用于获取待共享的文件,形成至少两个文件压缩包;对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;
所述节点哈希值获取模块,用于将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;
所述根哈希值获取模块,用于将所述当前哈希值作为根哈希值,并发送所述哈希值。
为实现上述目的,根据本公开第一实施例的第四方面,还提供了一种共享文件的装置,其特征在于,包括:获取共享文件模块;其中,
所述获取共享文件模块,用于接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
为实现上述目的,根据本公开第一实施例的第五方面,提供了一 种共享文件的***900,包含上述第三方面提供的共享文件的装置700、以及上述第四方面提供的共享文件的装置800。
为实现上述目的,根据本公开第一实施例的第六方面,提供了一种共享文件的电子设备,其特征在于,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述共享文件的方法中任一所述的方法。
为实现上述目的,根据本公开第一实施例的第七方面,提供了一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如上述共享文件的方法中任一所述的方法。
上述公开中的第一实施例具有如下优点或有益效果:获取待共享的文件,形成至少两个文件压缩包;对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;将所述第二哈希值作为所述当前哈希值;将所述当前哈希值作为根哈希值,并发送所述哈希值;所述各个层级的哈希值形成二叉树结构。
根据所述根哈希值,获取两个当前哈希值,经过循环执行,直至获取到所述每一个当前哈希值所对应的文件压缩包;进而获取文件压缩包中的共享文件。因为采用将多个文件压缩成文件包的技术手段,部分克服了因为文件数量大造成的网络资源负担过高的技术问题,通过将各个文件压缩包同时上链,提高了文件上链和共享的效率;利用 二叉树结构存储哈希值,并分享根哈希值进而获取共享文件,提高了共享文件的安全性。
本公开第二实施例提供一种共享文件的方法和装置,能够获取待共享的文件,形成文件压缩包,对文件压缩包执行区块链上链操作并获取相应的第一哈希值,选择设定数量个第一哈希值上链并获取当前哈希值;经过循环直到获取根哈希值,各个层级当前哈希值以设定数量分叉树结构存储。基于根哈希值,遍历分叉树结构节点的哈希值,获取文件压缩包中的共享文件;通过采用将多个文件压缩成文件压缩包,部分克服了因为文件数量大造成的网络资源负担过高的技术问题,通过将各个文件压缩包并发上链,提高了文件上链和共享的效率;利用分叉树结构存储并分享根哈希值,通过根哈希值获取共享文件,提高文件的安全性。
为实现上述目的,根据本公开第二实施例的第一方面,提供了一种共享文件的方法,其特征在于,包括:获取待共享的文件,形成多个文件压缩包;对所述文件压缩包执行区块链上链操作,并从区块链获取所述文件压缩包对应的至少三个第一哈希值;将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数;将所述当前哈希值作为根哈希值,并发送所述哈希值。
为实现上述目的,根据本公开第二实施例的第二方面,提供了一 种共享文件的方法,其特征在于,包括:接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
为实现上述目的,根据本公开第二实施例的第三方面,提供了一种共享文件的装置,其特征在于,包括:文件压缩包上链模块、节点哈希值获取模块和根哈希值获取模块;其中,
所述文件压缩包上链模块,用于获取待共享的文件,形成多个文件压缩包;对所述文件压缩包执行区块链上链操作,并从区块链获取所述文件压缩包对应的至少三个第一哈希值;
所述上级哈希值获取模块,用于将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数;
所述根哈希值获取模块,用于将所述当前哈希值作为根哈希值,并发送所述哈希值。
为实现上述目的,根据本公开第二实施例的第四方面,还提供了一种共享文件的装置,其特征在于,包括:获取链上文件模块;其中,
所述获取链上文件模块,用于接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行 A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
为实现上述目的,根据本公开第二实施例的第五方面,提供了一种共享文件的***,包含上述第二实施例第三方面提供的共享文件的装置、以及上述第二实施例第四方面提供的共享文件的装置;
为实现上述目的,根据本公开第二实施例的第六方面,提供了一种共享文件的电子设备,其特征在于,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述共享文件的方法中任一所述的方法。
为实现上述目的,根据本公开第二实施例的第七方面,提供了一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如上述共享文件的方法中任一所述的方法。
上述公开中的第二实施例具有如下优点或有益效果:获取待共享的文件,形成文件压缩包,对文件压缩包执行区块链上链操作并获取相应的第一哈希值,选择设定数量个第一哈希值上链并获取当前哈希值;经过循环直到获取根哈希值,各个层级当前哈希值以设定数量分叉树结构存储。基于根哈希值,遍历分叉树结构节点的哈希值,获取文件压缩包中的共享文件;通过采用将多个文件压缩成文件压缩包,部分克服了因为文件数量大造成的网络资源负担过高的技术问题,通过将各个文件压缩包并发上链,提高了文件上链和共享的效率;利用分叉树结构存储并分享根哈希值,通过根哈希值获取共享文件,提高文件的安全性。
本公开第三实施例提供一种共享文件的方法和装置,获取待共享的文件,对设定周期内文件压缩包执行区块链上链操作并对文件压缩 包哈希值并进行动态分组,对每个分组的第一哈希值执行区块链上链操作并获取当前哈希值;循环直到获取根哈希值,各个层级哈希值形成动态可变叶子数量的分叉树结构。基于根哈希值,遍历分叉树结构中的哈希值,获取文件压缩包中的共享文件;通过采用将多个文件压缩成文件压缩包,部分克服了因为文件数量大造成的网络资源负担过高的技术问题,通过将各个文件压缩包并发上链,提高了文件上链和共享的效率;利用分叉树结构存储并分享根哈希值,通过根哈希值获取共享文件,提高文件的安全性。
为实现上述目的,根据本公开第三实施例的第一方面,提供了一种共享文件的方法,其特征在于,包括:获取设定周期内待共享的文件,形成多个文件压缩包;对所述多个文件压缩包进行分组,得到至少两组文件压缩包;对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值;对基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值;将所述第二哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数;将所述当前哈希值作为根哈希值,并发送所述当前哈希值。
为实现上述目的,根据本公开第三实施例的第二方面,提供了一种共享文件的方法,其特征在于,包括:接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所 述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
为实现上述目的,根据本公开第三实施例的第三方面,提供了一种共享文件的装置,其特征在于,包括:文件压缩包上链模块、当前哈希值获取模块和根哈希值获取模块;其中,
所述文件压缩包上链模块,用于获取设定周期内待共享的文件,形成多个文件压缩包;对所述多个文件压缩包进行分组,得到至少两组文件压缩包;对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值;
所述当前哈希值获取模块,用于基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值;将所述第二哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数;
所述根哈希值获取模块,用于将所述当前哈希值作为根哈希值,并发送所述当前哈希值。
为实现上述目的,根据本公开第三实施例的第四方面,还提供了一种共享文件的装置,其特征在于,包括:获取链上文件模块;其中,
所述获取链上文件模块,用于接收当前哈希值;循环执行以下步 骤,直至获取到所述当前哈希值所对应的文件压缩包;
确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;
A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;
A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
为实现上述目的,根据本公开第三实施例的第五方面,提供了一种共享文件的***,包含上述第三实施例第三方面提供的共享文件的装置、以及上述第三实施例第四方面提供的共享文件的装置;
为实现上述目的,根据本公开第三实施例的第六方面,提供了一种共享文件的电子设备,其特征在于,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述共享文件的方法中任一所述的方法。
为实现上述目的,根据本公开第三实施例的第七方面,提供了一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如上述共享文件的方法中任一所述的方法。
上述公开中的第三实施例具有如下优点或有益效果:获取待共享的文件,对设定周期内文件压缩包执行区块链上链操作并对从区块链获取的第一哈希值并进行分组,根据每个分组的第一哈希值执行区块链上链操作并获取当前哈希值;循环直到获取根哈希值,各个层级哈希值形成分叉树结构。基于根哈希值,遍历分叉树结构中的哈希值,获取文件压缩包中的共享文件;通过采用将多个文件压缩成文件压缩包,部分克服了因为文件数量大造成的网络资源负担过高的技术问题,通过将各个文件压缩包并发上链,提高了文件上链和共享的效率;利用分叉树结构存储并分享根哈希值,通过根哈希值获取共享文件,提高文件的安全性。
本公开第四实施例提供一种更新共享文件的方法和装置,能够通过局部替换存储于区块链上的呈现树状结构存储的共享文件,将替换后的文件压缩包上链并获取对应的新的哈希值;并针对新的哈希值与树状结构中相关联的哈希值经过循环操作,获取新的根哈希值;通过新的根哈希值,遍历所述树结构节点的哈希值,进而获取共享的更新文件;部分克服了更新少量文件而造成的区块链上相关节点以及文件存证重新上链的问题,节省了网络资源负担,提高更新共享文件的效率。
为实现上述目的,根据本公开第四实施例的第一方面,提供了一种更新共享文件的方法,其特征在于,包括:获取更新文件,根据所述更新文件的文件名查找待更新文件;根据所述更新文件,形成第一文件压缩包,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应的第一哈希值;利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;所述分叉树包括至少三个哈希值;根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值;将最高级的第四哈希值作为新的根哈希值,并发送所述新的根哈希值。
为实现上述目的,根据本公开第四实施例的第二方面,提供了一种更新共享文件的方法,其特征在于,包括:
接收根哈希值;确定所述根哈希值对应的子哈希值;循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;确定所述区块链上存在与所述子哈希值相同的文 件压缩包哈希值,如果是,执行A1;否则执行A2;
A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;
A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
为实现上述目的,根据本公开第四实施例的第三方面,提供了一种更新共享文件的装置,其特征在于,包括:文件更新模块、哈希值更新模块和根哈希值更新模块;其中,
所述文件更新模块,用于获取更新文件,根据所述更新文件的文件名查找待更新文件;根据所述更新文件,形成第一文件压缩包,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应的第一哈希值;
所述哈希值更新模块,用于利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;所述分叉树包括至少三个哈希值;根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值;
所述根哈希值更新模块,用于将最高级的第四哈希值作为新的根哈希值,并发送所述新的根哈希值。
为实现上述目的,根据本公开第四实施例的第四方面,还提供了一种更新共享文件的装置,其特征在于,包括:获取更新文件模块;其中,
所述获取更新文件模块,用于接收根哈希值;确定所述根哈希值对应的子哈希值;循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;确定所述区块链上 存在与所述子哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
为实现上述目的,根据本公开第四实施例的第五方面,提供了一种共享文件的***,包含上述第四实施例第三方面提供的更新共享文件的装置、以及上述第四实施例第四方面提供的更新共享文件的装置;
为实现上述目的,根据本公开第四实施例的第六方面,提供了一种更新共享文件的电子设备,其特征在于,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述更新共享文件的方法中任一所述的方法。
为实现上述目的,根据本公开第四实施例的第七方面,提供了一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如上述更新共享文件的方法中任一所述的方法。
上述公开中的第四实施例具有如下优点或有益效果:能够通过局部替换存储于区块链上的呈现树状结构存储的共享文件,将替换后的文件压缩包上链并获取对应的新的哈希值;并针对新的哈希值与树状结构中相关联的哈希值经过循环操作,获取新的根哈希值;通过新的根哈希值,遍历所述树结构节点的哈希值,进而获取共享的更新文件;部分克服了更新少量文件而造成的区块链上相关节点以及文件存证重新上链的问题,节省了网络资源负担,提高更新共享文件的效率。
上述的非惯用的可选方式所具有的进一步效果将在下文中结合具体实施方式加以说明。
附图说明
附图用于更好地理解本公开,不构成对本公开的不当限定。其中:
图1是本公开第一实施例提供的一种存储共享文件的方法的流程示意图;
图2是本公开第一实施例提供的一种获取共享文件的流程示意图;
图3是本公开第一实施例提供的一种利用二叉树结构存储共享文件哈希值示意图;
图4是本公开第一实施例提供的一种利用二叉树结构存储共享文件哈希值示意图;
图5是本公开第一实施例提供的一种获取共享文件的流程示意图;
图6是本公开第一实施例提供的一种共享文件的流程示意图;
图7是本公开第一实施例提供的一种共享文件的装置的结构示意图;
图8是本公开第一实施例提供的一种获取共享文件的装置的结构示意图;
图9是本公开第一实施例提供的一种获取共享文件的***的结构示意图;
图10是本公开第二实施例提供的一种存储共享文件的方法的流程示意图;
图11是本公开第二实施例提供的一种获取共享文件的流程示意图;
图12是本公开第二实施例提供的一种利用多叉树结构存储共享文件哈希值示意图;
图13是本公开第二实施例提供的一种获取共享文件的流程示意图;
图14是本公开第二实施例提供的一种共享文件的流程示意图;
图15是本公开第二实施例提供的一种利用多叉树结构存储共享文件哈希值示意图;
图16是本公开第二实施例提供的一种共享文件的装置的结构示意图;
图17是本公开第二实施例提供的一种获取共享文件的装置的结构示意图;
图18是本公开第二实施例提供的一种获取共享文件的***的结构 示意图;
图19是本公开第三实施例提供的一种存储共享文件的方法的流程示意图;
图20是本公开第三实施例提供的一种获取共享文件的流程示意图;
图21是本公开第三实施例提供的一种利用预定义时间范围和多叉树结构存储共享文件哈希值示意图;
图22是本公开第三实施例提供的一种获取共享文件的流程示意图;
图23是本公开第三实施例提供的一种共享文件的流程示意图;
图24是本公开第三实施例提供的一种共享文件的装置的结构示意图;
图25是本公开第三实施例提供的一种获取共享文件的装置的结构示意图;
图26是本公开第三实施例提供的一种获取共享文件的***的结构示意图;
图27是本公开第四实施例提供的一种更新文件的方法的流程示意图;
图28是本公开第四实施例提供的一种获取更新文件的流程示意图;
图29是本公开第四实施例提供的一种利用树结构存储共享文件哈希值示意图;
图30是本公开第四实施例提供的一种利用树结构存储更新文件哈希值示意图;
图31是本公开第四实施例提供的一种获取更新文件的流程示意图;
图32是本公开第四实施例一个实施例提供的一种获取更新共享文件的流程示意图;
图33是本公开第四实施例提供的一种更新共享文件的装置的结构示意图;
图34是本公开第四实施例提供的一种获取更新共享文件的装置的结构示意图;
图35是本公开第四实施例提供的一种获取更新共享文件的***的结构示意图;
图36是本公开实施例可以应用于其中的示例性***架构图;
图37是适于用来实现本公开实施例的终端设备或服务器的计算机***的结构示意图。
具体实施方式
以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本公开的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。
如图1所示,本公开第一实施例提供了一种存储共享文件的方法,该方法可以包括以下步骤:
步骤S101:获取待共享的文件,形成至少两个文件压缩包;对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值。
具体地,待共享的文件为某电子银行产生的交易文件、电子银行产生的对账单文件、电子商城产生的订单文件等;进一步地,获取待共享的文件,形成至少两个文件压缩包,包括:获取预定义时间范围内待共享的文件,形成至少两个文件包,根据网络带宽,确定所述文件包中文件的数量。具体地,可以根据一个时间范围内所接收的共享文件的数量,确定预定义时间范围,从而根据时间范围形成合理的文件接收数量,例如,一个小时之内某电子银行产生的交易文件、一个小时之内某两个电子银行产生的对账单文件、一天之内电子商城产生的订单文件等,所述预定义时间范围可以根据业务的场景和产生文件的数量来设定,例如,一天、一小时、一分钟等。
进一步地,获取待共享的文件,例如获取预定义时间范围内待共享的文件,形成至少两个文件包,具体地,根据网络带宽,确定每个 所述文件包中文件的数量,并分别形成至少两个文件压缩包;获取所述预定义时间范围内产生的文件的数量、结合网络的带宽等因素,对所述文件划分形成多个文件包,并分别对文件包进行压缩操作,分别形成文件压缩包;所述文件包中包含的文件数量根据文件的尺寸而设定,因此文件包中的数量是可变的,例如:不同电子银行之间的对账单文件等通过获取网络的带宽确定每个文件包中包含文件的数量,进一步地,进行对文件包进行压缩形成多个文件压缩包,压缩的方法可以使用压缩工具,例如:gzip、winRAR等,本公开对压缩所使用的具体方法不做限定。
进一步地,分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。其中,形成至少两个文件压缩包还包括在执行压缩操作以及加密操作,通过加密提高了文件的安全性,尤其是提高了对安全性要求高的例如电子银行之间的对账单等文件的安全性,加密的方法可以使用压缩软件进行加密,也可使用操作***或加密软件进行加密,本公开对压缩、加密的具体方法不做限定。
再进一步地,对各个文件压缩包执行区块链并发上链操作,因为各个文件压缩包之间不具有依赖交易关系,执行文件压缩包的并发上链操作;即,对所述文件压缩包执行区块链并发上链操作。可以理解的是,由于存在网络的带宽等资源的限制,多个文件压缩包的上链操作可以是分批进行的,每一批内文件压缩包执行并发上链,通过同时上链的操作,提高了文件上链的效率;进一步地,对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;其中,可以将文件压缩包作为交易执行区块链上链操作,并从区块链获取针对该交易返回的哈希值,该哈希值即为所述文件压缩包的第一哈希值,也即文件压缩包对应的第一哈希值,即,并从区块链获取所述文件压缩包对应的第一哈希值;进一步地,所使用的区块链可以是联盟链、私有链等,本公开对区块链的类型不做限定。本公开对执行区块链上链所使用的具体工具或者 方法不做限定。
步骤S102:将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值;对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值。
具体地,根据步骤S101所形成的各个文件压缩包对应的第一哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作;具体地,基于选择出的一对当前哈希值生成中间哈希值可以将两个(一对)当前哈希值进行组合生成中间哈希值,也可以通过两个(一对)当前哈希值的计算生成中间哈希值,本公开对基于一对当前哈希值生成中间哈希值的具体方法不做限定。即,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作;并从区块链获取对应的第二哈希值,其中,可以将中间哈希值作为交易执行上链操作,并从区块链获取针对该交易返回的哈希值,该哈希值即为所述的第二哈希值;经过循环,进行各层级的第二哈希值(即当前哈希值)的类似操作直到获取根哈希值。
在循环过程中,将所述第一哈希值、第二哈希值作为当前哈希值;可以理解的是,根据上述描述,经过循环获取每个层级的哈希值,直到获取唯一的根哈希值(即,直至所述当前哈希值的数量为1),所述第一哈希值、各个层级的第二哈希值形成一个二叉树的哈希值存储结构。通过上述方法,提高了获取文件的复杂度,从而提高了文件的安全性。
获取根哈希值可以采用两种方法:第一种方法的描述与图3中所示的示例的步骤S301-步骤S303一致;第二种方法与图4中所示的示 例的步骤S401-步骤S404的描述一致,在此不再赘述。
步骤S103:将所述当前哈希值作为根哈希值,并发送所述哈希值。
具体地,根据步骤S102描述的二叉树的存储结构,经过循环,获取根哈希值,发送所述根哈希值。
进一步地,发送所述根哈希值有两种方法:1)通过区块链发送所述根哈希值给有获取共享文件权限的获取方;2)通过其他方式发送所述根哈希值给有获取共享文件权限的获取方,例如:官方电子邮件等。可以理解的是,将所述根哈希值发送给有获取共享文件权限的获取方,所述有权限的获取方可以是一方或者多方;例如:所述文件为银行A和银行B在预定义时间范围内产生的对账单;在步骤S101-步骤S103之后产生了根哈希值,则将所述根哈希值发送给对这些对账单文件有获取权限的银行A和银行B;显而易见地是,利用该操作进一步提高了文件的安全性。
如图2所示,本公开第一实施例提供了一种获取共享文件的方法,该方法可以包括以下步骤:
步骤S201:接收当前哈希值;循环执行以下步骤,直至获取到所当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
具体地,根据所述根哈希值,循环执行从区块链上获取各个所述文件压缩包哈希值对应的文件压缩包中文件的方法的描述与步骤S501-步骤S503所描述的示例一致,在此不再赘述。
如图3所示,本公开第一实施例提供了一种利用二叉树结构存储共享文件以及哈希值的方法,该方法可以包括以下步骤:
步骤S301:获取各个文件压缩包对应的第一哈希值;
关于生成文件压缩包以及获取对应的第一哈希值的描述与步骤S101一致,在此不再赘述;如图3所示,将文件压缩包1-文件压缩包4执行区块链上链操作,分别获取对应的第一哈希值1-第一哈希值4。
步骤S302:成对选择第一哈希值,对选择出的一对所述当前哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值,将所述第二哈希值作为所述当前哈希值;将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值。
具体地,步骤S302描述了通过循环获取各个层级的第二哈希值(并将第二哈希值作为当前哈希值)的过程如图3所示,示例中利用3个层级描述不同层级的哈希值,分别为层级1、层级2、层级3。在循环执行之前,首先将所述至少两个第一哈希值作为当前哈希值,然后基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;如图3所示,基于文件压缩包1的第一哈希值1(当前哈希值)和文件压缩包2的第一哈希值2(当前哈希值)生成中间哈希值,对所述中间哈希值执行区块链上链操作,从区块链获取对应的第二哈希值(例如第二哈希值1);基于文件压缩包3的第一哈希值3和文件压缩包4的第一哈希值4生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值(例如第二哈希值2);并将所述第二哈希值分别作为所述当前哈希值;其中,可以将中间哈希值作为交易执行上链操作,并得到针对该交易返回的哈希值作为第二哈希值。即, 基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值。
进一步地,判断当前哈希值的数量是否为1,由上述示例可知,当前哈希值(第二哈希值)的数量不为1,则执行步骤S302;基于层级2的第二哈希值1(当前哈希值)和第二哈希值2(当前哈希值)生成中间哈希值;对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值,即获取层级3的第二哈希值(当前哈希值)。再次判断当前哈希值的数量是否为1,可知当前哈希值的数量为1,则将所述当前哈希值作为根哈希值。
可以理解的是,基于二叉树结构的每个层级的当前哈希值的数量可以是奇数,也可以是偶数;当所述当前哈希值的数量是偶数时,从所述至少两个当前哈希值中,成对选择当前哈希值,对选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;在各个所述当前哈希值均被选择过的情况下,将所述第二哈希值作为所述当前哈希值。
具体地,如图3所示的示例,层级1包含的当前哈希值(第一哈希值)为偶数(4个),例如,基于第一哈希值1和第一哈希值2生成中间哈希值,对所述中间哈希值执行区块链上链操作并获取第二哈希值1;基于第一哈希值3和第一哈希值4生成中间哈希值,对所述中间哈希值执行区块链上链操作并获取第二哈希值2;其中,第一哈希值1和第一哈希值2为成对选择;第一哈希值3和第一哈希值4也为成对选择;其中,第一哈希值1、第一哈希值2、第一哈希值3和第一哈希值4作为当前哈希值;由此可见,在各个所述当前哈希值(第一哈希值1、第一哈希值2、第一哈希值3和第一哈希值4均被选择)均被选择过的情况下,将所述第二哈希值(第二哈希值1、第二哈希值2)作为所述当前哈希值;基于当前哈希值获取到的层级2的第二哈希值的 数量为偶数(2个),即,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值,在各个所述当前哈希值均被选择过的情况下,将所述第二哈希值作为所述当前哈希值。
当所述当前哈希值的数量是非1的奇数时的描述与步骤S401-步骤S404一致,在此不再赘述。
步骤S303:获取根哈希值,发送所述根哈希值。
具体地,当所述当前哈希值的数量为1时,将所述当前哈希值作为根哈希值,并发送所述哈希值。发送所述根哈希值的具体描述与步骤S103一致,在此不再赘述。可以理解的是,二叉树的层级由文件压缩包哈希值的数量的确定;而文件压缩包哈希值的数量根据产生的业务相关的文件数量相关,本公开对文件压缩包哈希值的数量不做限定。
如图4所示,本公开第一实施例提供了一种利用二叉树结构存储共享文件以及哈希值的方法,该方法可以包括以下步骤:
步骤S401:获取各个文件压缩包对应的第一哈希值。
关于生成文件压缩包以及获取对应的第一哈希值的描述与步骤S101一致,在此不再赘述;如图4所示,分别将文件压缩包1-文件压缩包5执行区块链上链操作并获取对应的第一哈希值1-第一哈希值5。
步骤S402:成对选择第一哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值,将所述第二哈希值作为所述当前哈希值。
步骤S403:判断当前哈希值的数量不为1,则执行步骤S402。
具体地,步骤S402-步骤S403描述了通过循环获取各层的第二哈希值(当前哈希值)的过程如图4所示;在循环执行之前,首先将所述至少两个第一哈希值作为当前哈希值,然后成对选择所述当前哈希值(第一哈希值),基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;进一步地,基于二叉树结构的每个层级的当前哈希值的数量可以是奇数,也可以是偶数;当所述当前哈希值的数量是非1的奇数时,从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;在未被选择的所述当前哈希值数量为1的情况下,将所述第二哈希值和所述未被选择的1个所述当前哈希值作为所述当前哈希值。
如图4所示,对选择出的一对所述当前哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值,例如:将文件压缩包1的第一哈希值1(当前哈希值)和文件压缩包2的第一哈希值2(当前哈希值)生成中间哈希值,对所述中间哈希值执行区块链上链操作并获取对应的第二哈希值,即,获取第二哈希值1;再例如:基于文件压缩包3的第一哈希值3和文件压缩包4的第一哈希值4基生成中间哈希值,对所述中间哈希值执行区块链上链操作并从区块链获取对应的第二哈希值,例如获取第二哈希值2;第一哈希值5(当前哈希值)为在未被选择的所述当前哈希值;并且是未被选择的所述当前哈希值数量为1的情况,则将所述第二哈希值和所述未被选择的1个所述当前哈希值作为所述当前哈希值,即,将第二哈希值1、第二哈希值2、第一哈希值5作为当前哈希值。
进一步地,判断当前哈希值的数量是否为1,由上述示例可知,当前哈希值(第二哈希值)的数量不为1(为3),则执行步骤S402;进一步地,基于选择出的一对所述当前哈希值生成中间哈希值,对所述 中间哈希值执行区块链上链操作并从区块链获取对应的第二哈希值,例如:基于第二哈希值1(当前哈希值)和第一哈希值5(当前哈希值)生成中间哈希值,对所述中间哈希值执行区块链上链操作并从区块链获取对应的第二哈希值,例如获取第二哈希值2(当前哈希值);进一步地,由图4可知,第二哈希值1(当前哈希值)为在未被选择的所述当前哈希值;并且是未被选择的所述当前哈希值数量为1的情况,则将所述第二哈希值(第二哈希值2)和所述未被选择的1个所述当前哈希值(第二哈希值1)作为所述当前哈希值;循环地,再次判断当前哈希值的数量是否为1,可知当前哈希值的数量为1,则将所述当前哈希值作为根哈希值。
即,将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值。
步骤S404:发送所述根哈希值。
具体地,当前哈希值的数量为1时,将所述当前哈希值作为根哈希值,并发送所述哈希值。发送所述根哈希值的具体描述与步骤S103一致,在此不再赘述。可以理解的是,二叉树的层级由文件压缩包哈希值的数量的确定;而文件压缩包哈希值的数量根据产生的业务相关的文件数量相关,本公开对文件压缩包哈希值的数量不做限定。
如图5所示,本公开第一实施例提供了一种基于二叉树结构的哈希值获取共享文件的方法,该方法可以包括以下步骤:
步骤S501:接收当前哈希值。
具体地,当前哈希值即为根哈希值。
步骤S502-步骤S503:获取文件压缩包。
具体地,循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
如图5所示示例,获取当前哈希值(根哈希值),确定所述区块链上存在与所述当前哈希值(根哈希值)相同的文件压缩包哈希值,可知不存在与所述当前哈希值(根哈希值)相同的文件压缩包哈希值,则执行A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值,即,确定当前哈希值(根哈希值)对应的两个下级哈希值,分别为下级哈希值1和下级哈希值2;并将所述下级哈希值(下级哈希值1和下级哈希值2)作为所述当前哈希值。
循环判断确定所述区块链上存在与所述当前哈希值(下级哈希值1和下级哈希值2)相同的文件压缩包哈希值;如图5所示,对于下级哈希值1、下级哈希值2不存在与所述当前哈希值(下级哈希值1和下级哈希值2)相同的文件压缩包哈希值,则执行A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值;确定当前哈希值(层级2:下级哈希值1)对应的两个下级哈希值分别为下级哈希值1和下级哈希值2;循环判断确定所述区块链上存在与所述当前哈希值(层级1:下级哈希值1和下级哈希值2)相同的文件压缩包哈希值;则执行A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;即,分别获取下级哈希值1(层级1)对应的文件压缩包1;以此类推,获取某一个或者每一个文件压缩包。
再进一步地,对每个获取到的文件压缩包,执行解压和解密操作, 解压和解密的方法与压缩和加密的方法相互呼应;即,获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
可以理解的是,二叉树的层级由文件压缩包哈希值的数量的确定;而文件压缩包哈希值的数量根据产生的业务相关的文件数量相关,本公开对文件压缩包哈希值的数量不做限定。
如图6所示,本公开第一实施例提供了一种共享文件的流程,该流程包括以下步骤:
如图6所示的示意流程,利用步骤S601-步骤S603描述共享文件上链的过程;利用步骤S604描述共享文件获取方获取共享文件的过程;例如,执行共享文件上链的可以是银行总部,共享文件获取方可以是在业务上与共享文件直接相关的企业,例如:银行1、银行2、银行3等。
步骤S601:获取待共享的文件,形成至少两个文件压缩包;对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值。
具体地,关于文件压缩包的形成以及上链的描述与步骤S101一致,在此不再赘述;进一步地,获取待共享的文件,形成至少两个文件压缩包,包括:获取预定义时间范围内待共享的文件,形成至少两个文件包,根据网络带宽,确定所述文件包中文件的数量。分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。对所述文件压缩包执行区块链并发上链操作。
步骤S602:将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈 希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值。
具体地,关于经过循环获取根哈希值的描述与步骤S102一致,在此不再赘述。
步骤S603:将所述当前哈希值作为根哈希值,并发送所述哈希值。
具体地,关于发送根哈希值的描述与步骤S103一致,在此不再赘述。
步骤S604:接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
具体地,关于根据根哈希值,获取所述根哈希值对应的两个下级哈希值的描述与步骤S201一致,在此不再赘述;进一步地,获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
如图7所示,本公开第一实施例提供了一种共享文件的装置700,包括:包括:文件压缩包上链模块701、节点哈希值获取模块702和根哈希值获取模块703;其中,
所述文件压缩包上链模块701,用于获取待共享的文件,形成至少两个文件压缩包;对所述至少两个文件压缩包执行区块链上链操作, 并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;
所述节点哈希值获取模块702,用于将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;
所述根哈希值获取模块703,用于将所述当前哈希值作为根哈希值,并发送所述哈希值。
可选地,所述节点哈希值获取模块702,还包括当所述当前哈希值的数量是偶数时,从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;在各个所述当前哈希值均被选择过的情况下,将所述第二哈希值作为所述当前哈希值。
可选地,所述节点哈希值获取模块702,还包括当所述当前哈希值的数量是非1的奇数时,从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值值;在未被选择的所述当前哈希值为1的情况下,将所述第二哈希值和所述未被选择的1个所述当前哈希值作为所述当前哈希值。
可选地,所述文件压缩包上链模块701,还用于获取待共享的文件,形成至少两个文件压缩包,包括:获取预定义时间范围内待共享的文件,形成至少两个文件包,根据网络带宽,确定所述文件包中文件的数量。
可选地,所述文件压缩包上链模块701,还用于分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。
可选地,所述文件压缩包上链模块701,还用于对所述文件压缩包执行区块链并发上链操作。
如图8所示,本公开第一实施例提供了一种共享文件的装置800,包括:获取共享文件模块801;其中,
所述获取共享文件模块801,用于接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
可选地,所述获取共享文件模块801,还用于获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
本公开第一实施例还提供了一种共享文件的电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述任一实施例提供的方法。
本公开第一实施例还提供了一种计算机可读介质,其上存储有计算机程序,所述程序被处理器执行时实现上述任一实施例提供的方法。
如图9所示,本公开第一实施例提供了一种共享文件的***900,包括:本公开第一实施例提供的一种共享文件的装置700和本公开第 一实施例提供的一种共享文件的装置800。
如图10所示,本公开第二实施例提供了一种存储共享文件的方法,该方法可以包括以下步骤:
步骤S1001:获取待共享的文件,形成多个文件压缩包;对所述文件压缩包执行区块链上链操作,并从区块链获取所述文件压缩包对应的至少三个第一哈希值。
具体地,待共享的文件可以为某电子银行产生的交易文件、电子银行产生的对账单文件、电子商城产生的订单文件等;本公开对带共享的文件的格式和内容不做限定;进一步地,获取待共享的文件,形成多个文件压缩包,包括:获取预定义时间范围内待共享的文件,形成至少三个文件包,根据网络带宽,确定所述文件包中文件的数量。
具体地,本公开的实施例为基于多个文件压缩包对应的哈希值,经过循环通过各层级哈希值上链并获取下一级的哈希值,从而形成多叉树状的哈希值结构,所述多叉树的分叉数量至少为3,即,所述设定数量为大于2的整数;也即,并从区块链获取所述文件压缩包对应的至少三个第一哈希值;可以理解的是,文件压缩包的数量可以是根据一个时间范围内所接收的共享文件的数量,即,获取预定义时间范围内产生的待共享的文件,例如,一个小时之内某电子银行产生的交易文件、一个小时之内某两个电子银行产生的对账单文件、一天之内电子商城产生的订单文件等,所述预定义时间范围可以根据业务的场景和产生文件的数量来设定,例如,一天、一小时、一分钟等;本公开对预定义时间范围的具体内容不做限定。
进一步地,获取待共享的文件,例如,获取预定义时间范围内待共享的文件,形成至少三个个文件包,可以根据网络带宽,确定每个所述文件包中文件的数量,并分别形成至少三个文件压缩包;获取所述预定义时间范围内产生的文件的数量、结合网络的带宽等因素,对 所述文件划分形成多个文件包,并分别对文件包进行压缩操作,分别形成文件压缩包;所述文件包中包含的文件数量根据文件的尺寸而设定,因此文件包中的数量是可变的,根据一个时间范围内的总量,通过获取网络的带宽确定每个文件包中包含文件的数量,进一步地,进行对文件包进行压缩形成多个文件压缩包;
分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。其中,形成至少三个文件压缩包,还包括在执行压缩操作以及加密操作,通过加密提高了文件的安全性,尤其是提高了对安全性要求高的例如电子银行之间的对账单等文件的安全性,加密的方法可以使用压缩软件进行加密,例如gzip、WinRAR等;加密的方法可以使用压缩软件进行加密,也可使用操作***或加密软件进行加密,本公开对压缩使用的具体方法、加密的具体方法不做限定。
再进一步地,对各个文件压缩包执行区块链并发上链操作,因为各个文件压缩包之间不具有依赖交易关系,执行文件压缩包的并发上链操作;即,对所述文件压缩包执行区块链并发上链操作。可以理解的是,由于存在网络的带宽等资源的限制,多个文件压缩包的上链操作可以是分批进行的,每一批内文件压缩包执行并发上链,通过同时上链的操作,提高了文件上链的效率;进一步地,对所述至少三个文件压缩包执行区块链上链操作,并获取所述至少三个文件压缩包分别对应的至少三个第一哈希值;其中,可以分别将文件压缩包作为交易执行区块链上链操作,并分别从区块链获取针对该交易返回的哈希值,该哈希值即为所述文件压缩包对应的第一哈希值;其中,所使用的区块链可以是联盟链、私有链等,本公开对区块链的类型不做限定。本公开对执行区块链上链所使用的具体工具或者方法不做限定。
步骤S1002:将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区 块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数。
具体地,根据步骤S1001所形成的各个文件压缩包对应的第一哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;具体地,基于选择出的设定数量个当前哈希值生成中间哈希值可以将设定数量个当前哈希值进行组合生成中间哈希值,也可以通过计算设定数量个当前哈希值生成中间哈希值,本公开对基于设定数量个当前哈希值生成中间哈希值的具体方法不做限定。进一步地,可以将中间哈希值作为交易执行区块链上链操作,并分别从区块链获取针对该交易返回的第二哈希值;循环该步骤,获取各个层级的第二哈希值。其中,设定数量为大于2的整数,例如,3、4、10、100、1000,设定数量用于设定多叉树结构的分叉数量,设定数量可以根据业务的场景或者文件压缩包的数量而确定本公开对设定数量的具体数值不做限定。
在循环过程中,将所述第一哈希值、第二哈希值作为当前哈希值;可以理解的是,根据上述描述,经过循环获取各个层级的哈希值,直到获取唯一的根哈希值(即,直至所述当前哈希值的数量为1),分别对所述第一哈希值、第二哈希值(当前哈希值)执行区块链上链,形成一个多叉树(设定数量分叉树)的哈希值存储结构。通过上述方法,提高了获取文件的复杂度,从而提高了文件的安全性。
下面举例说明,例如:文件压缩包哈希值的数量为99,对应形成99个第一哈希值;设定数量为5;则将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:即,将99个第一哈希值作为当前哈希值循环执行以下操作:从99个哈希值中, 分别选择设定数量个(例如:5个)当前哈希值,并基于选择出的设定数量个(例如:5)当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作执行区块链上链操作,并从区块链获取对应的第二哈希值;可以理解的是,将99个第一哈希值,分别选择5个当前哈希值,并根据选择的5个哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值,通过上述操作,可知获取到19个第二哈希值;进一步地,基于99个第一哈希值中的95(19*5)个对哈希值获取到19个第二哈希值,可以理解的是,因为设定数量为5,还有4个未被选择,且未被选择过的所述当前哈希值的数量小于所述设定数量(例如:5个)时,则基于这4个第一哈希值生成中间哈希值,对中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;即,当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值。
基于上述示例步骤可知,99个第一哈希值获取到20个第二哈希值,进一步地,将这20个第二哈希值作为当前哈希值,循环执行上述步骤,进一步地,类似地可知,20个当前哈希值中,分别选择5个(设定数量)生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的下一层级的第二哈希值,获取到4个第二哈希值(当前哈希值);再进一步地,获取到1个第二哈希值,即,直至所述当前哈希值的数量为1;循环执行的操作停止。即,将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对 应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数。
可以理解的是,根据上述描述,经过循环操作获取哈希值的操作,直到获取唯一的根哈希值,形成一个多叉树的哈希值存储结构。通过上述方法,提高了获取文件的复杂度,从而提高了文件的安全性。获取根哈希值方法的进一步描述与图22中所示的示例的步骤S1201-步骤S1203一致;在此不再赘述。
步骤S1003:将所述当前哈希值作为根哈希值,并发送所述哈希值。
具体地,根据步骤S1002描述的多叉树(即设定数量分叉树)的存储结构,经过循环,获取根哈希值并发送所述根哈希值;进一步地,下面以图15的示意图说明上述步骤,如图15所示,若设定数量为N;且每一个圆圈中的数字代表各个层级的当前哈希值的标识,假设在获取到根哈希值之前,每个层级的当前哈希值数量均不小于设定数量,分别选择设定数量N个当前哈希值,并根据选择出的设定数量个所述当前哈希值,分别生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的多个第二哈希值;循环执行上述操作,经过M个层级以后,当前哈希值的数量为1,即获取根哈希值;进一步地,发送所述根哈希值有两种方法:1)通过区块链发送所述根哈希值给有获取共享文件权限的获取方;2)通过其他方式发送所述根哈希值给有获取共享文件权限的获取方,例如:官方电子邮件等;可以理解的是,将所述根哈希值发送给有获取共享文件权限的获取方,所述有权限的获取方可以是一方或者多方;例如:所述文件为银行A和银行B在预定义时间范围内产生的对账单;在步骤S1001-步骤S1003之后产生了根哈希值,则将所述根哈希值发送给对这些对账单文件有获取权限的银行A和银行B;显而易见地是,利用该操作进一步提高了文件的安全性。
如图11所示,本公开第二实施例提供了一种获取共享文件的方法, 该方法可以包括以下步骤:
步骤S1101:接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
具体地,根据所述根哈希值,从区块链上获取所述文件压缩包哈希值对应的文件压缩包中文件的方法的描述与步骤S1301-步骤S1303所描述的示例一致,在此不再赘述。
如图12所示,本公开第三实施例提供了一种利用多叉树结构存储共享文件以及哈希值的方法,该方法可以包括以下步骤:
步骤S1201:获取各个文件压缩包对应的第一哈希值。
具体地,关于生成文件压缩包以及获取对应的第一哈希值的描述与步骤S1001一致,在此不再赘述。如图22所示的示例中,包含10个文件压缩包,可以理解的是,文件压缩包的数量可以是数十、数百、数万、数十万、数百万、数千万等;为了具体说明步骤S1201-步骤S1203,本示例采用设定数量为4作为示例,即为4叉树结构;根据文件压缩包1-10,分别获取到第一哈希值1-10。
步骤S1202-步骤S1203:获取第二哈希值。
具体地,步骤S1202-步骤S1203的示例描述了循环执行的获取第二哈希值(当前哈希值)的操作;具体地,为了说明,如图12所示,利用3个示例层级描述第二哈希值,分别为层级1、层级2、层级3;如图3所示,示例中包含10个第一哈希值;设定数量为4,则将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希 值的数量为1;从10个第一哈希值中,分别选择4个第一哈希值,并基于这4个第一哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;例如,基于第一哈希值1-4,获取到第二哈希值1,基于第一哈希值5-8,获取到第二哈希值2;第一哈希值9、第一哈希值10(10个里面减掉2组,每组4个,余数为2)为未被选择过的所述当前哈希值,且未被选择过的所述当前哈希值的数量小于所述设定数量时,2<4,则基于这2个第一哈希值(第一哈希值9、第一哈希值10)获取对应的第二哈希值3;即,将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数。
步骤S1203:获取根哈希值。
具体地,根据步骤S1202的步骤可知示例,层级2中包含3个第二哈希值,将所述第二哈希值作为所述当前哈希值;进一步执行步骤S1202的操作,获取层级3的第二哈希值;因为该第二哈希值(当前哈希值)的数量为1,将所述当前哈希值作为根哈希值;可以理解的是,设定数量多叉树的层级由文件压缩包哈希值(第一哈希值)的数量的确定;而文件压缩包哈希值的数量根据产生的业务相关的文件数量相关,本公开对设定数量、文件压缩包哈希值(第一哈希值)的数量不做限定。
如图13所示,本公开第二实施例提供了一种基于多叉树结构的哈 希值获取共享文件的方法,该方法可以包括以下步骤:
以下步骤S1301-步骤S1303以步骤S1201-步骤S1203所描述的示例为例说明基于多叉树结构的哈希值获取共享文件的方法;
步骤S1301:根据当前哈希值(根哈希值)。
具体地,接收当前哈希值;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值;如图13所示,确定所述区块链上不存在与所述当前哈希值相同的文件压缩包哈希值,即所述当前哈希值不是文件压缩包的哈希值,则确定所述当前哈希值对应的设定数量个下级哈希值,并将所述下级哈希值作为所述当前哈希值;当前哈希值的下级哈希值分别为下级哈希值1、下级哈希值2、下级哈希值3;并将所述下级哈希值作为所述当前哈希值。
步骤S1302-步骤S1303:循环执行获取下级哈希值。
下面通过步骤S1302-步骤S1303描述根哈希值以下的各层哈希值遍历并获取文件压缩包过程的示例;具体地,如图13所示,接收当前哈希值(下级哈希值1、下级哈希值2、下级哈希值3);确定所述区块链上不存在与所述当前哈希值(下级哈希值1、下级哈希值2、下级哈希值3)相同的文件压缩包哈希值;则确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值,例如:确定下级哈希值1对应的各个子哈希值为下级哈希值1-下级哈希值4;确定下级哈希值2对应的各个子哈希值为下级哈希值5-下级哈希值8;确定下级哈希值3对应的各个子哈希值为下级哈希值9、下级哈希值10;进一步地,确定所述区块链上存在与所述当前哈希值(下级哈希值1-下级哈希值10)相同的文件压缩包哈希值;则从所述区块链上获取所述当前哈希值所对应的文件压缩包;分别为文件压缩包1-文件压缩包10。即,接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1: 从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
进一步地,获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件;具体地对每个获取到的文件压缩包,执行解压和解密操作,解压和解密的方法与压缩和加密的方法相互对应。
可以理解的是,设置数量个分叉树的层级由文件压缩包哈希值的数量、设置数量确定;而文件压缩包哈希值的数量根据产生的业务相关的文件数量相关,本公开对设置数量、文件压缩包哈希值的数量不做限定。
如图14所示,本公开第二实施例提供了一种共享文件的流程,该流程包括以下步骤:
如图14所示的示意流程,利用步骤S1401-步骤S1403描述共享文件上链的过程;利用步骤S1404-步骤S1405描述共享文件获取方获取共享文件的过程;例如,执行共享文件上链的可以是银行总部,共享文件获取方可以是在业务上与共享文件直接相关的企业,例如:银行1、银行2、银行3等。
步骤S1401:获取待共享的文件,形成多个文件压缩包。
对所述文件压缩包执行区块链上链操作,并从区块链获取所述文件压缩包对应的至少三个第一哈希值描述与步骤S1001一致,在此不再赘述。进一步地,获取待共享的文件,形成多个文件压缩包,包括:获取预定义时间范围内待共享的文件,形成至少三个文件包,根据网络带宽,确定所述文件包中文件的数量。进一步地,分别对所述文件 包执行压缩和加密操作,形成所述文件压缩包。对所述文件压缩包执行区块链并发上链操作。
步骤S1402:将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数。
具体地,关于经过循环获取根哈希值的描述与步骤S1002一致,在此不再赘述。
步骤S1403:将所述当前哈希值作为根哈希值,并发送所述哈希值。
具体地,关于发送根哈希值的描述与步骤S1003一致,在此不再赘述。
步骤S1404:接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
具体地,关于根据根哈希值,获取所述根哈希值对应的各个下级哈希值的描述与步骤S1101一致,在此不再赘述;进一步地,获取到 所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
如图16所示,本公开第二实施例提供了一种共享文件的装置1600,包括:文件压缩包上链模块1601、节点哈希值获取模块2602和根哈希值获取模块1603;其中,
所述文件压缩包上链模块1601,用于获取待共享的文件,形成多个文件压缩包;对所述文件压缩包执行区块链上链操作,并从区块链获取所述文件压缩包对应的至少三个第一哈希值;
所述上级哈希值获取模块1602,用于将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数;
所述根哈希值获取模块1603,用于将所述当前哈希值作为根哈希值,并发送所述哈希值。
如图17所示,本公开第二实施例提供了一种共享文件的装置1700,包括:获取链上文件模块1701;其中,
所述获取链上文件模块1701,用于接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值, 并将所述下级哈希值作为所述当前哈希值。
如图18所示,本公开第二实施例提供的一种共享文件的***1800,包括:本公开第二实施例提供的共享文件的装置1600以及本公开第二实施例提供的共享文件的装置1700。
本公开第二实施例还提供了一种共享文件的电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述任一实施例提供的方法。
本公开第二实施例还提供了一种计算机可读介质,其上存储有计算机程序,所述程序被处理器执行时实现上述任一实施例提供的方法。
如图19所示,本公开第三实施例提供了一种存储共享文件的方法,该方法可以包括以下步骤:
步骤S1901:获取设定周期内待共享的文件,形成多个文件压缩包;对所述多个文件压缩包进行分组,得到至少两组文件压缩包;对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值。
具体地,待共享的文件可以为某电子银行产生的交易文件、电子银行产生的对账单文件、电子商城产生的订单文件等;本公开对带共享的文件的格式和内容不做限定;获取设定周期内待共享的文件,所述待共享文件为在设定周期内产生的,例如,一个小时之内某电子银行产生的交易文件、一个小时之内某两个电子银行产生的对账单文件、一天之内电子商城产生的订单文件等,所述设定周期可以根据业务的场景和产生文件的数量来设定,例如,一天、一小时、30分钟等;本公开对设定周期的具体内容不做限定。
进一步地,获取设定周期内待共享的文件,形成多个文件压缩包,包括:获取设定周期内待共享的文件,形成多个文件包,根据网络带宽,确定所述文件包中文件的数量。进一步地,获取预定义时间范围内待共享的文件,根据所述文件的数量和尺寸,形成多个文件压缩包,还包括在执行压缩操作以及加密操作,通过加密提高了文件的安全性,尤其是提高了对安全性要求高的例如电子银行之间的对账单等文件的安全性;即,分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。加密的方法可以使用压缩软件进行加密,也可使用操作***或加密软件进行加密,本公开对压缩、加密的具体方法不做限定。
再进一步地,对所述多个文件压缩包进行分组,得到至少两组文件压缩包;具体地,分组有两种方法:
第一种方法:将设定分段周期内形成的多个所述文件压缩包作为一组文件压缩包,得到至少两组文件压缩包,所述设定周期包含至少两个设定分段周期。具体地,设定周期包含至少两个所述设定分段周期,例如,设定分段周期为5分钟,设定周期为30分钟,可知设定周期包含了6个设定分段周期;进一步地,将一个5分钟内形成的多个所述文件压缩包作为一组文件压缩包;将另一个5分钟内形成的多个所述文件压缩包作为另一组文件压缩包;可以理解的是,各个设定分段周期之间有时间上的先后顺序;即,将至少两个设定分段周期内分别形成的多个所述文件压缩包作为一组文件压缩包,得到至少两组文件压缩包。所述设定周期包含至少两个设定分段周期;可以理解的是,该方法为动态形成文件压缩包;因此每一组文件压缩包的数量为可变的,增加了文件共享的灵活性。
第二种方法:根据设定文件数量对所述多个文件压缩包进行分组,得到至少两组文件压缩包。具体地,设定文件数量为根据待共享文件的总量和场景来定义的,例如,设定文件数量为1000个,则每1000个文件压缩包形成一组,例如,设定周期为30分钟,在30分钟内形成了10000个文件压缩包,根据设定文件数量1000,则分成10组文件 压缩包;即,根据设定文件数量对所述多个文件压缩包进行分组,得到至少两组文件压缩包。
进一步地,对每一组所述文件压缩包执行区块链上链操作,其中,可以分别将文件压缩包作为交易执行区块链上链操作,并分别从区块链获取针对该交易返回的哈希值,该哈希值即为所述文件压缩包对应的第一哈希值;例如,利用上述分组的第一种方法或者第二种方法,一共分成了10组文件压缩包,则对每一组内的各个文件压缩包分别执行区块链上链操作,并分别从区块链获取对应的第一哈希值,第一哈希值即为文件压缩包的哈希值,例如,分组1中包含1000个文件压缩包,则获取对应的1000个第一哈希值;进一步地,基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值;具体地,基于每一组包含的所述第一哈希值生成中间哈希值可以每一组包含的第一哈希值进行组合生成中间哈希值,也可以通过对各个第一哈希值进行运算而生成中间哈希值,例如,基于分组1的1000个第一哈希值,经过计算生成一个中间哈希值,将该中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;本公开对基于每一组包含的所述第一哈希值生成中间哈希值的具体方法不做限定。进一步地,可以分别将每一组包含的第一哈希值生成的中间哈希值作为交易执行区块链上链操作,并分别从区块链获取针对该交易返回的第二哈希值;本公开对设定周期、设定分段周期、设定文件数量的数值不做限定。
进一步地,对每一组所述文件压缩包执行区块链上链操作,还包括:对每一组包含的所述文件压缩包执行区块链并发上链操作。因为每一组包含的各个文件压缩包之间不具有依赖交易关系,执行文件压缩包的并发上链操作;可以理解的是,由于存在网络的带宽等资源的限制,多个文件压缩包的上链操作可以是分批进行的,每一批内文件压缩包执行并发上链,通过并发上链的操作,提高了文件上链的效率;其中,所使用的区块链可以是联盟链、私有链等,本公开对区块链的 类型不做限定。本公开对执行区块链上链操作所使用的具体工具或者方法不做限定。
步骤S1902:将所述第二哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数。
具体地,根据步骤S1901所描述的分组的第一种方法或者第二种方法,一共分成了10组文件压缩包,则对每一组内的各个文件压缩包分别获取对应的第一哈希值;第一哈希值即为文件压缩包的哈希值。基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值;其中,可以分别将每一组包含的第一哈希值作为交易执行区块链上链操作,并分别从区块链获取针对该交易返回的第二哈希值;例如,根据10组中每一组的第一哈希值,例如分组1中包含1000个文件压缩包,则对应1000个第一哈希值,基于这1000个第一哈希值生成一个中间哈希值,并对所述中间哈希值执行区块链上链操作,并从区块链获取对应的一个第二哈希值,类似地,根据每一组的第一哈希值分别获取10个第二哈希值。
进一步地,将所述第二哈希值作为当前哈希值,循环执行以下操作;直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并 从区块链获取对应的第二哈希值;其中,基于选择出的预定义数量个当前哈希值生成中间哈希值,可以通过将选择出的预定义数量个当前哈希值进行组合生成中间哈希值,也可以通过对选择出的预定义数量个当前哈希值进行运算而生成中间哈希值,将该中间哈希值作为交易执行区块链上链操作,并从区块链获取对应的第二哈希值;本公开对选择出的预定义数量个当前哈希值生成中间哈希值的具体方法不做限定。
进一步地,当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值。其中,预定义数量为大于1的整数,例如,2、3、4、10、100、1000,预定义数量用于第二哈希值形成的树状结构的分叉数量,预定义数量可以根据业务的场景或者文件压缩包的数量而确定本公开对预定义数量的具体数值不做限定。
在循环过程中,第二哈希值作为当前哈希值;可以理解的是,根据上述描述,经过循环获取每个层级的哈希值,直到获取唯一的根哈希值(即,直至所述当前哈希值的数量为1),形成一个树状哈希值存储结构。通过上述方法,提高了获取文件的复杂度,从而提高了文件的安全性。
下面举例说明上述过程,例如:对99组文件压缩包,对应获取到99个第二哈希值;并设置预定义数量为5;则将所述第二哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:即,将99个第二哈希值作为当前哈希值循环执行以下操作:
从99个第二哈希值(当前哈希值)中,分别选择预定义数量个(例如5个)当前哈希值,并根据选择出的预定义数量个所述当前哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;可以理解 的是,将99个第二哈希值,分别选择预定义数量(5个)当前哈希值,并对选择的5个哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值,通过上述操作,获取到19个第二哈希值。
进一步地,99个当前哈希值中的95(19*5)对应于19个第二哈希值,还有4个当前哈希值未被选择,且未被选择过的所述当前哈希值的数量小于所述预定义数量(5个)时,则基于这4个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的一个第二哈希值;即,当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值。
上述示例步骤描述了基于99个当前哈希值获取到20个第二哈希值,并将这20个第二哈希值作为当前哈希值,循环执行上述步骤,类似地,可知,20个当前哈希值中,分别选择5个(预定义数量)执行区块链上链操作,并从区块链获取对应下一层级的第二哈希值,可知获取了4个第二哈希值(当前哈希值);进一步地,获取到1个第二哈希值,即,直至所述当前哈希值的数量为1;循环操作停止;根据上述描述,经过循环上链操作以及获取哈希值,直到获取唯一的根哈希值,形成一个多叉树的哈希值存储结构。通过上述方法,提高了获取文件的复杂度,从而提高了文件的安全性。
步骤S1903:将所述当前哈希值作为根哈希值,并发送所述当前哈希值。
具体地,根据步骤S1902描述的多叉树的存储结构,经过循环,获取根哈希值并发送所述根哈希值。
发送所述根哈希值有两种方法:1)通过区块链发送所述根哈希值 给有获取共享文件权限的获取方;2)通过其他方式发送所述根哈希值给有获取共享文件权限的获取方,例如:官方电子邮件等;可以理解的是,将所述根哈希值发送给有获取共享文件权限的获取方,所述有权限的获取方可以是一方或者多方;例如:所述文件为银行A和银行B在预定义时间范围内产生的对账单;在步骤S1901-步骤S1903之后产生了根哈希值,则将所述根哈希值发送给对这些对账单文件有获取权限的银行A和银行B;显而易见地是,利用该操作进一步提高了文件的安全性。关于步骤S1901-S1903的流程的进一步地示例如图31所示。
如图20所示,本公开第三实施例提供了一种获取共享文件的方法,该方法可以包括以下步骤:
步骤S2001:接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值具体地,根据所述根哈希值,从区块链上获取所述文件压缩包哈希值对应的文件压缩包中文件的方法的描述与步骤S2201-步骤S2203所描述的示例一致,在此不再赘述。
如图21所示,本公开第三实施例提供了一种利用多叉树结构存储共享文件哈希值的方法,该方法可以包括以下步骤:
步骤S2101:对分组1的所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的n个第一哈希值。
如图21所示示例,分组1包含文件压缩包1-文件压缩包n;可以理解的是,如步骤S1902所描述的两种分组方法,文件压缩包1-文件压缩包n可以是设定分段周期内形成的各个文件压缩包;也可以是设定文件数量个文件压缩包,n即是设定文件数量;进一步地,对分组1 中的每一个文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值;例如,对文件压缩包1执行区块链上链操作,并从区块链获取对应的第一哈希值,其中,可以将文件压缩包1作为交易执行区块链上链操作,并从区块链获取针对该交易的第一哈希值,例如:第一哈希值1;以此类推,对文件压缩包n执行区块链上链操作,并从区块链获取对应的第一哈希值n;可以理解的是,文件压缩包的数量n可以是数十、数百、数万、数十万、数百万、数千万等;即,对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值。
步骤S2102:对分组1包含的所述第一哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值1;如步骤S2101所描述,根据在分组1中的n个文件压缩包,获取了n个文件压缩包对应的第一哈希值,即第一哈希值1-第一哈希值n;进一步地,基于这n个第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值(第二哈希值1);所述第二哈希值的数量为1;也即,根据一个分组的各个第一哈希值获取一个第二哈希值;即,基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值。
步骤S2103:对分组2的所述文件压缩包执行区块链上链操作,并从区块链获取分组2包含的所述文件压缩包对应的m个第一哈希值。
步骤S2104:基于分组2包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值2;
步骤S2103-步骤S2104的描述与步骤S2101-步骤S2102的类似;可以理解的是,如步骤S1902所描述的两种分组方法,文件压缩包1-文件压缩包m可以是设定分段周期内形成的各个文件压缩包;也可以是设定文件数量个文件压缩包,则m即是设定文件数量。
进一步地,当利用设定分段周期的分组方法时,m与步骤S2101-步骤S2102中的n可以是不同的数值;当利用设定文件数量的分组方法时,m与步骤S2101-步骤S2102中的n是相同的数值;都等于设定文件数量。
步骤S2105:对分组3的所述文件压缩包执行区块链上链操作,并并从区块链获取分组3包含的所述文件压缩包对应的a个第一哈希值。
步骤S2106:基于分组3包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值3。
步骤S2105-步骤S2106的描述与步骤S2103-步骤S2104的描述类似;在此不再赘述。
步骤S2107:获取当前哈希值。
具体地,将步骤S2101-步骤S2106所获取的第二哈希值1、第二哈希值2、第二哈希值3作为当前哈希值;选择预定义数量(例如:2)个当前哈希值,并对选择出的预定义数量个所述当前哈希值(例如:层级1的第二哈希值1和第二哈希值2)执行区块链上链操作,并从区块链获取对应的第二哈希值(例如:层级2的第二哈希值1);进一步地,当存在未被选择过的所述当前哈希值(第二哈希值3)、且未被选择过的所述当前哈希值的数量小于所述预定义数量时(1<2),基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值(例如:层级2第二哈希值2)。
即,将所述第二哈希值作为当前哈希值,循环执行以下操作,直 至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数。
步骤S2108:将当前哈希值作为根哈希值。
具体地,将所述当前哈希值作为根哈希值,并发送所述当前哈希值。经过步骤S2107的操作,直至所述当前哈希值(层级3的根哈希值)的数量为1,则将所述当前哈希值作为根哈希值,并发送所述当前哈希值。
如图22所示,本公开第三实施例提供了一种基于多叉树结构的哈希值获取共享文件的方法,该方法可以包括以下步骤:
以下步骤S2201-步骤S2203以步骤S2101-步骤S2103所描述的示例为例说明基于多叉树结构的哈希值获取共享文件的方法;
步骤S2201:根据当前哈希值(根哈希值)。
具体地,接收当前哈希值;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值。
如图22所示,确定所述区块链上不存在与所述当前哈希值相同的文件压缩包哈希值,即所述当前哈希值不是文件压缩包的哈希值,则确定所述当前哈希值对应的预定义数量个下级哈希值,并将所述下级哈希值作为所述当前哈希值;当前哈希值的下级哈希值分别为下级哈希值1、下级哈希值2、下级哈希值3;并将所述下级哈希值作为所述当前哈希值。
步骤S2202:循环执行获取下级哈希值操作;
下面描述根哈希值以下的各层哈希值遍历并获取文件压缩包过程的示例;具体地,如图22所示,接收当前哈希值(下级哈希值1、下级哈希值2);确定所述区块链上不存在与所述当前哈希值(下级哈希值1)相同的文件压缩包哈希值;则确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值,例如:确定下级哈希值1(层级2)对应的各个子哈希值为下级哈希值1-下级哈希值2(层级3);进一步地,确定所述区块链上存在与所述当前哈希值(下级哈希值2)相同的文件压缩包哈希值(下级哈希值1-下级哈希值a);则从所述区块链上获取所述当前哈希值所对应的文件压缩包;分别为文件压缩包1-文件压缩包a;进一步地,针对层级3的下级哈希值1、下级哈希值2循环执行上述步骤,并从所述区块链上获取所述当前哈希值所对应的文件压缩包;即,接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
步骤S2204:根据文件压缩包的第一哈希值,获取文件压缩包以及文件压缩包中的文件。具体地,获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应的文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件;具体地对每个获取到的文件压缩包,执行解压和解密操作,解压和解密的方法与压缩和加密的方法相互对应。
如图23所示,本公开第三实施例提供了一种共享文件的流程,该流程包括以下步骤:
如图23所示的示意流程,利用步骤S2301-步骤S2303描述共享文 件上链的过程;利用步骤S2304描述共享文件获取方获取共享文件的过程;例如,执行共享文件上链的可以是银行总部,共享文件获取方可以是在业务上与共享文件直接相关的企业,例如:银行1、银行2、银行3等。
步骤S2301:获取设定周期内待共享的文件,形成多个文件压缩包;对所述多个文件压缩包进行分组,得到至少两组文件压缩包;对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值。
具体地,关于文件压缩包的形成以及上链的描述与步骤S1901一致,在此不再赘述;进一步地,对所述多个文件压缩包进行分组,得到至少两组文件压缩包;包括:将设定分段周期内形成的多个所述文件压缩包作为一组文件压缩包,得到至少两组文件压缩包,所述设定周期包含至少两个设定分段周期。所述对所述多个文件压缩包进行分组,得到至少两组文件压缩包;包括:根据设定文件数量对所述多个文件压缩包进行分组,得到至少两组文件压缩包。
再进一步地,获取设定周期内待共享的文件,形成多个文件压缩包,包括:获取设定周期内待共享的文件,形成多个文件包,根据网络带宽,确定所述文件包中文件的数量。再进一步地,分别对每一组所述文件包执行压缩和加密操作,形成所述文件压缩包。对每一组包含的所述文件压缩包执行区块链并发上链操作。
步骤S2302:基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值。将所述第二哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并 从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数。
具体地,关于获取第二哈希值(当前哈希值)的描述与步骤S1902一致,在此不再赘述。
步骤S2303:将所述当前哈希值作为根哈希值,并发送所述当前哈希值。
具体地,关于发送根哈希值的描述步骤S1903一致,在此不再赘述。
步骤S2304:接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
具体地,关于获取根哈希值以及各级哈希值上链的描述与步骤S2001的描述一致,在此不再赘述;进一步地,获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应的文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
如图24所示,本公开第三实施例提供了一种共享文件的装置2400,包括:文件压缩包上链模块2401、当前哈希值获取模块2402和根哈希 值获取模块2403;其中,
所述文件压缩包上链模块2401,用于获取设定周期内待共享的文件,形成多个文件压缩包;对所述多个文件压缩包进行分组,得到至少两组文件压缩包;对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值;
所述当前哈希值获取模块2402,用于基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值;将所述第二哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数;
所述根哈希值获取模块2403,用于将所述当前哈希值作为根哈希值,并发送所述当前哈希值。
如图25所示,本公开第三实施例提供了一种共享文件的装置2500,包括:获取链上文件模块2501;
其中,所述获取链上文件模块2501,用于接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
如图26所示,本公开第三实施例提供了一种共享文件的***2600, 包括:本公开第三实施例提供的共享文件的装置2400以及本公开第三实施例提供的共享文件的装置2500。
本公开第三实施例还提供了一种共享文件的电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述任一实施例提供的方法。
本公开第三实施例还提供了一种计算机可读介质,其上存储有计算机程序,所述程序被处理器执行时实现上述任一实施例提供的方法。
如图27所示,本公开第四实施例提供了一种存储更新共享文件的方法,该方法可以包括以下步骤:
步骤S2701:获取更新文件,根据所述更新文件的文件名查找待更新文件;根据所述更新文件,形成第一文件压缩包,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应的第一哈希值;
具体地,在具体场景中有需要更新已经存储于区块链上的文件的情况,当获取更新文件时,可以根据更新文件的文件名查找待更新文件;待更新文件可以存在与一个文件压缩包中,也可以存在与多个文件压缩包中,其中,待更新文件所属的文件压缩包可以从与区块链同步的本地存储介质获取,也可以从区块链上获取;进一步地,所述根据更新文件,形成的第一文件压缩包,包括:根据更新文件的文件名查找待更新文件所处的第二文件包,当所述第二文件包中包括除所述待更新文件以外的其他文件时,根据所述其他文件以及所述更新文件,生成第一文件包。
可以理解的是,更新文件与待更新文件具有相同的文件名,通过文件名查找待更新文件所处的第二文件包,例如:文件压缩包1(为第二文件包对应的第二文件压缩包的文件名)中包含100个文件,其中, “文件99.aa”为一个待更新文件,同时其他99个文件为不需要更新的文件,则,将更新文件“文件99.aa”替换待更新的相同文件名的文件,并与其他99个文件(即,包括除所述待更新文件以外的其他文件)生成一个新的文件包(即,第一文件包);进一步地,对所述第一文件包执行压缩和加密操作,形成所述第一文件压缩包。可以理解的是,区块链上已经包含各个文件压缩包;
再进一步地,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应的第一哈希值;所述上链的第一文件压缩包为包含更新文件的压缩包,并替换原有的文件压缩包;其中,可以将第一文件压缩包作为交易执行区块链上链操作,并从区块链获取针对该交易返回的哈希值,该哈希值即为所述文件压缩包的第一哈希值,也即第一文件压缩包对应的第一哈希值,所使用的区块链可以是联盟链、私有链等,本公开对区块链的类型不做限定。本公开对执行区块链上链所使用的具体工具或者方法不做限定。
步骤S2702:利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;所述分叉树包括至少三个哈希值;根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值。
利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;所述分叉树包括至少三个哈希值;根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;根据所述第一哈 希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值。
具体地,下面结合以图29以及相对应的图30的示例说明:其中,图29示出了未包含更新文件的树状结构;图30示出了基于图29的树状结构更新的包含更新文件的树状结构。
S1:利用所述第一哈希值替换区块链中的分叉树中的第二哈希值。
如图29所示的步骤S2901中,第二文件包2哈希值为分叉树中的第二哈希值;对应地,如图30所示的步骤S3001中,第一文件包2哈希值为分叉树中的第一哈希值;其中,步骤S3001中的第一哈希值(第一文件压缩包2哈希值)对应的第一文件压缩包(第一文件压缩包2)包含了更新文件。
步骤S2901中的第二哈希值(第二文件压缩包2哈希值)对应的第二文件压缩包(第二文件压缩包2)包含相同文件名的待更新文件;即,利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;进一步地,如图29、图30所示的分叉树,分别包含了11个哈希值;即,所述分叉树包括至少三个哈希值;可以理解的是,所述分叉树可以是设定数量个分叉树,例如:二叉树、十叉树、一百叉树等;也可以是不固定数量个分叉树,本公开对分叉树的具体形状和内容不做限定。
S2:根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;如图29所示的步骤S2902中,确定所述分叉树(图29所示的分叉树)第二哈希值(第二文件压缩包2哈希值)相关联且位于所述第二哈希值上级的至少一个第三哈希值(如 图29所示,与所述第二哈希值相关联且位于所述第二哈希值上级的为第三哈希值1、第三哈希值2、根哈希值),并且如图29所示,相对于第二哈希值(第二文件压缩包2哈希值),第三哈希值1所在层级为靠近根哈希值的层级;相对于第三哈希值1,第三哈希值2所在层级为靠近根哈希值的层级。
S3:根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值;
具体地,如图30所示的步骤S3002中,根据确定所述第一哈希值(如图30所示的第一文件压缩包2哈希值)以及所述分叉树结构(图29或者图30所示的分叉树),获取至少一个第四哈希值(如图30所示的第四哈希值1),所述至少一个第四哈希值(如图30所示的第四哈希值1)与所述至少一个第三哈希值(如图29所示,为第三哈希值1)在所述分叉树(图29或者图30所示的分叉树)中的位置一一对应;
可以理解的是,获取至少一个第四哈希值(例如:如图30所示的第四哈希值1)的方法为:基于第一文件压缩包2哈希值(即,所述第一哈希值)以及同层级的(层级1)的其他文件压缩包的哈希值生成中间哈希值,将中间哈希值执行区块链上链并获取对应的第四哈希值。其中,可以将中间哈希值作为交易执行上链操作,并从区块链获取针对该交易返回的哈希值,该哈希值即为所述的第四哈希值;进一步地,基于第四哈希值1和同层级的第三哈希值3生成中间哈希值,对中间哈希值执行区块链上链操作并获取对应的第四哈希值,例如第四哈希值2,经过层层迭代,直到得到新的根哈希值;进一步地,利用每一个所述第四哈希值替换位置相对应的每一个所述第三哈希值,如图30所示。
通过S1-S3的描述,对比图29和图30的示例可知,树状结构基于更新文件进行了与更新文件相关联哈希值的更新,对于整体树状结 构的数据来说为局部更新;即,与更新文件不相关的哈希值以及文件压缩包保持不变;部分解决了更新少量文件而造成的区块链上关联的全部文件以及文件存证重新上链的问题;提高了更新共享文件的效率。
步骤S2703:将最高级的第四哈希值作为新的根哈希值,并发送所述新的根哈希值。
具体地,将最高级的第四哈希值作为新的根哈希值(如图30所示的步骤S3004(如图30所示的步骤S3004,对应于如图29所示的步骤S2904);进一步地,发送所述新的根哈希值;发送所述新的根哈希值有两种方法:1)通过区块链发送所述新的根哈希值给有获取更新共享文件权限的获取方;2)通过其他方式发送所述新的根哈希值给有获取更新共享文件权限的获取方,例如:官方电子邮件等;可以理解的是,将所述新的根哈希值发送给有获取更新共享文件权限的获取方,所述有权限的获取方可以是一方或者多方;例如:所述更新文件为银行A和银行B在预定义时间范围内产生的对账单;在步骤S2701-步骤S2703之后产生了新的根哈希值,则将所述新的根哈希值发送给对这些更新的对账单文件有获取权限的银行A和银行B;显而易见地是,利用新的根哈希值的方式提高了文件的安全性。
如图28所示,本公开第四实施例提供了一种获取更新共享文件的方法,该方法可以包括以下步骤:
步骤S2801:接收根哈希值;确定所述根哈希值对应的子哈希值;循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;确定所述区块链上存在与所述子哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
具体地,根据所述新的根哈希值,从区块链上获取所述更新后的文件压缩包哈希值对应的更新文件压缩包中文件的方法的描述如步骤S3101-步骤S3104所描述的示例一致,在此不再赘述;进一步地,获取所述子哈希值所对应的更新文件压缩包中的更新文件,包括:获取所述子哈希值对应的更新文件压缩包,对所述更新文件压缩包执行解压和解密操作,获取文件包中的更新文件。具体地,对每个获取到的文件压缩包,执行解压和解密操作,解压和解密的方法与压缩和加密的方法相互对应。
如图31所示,本公开第四实施例提供了一种基于树结构的哈希值获取更新共享文件的方法,该方法可以包括以下步骤:
步骤S3101:根据接收的根哈希值。
具体地,接收根哈希值;确定所述根哈希值对应的子哈希值;可以理解的是,所述根哈希值为新的根哈希值;如图31所示示例,根哈希值(即为新的根哈希值)对应的子哈希值分别为下级哈希值1、下级哈希值2。
步骤S3102-步骤S3103:循环执行获取下级哈希值。
下面通过步骤S3102-步骤S3103描述循环执行,直至获取到所述子哈希值所对应的包含更新文件的文件压缩包的步骤;具体地,如图5所示,首先判断对应的子哈希值是否是包含更新文件的文件压缩包的哈希值,对于下级哈希值1来说:确定所述区块链上不存在与所述子哈希值(层级2,下级哈希值1)相同的文件压缩包哈希值,所述文件压缩包包括更新文件;则确定所述子哈希值(层级2,下级哈希值1)对应的下级哈希值,并将所述下级哈希值作为所述子哈希值,例如:确定下级哈希值1对应的各个子哈希值为下级哈希值1、下级哈希值2(归属于层级3)。
进一步地判断对应的子哈希值是否是包含更新文件的文件压缩包的哈希值;对于下级哈希值2来说:确定所述区块链上不存在与所述当前哈希值(层级2:下级哈希值2)相同的文件压缩包哈希值(所述文件压缩包包括更新文件),由图5示例可知,层级2的下级哈希值2与文件压缩包2哈希值为相同。
类似地,进一步确定下级哈希值1(层级2)对应的各个子哈希值为下级哈希值1(层级3)、下级哈希值2(层级3);进一步地,确定所述区块链上存在与所述当前哈希值(层级4:下级哈希值2)相同的文件压缩包哈希值(更新文件压缩包2哈希值,所述更新文件压缩包包括更新文件);可以理解的是,在查找到更新文件压缩包后,遍历操作可停止;即,接收根哈希值;确定所述根哈希值对应的子哈希值;循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;确定所述区块链上存在与所述子哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
步骤S3104:获取更新文件压缩包以及更新文件。
具体地,根据步骤S3101-步骤S3103,获取到了更新文件压缩包;进一步地,获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件;具体地对每个获取到的文件压缩包,执行解压和解密操作,解压和解密的方法与压缩和加密的方法相互对应。
如图32所示,本公开第四实施例提供了一种更新共享文件的流程,该流程包括以下步骤:
如图32所示的示意流程,利用步骤S3201-步骤S3203描述更新文件以及相关联的哈希值生成并上链的过程;利用步骤S3204描述更新文件获取方获取更新共享文件的过程;例如,执行更新文件上链的可以是银行总部,更新共享文件获取方可以是在业务上与更新文件直接相关的企业,例如:银行1、银行2、银行3等。
步骤S3201:获取更新文件,根据更新文件的文件名查找待更新文件;根据更新文件,形成第一文件压缩包,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应第一哈希值。
具体地,关于包含更新文件的第一文件压缩包的描述与步骤S2701一致,在此不再赘述;进一步地,根据所述更新文件,形成的第一文件压缩包,包括:根据所述更新文件的文件名查找待更新文件所处的第二文件包,当所述第二文件包中包括除所述待更新文件以外的其他文件时,根据所述其他文件以及所述更新文件,生成第一文件包。再进一步地,对所述第一文件包执行压缩和加密操作,形成所述第一文件压缩包。
步骤S3202:利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;所述分叉树包括至少三个哈希值;根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值。
具体地,关于替换更新文件压缩包以及相关联的哈希值的描述步 骤S2702一致,在此不再赘述。
步骤S3203:分别对所述第一哈希值、所述第四哈希值执行区块链上链操作,将最高级的第四哈希值作为新的根哈希值,并发送所述新的根哈希值。
具体地,关于生成新的根哈希值的描述,与步骤S2703一致,在此不再赘述。
步骤S3204:接收根哈希值;确定所述根哈希值对应的子哈希值;循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;确定所述区块链上存在与所述子哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
具体地,关于根据更新根哈希值,获取所述更新根哈希值对应的下级哈希值的描述与步骤S2801一致,在此不再赘述。进一步地,获取所述子哈希值所对应的更新文件压缩包中的更新文件,包括:获取所述子哈希值对应的更新文件压缩包,对所述更新文件压缩包执行解压和解密操作,获取文件包中的更新文件。
如图33所示,本公开第四实施例提供了一种更新共享文件的装置3300,包括:文件更新模块3301、哈希值更新模块3302和根哈希值更新模块3303;其中,
所述文件更新模块3301,用于获取更新文件,根据所述更新文件的文件名查找待更新文件;根据所述更新文件,形成第一文件压缩包,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应的第一哈希值;
所述哈希值更新模块3302,用于利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;所述分叉树包括至少三个哈希值;根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值;
所述根哈希值更新模块3303,用于将最高级的第四哈希值作为新的根哈希值,并发送所述新的根哈希值。
可选地,所述文件更新模块3301,还包括:根据所述更新文件的文件名查找待更新文件所处的第二文件包,当所述第二文件包中包括除所述待更新文件以外的其他文件时,根据所述其他文件以及所述更新文件,生成第一文件包。
可选地,所述文件更新模块3301,还用于对所述第一文件包执行压缩和加密操作,形成所述第一文件压缩包。
如图34所示,本公开第四实施例提供了一种更新共享文件的装置3400,包括:获取更新文件模块3401;其中,
所述获取更新文件模块3401,用于接收根哈希值;确定所述根哈希值对应的子哈希值;循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;确定所述区块链上存在与所述子哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
可选地,所述获取更新文件模块3401,还用于获取所述子哈希值所对应的更新文件压缩包中的更新文件,包括:获取所述子哈希值对应的更新文件压缩包,对所述更新文件压缩包执行解压和解密操作,获取文件包中的更新文件。
如图35所示,本公开第四实施例提供了一种更新共享文件的***3500,包括:更新共享文件的装置3300以及更新共享文件的装置3400。
本公开第四实施例还提供了一种更新共享文件的电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述任一实施例提供的方法。
本公开第四实施例还提供了一种计算机可读介质,其上存储有计算机程序,所述程序被处理器执行时实现上述任一实施例提供的方法。
图36示出了可以应用本公开实施例的共享文件的方法或共享文件的装置的示例性***架构3600。
如图36所示,***架构3600可以包括终端设备3601、3602、3603,网络3604和服务器3605。网络3604用以在终端设备3601、3602、3603和服务器3605之间提供通信链路的介质。网络3604可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
用户可以使用终端设备3601、3602、3603通过网络3604与服务器3605交互,以接收或发送消息等。终端设备3601、3602、3603上可以安装有各种客户端应用,例如企业应用客户端、网页浏览器应用、搜索类应用、即时通信工具和邮箱客户端等。
终端设备3601、3602、3603可以是具有显示屏并且支持运行各种 客户端应用的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。
服务器3605可以是提供各种服务的服务器,例如对用户利用终端设备3601、3602、3603所提出的获取文件的请求提供支持的后台管理服务器。后台管理服务器可以将待共享文件执行上链和存储,针对提出的获取文件的请求进行处理,并将文件返回给终端设备。
需要说明的是,本公开实施例所提供的共享文件的方法一般由服务器3605执行,相应地,共享文件的装置一般设置于服务器3605中。
应该理解,图36中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。
下面参考图37,其示出了适于用来实现本公开实施例的终端设备的计算机***3700的结构示意图。图37示出的终端设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图37所示,计算机***3700包括中央处理单元(CPU)3701,其可以根据存储在只读存储器(ROM)3702中的程序或者从存储部分3708加载到随机访问存储器(RAM)3703中的程序而执行各种适当的动作和处理。在RAM 3703中,还存储有***3700操作所需的各种程序和数据。CPU 3701、ROM 3702以及RAM 3703通过总线3704彼此相连。输入/输出(I/O)接口3705也连接至总线3704。
以下部件连接至I/O接口3705:包括键盘、鼠标等的输入部分3706;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分3707;包括硬盘等的存储部分3708;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分3709。通信部分3709经由诸如因特网的网络执行通信处理。驱动器3710也根据需要连接至I/O接口 3705。可拆卸介质3737,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器3737上,以便于从其上读出的计算机程序根据需要被安装入存储部分3708。
特别地,根据本公开公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分3709从网络上被下载和安装,和/或从可拆卸介质3737被安装。在该计算机程序被中央处理单元(CPU)3701执行时,执行本公开的***中限定的上述功能。
需要说明的是,本公开所示的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的***、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行***、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行***、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限 于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。
附图中的流程图和框图,图示了按照本公开各种实施例的***、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图或流程图中的每个方框、以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的***来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块和/或单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的模块和/或单元也可以设置在处理器中,例如,可以描述为:一种处理器包括文件压缩包上链模块、节点哈希值获取模块和根哈希值获取模块;其中,这些模块的名称在某种情况下并不构成对该模块本身的限定,例如,文件压缩包上链模块还可以被描述为“根据接收到的文件,形成文件压缩包并执行上链操作的模块”。还可以描述为:一种处理器包括获取链上文件模块;其中,所述模块的名称在某种情况下并不构成对该模块本身的限定,例如,获取链上文件模块还可以被描述为“根据文件压缩包哈希值,获取文件压缩包所包含的文件的模块”。
作为另一方面,本公开还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的设备中所包含的;也可以是单独存在,而未装配入该设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被一个该设备执行时,使得该设备包括:
获取待共享的文件,形成至少两个文件压缩包;对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;将所述当前哈希值作为根哈希值,并发送所述哈希值。
接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
获取待共享的文件,形成多个文件压缩包;对所述文件压缩包执行区块链上链操作,并从区块链获取所述文件压缩包对应的至少三个第一哈希值;将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数;将所述当前哈希值作为根哈希值,并发送所述哈希值。
接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
获取设定周期内待共享的文件,形成多个文件压缩包;对所述多个文件压缩包进行分组,得到至少两组文件压缩包;对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值;基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值;将所述第二哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数;将所述当前哈希值作为根哈希值,并发送所述当前哈希值
接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
获取更新文件,根据所述更新文件的文件名查找待更新文件;根据所述更新文件,形成第一文件压缩包,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应的第一哈希值;利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;所述分叉树包括至少三个哈希值;根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值;将最高级的第四哈希值作为新的根哈希值,并发送所述新的根哈希值
接收根哈希值;确定所述根哈希值对应的子哈希值;循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;确定所述区块链上存在与所述子哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
根据本公开实施例的技术方案,采用将多个文件压缩成文件包的技术手段,部分克服了因为文件数量大造成的网络资源负担过高的技术问题,通过将各个文件压缩包并发上链,提高了文件上链和共享(包括更新)的效率;利用多个数据结构存储哈希值并分享根哈希值进而获取共享文件,提高了共享文件的安全性。
上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。

Claims (60)

  1. 一种共享文件的方法,其特征在于,包括:
    获取待共享的文件,形成至少两个文件压缩包;
    对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;
    将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;
    将所述当前哈希值作为根哈希值,并发送所述哈希值。
  2. 根据权利要求1所述的方法,其特征在于,
    当所述当前哈希值的数量是偶数时,从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;在各个所述当前哈希值均被选择过的情况下,将所述第二哈希值作为所述当前哈希值。
  3. 根据权利要求1所述的方法,其特征在于,
    当所述当前哈希值的数量是非1的奇数时,从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;在未被选择的所述当前哈希值为1的情况下,将所述第二哈希值和所述未被选择的1个所述当前哈希值作为所述当前哈希值。
  4. 根据权利要求1所述的方法,其特征在于,
    获取待共享的文件,形成至少两个文件压缩包,包括:
    获取预定义时间范围内待共享的文件,形成至少两个文件包,根据网络带宽,确定所述文件包中文件的数量。
  5. 根据权利要求4所述的方法,其特征在于,
    分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。
  6. 根据权利要求1所述的方法,其特征在于,
    对所述文件压缩包执行区块链并发上链操作。
  7. 一种共享文件的方法,其特征在于,包括:
    接收当前哈希值;
    循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;
    确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;
    A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;
    A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
  8. 根据权利要求7所述的方法,其特征在于,
    获取到所述当前哈希值所对应的文件压缩包,包括:
    获取所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
  9. 一种共享文件的装置,其特征在于,包括:文件压缩包上链模块、节点哈希值获取模块和根哈希值获取模块;其中,
    所述文件压缩包上链模块,用于获取待共享的文件,形成至少两个文件压缩包;对所述至少两个文件压缩包执行区块链上链操作,并从区块链获取所述至少两个文件压缩包分别对应的至少两个第一哈希值;
    所述节点哈希值获取模块,用于将所述至少两个第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;
    所述根哈希值获取模块,用于将所述当前哈希值作为根哈希值,并发送所述哈希值。
  10. 根据权利要求9所述的装置,其特征在于,
    所述节点哈希值获取模块,包括当所述当前哈希值的数量是偶数时,从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;在各个所述当前哈希值均被选择过的情况下,将所述第二哈希值作为所述当前哈希值。
  11. 根据权利要求9所述的装置,其特征在于,
    所述节点哈希值获取模块,包括当所述当前哈希值的数量是非1的奇数时,从所述至少两个当前哈希值中,成对选择当前哈希值,基于选择出的一对所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;在未被选择的所述当前哈希值为1的情况下,将所述第二哈希值和所述未被选择的1个所述当前哈希值作为所述当前哈希值。
  12. 根据权利要求9所述的装置,其特征在于,
    所述文件压缩包上链模块,用于获取待共享的文件,形成至少两个文件压缩包,包括:获取预定义时间范围内待共享的文件,形成至少两个文件包,根据网络带宽,确定所述文件包中文件的数量。
  13. 根据权利要求12所述的装置,其特征在于,
    所述文件压缩包上链模块,用于分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。
  14. 根据权利要求9所述的装置,其特征在于,
    所述文件压缩包上链模块,用于对所述文件压缩包执行区块链并发上链操作。
  15. 一种共享文件的装置,其特征在于,包括:获取共享文件模块;其中,
    所述获取共享文件模块,用于接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的两个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
  16. 根据权利要求15所述的装置,其特征在于,
    所述获取共享文件模块,用于获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
  17. 一种共享文件的***,其特征在于,包括:权利要求9所述的共享文件的装置、以及权利要求15所述的共享文件的装置。
  18. 一种共享文件的方法,其特征在于,包括:
    获取待共享的文件,形成多个文件压缩包;
    对所述文件压缩包执行区块链上链操作,并从区块链获取所述文件压缩包对应的至少三个第一哈希值;
    将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设 定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数;
    将所述当前哈希值作为根哈希值,并发送所述哈希值。
  19. 根据权利要求18所述的方法,其特征在于,
    获取待共享的文件,形成多个文件压缩包,包括:
    获取预定义时间范围内待共享的文件,形成至少三个文件包,根据网络带宽,确定所述文件包中文件的数量。
  20. 根据权利要求19所述的方法,其特征在于,
    分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。
  21. 根据权利要求18所述的方法,其特征在于,
    对所述文件压缩包执行区块链并发上链操作。
  22. 一种共享文件的方法,其特征在于,包括:
    接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;
    确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;
    A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;
    A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
  23. 根据权利要求22所述的方法,其特征在于,
    获取到所述当前哈希值所对应的文件压缩包,包括:
    获取到所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
  24. 一种共享文件的装置,其特征在于,包括:文件压缩包上链模块、节点哈希值获取模块和根哈希值获取模块;其中,
    所述文件压缩包上链模块,用于获取待共享的文件,形成多个文件压缩包;对所述文件压缩包执行区块链上链操作,并从区块链获取所述文件压缩包对应的至少三个第一哈希值;
    所述上级哈希值获取模块,用于将所述第一哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少三个当前哈希值中,分别选择设定数量个当前哈希值,基于选择出的设定数量个当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述设定数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;将所述第二哈希值作为所述当前哈希值;所述设定数量为大于2的整数;
    所述根哈希值获取模块,用于将所述当前哈希值作为根哈希值,并发送所述哈希值。
  25. 根据权利要求24所述的装置,其特征在于,
    所述文件压缩包上链模块,用于获取待共享的文件,形成多个文件压缩包,包括:获取预定义时间范围内待共享的文件,形成至少三个文件包,根据网络带宽,确定所述文件包中文件的数量。
  26. 根据权利要求25所述的装置,其特征在于,
    所述文件压缩包上链模块,用于分别对所述文件包执行压缩和加密操作,形成所述文件压缩包。
  27. 根据权利要求25所述的装置,其特征在于,
    所述文件压缩包上链模块,用于对所述文件压缩包执行区块链并发上链操作。
  28. 一种共享文件的装置,其特征在于,包括:获取链上文件模块;其中,
    所述获取链上文件模块,用于接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
  29. 根据权利要求28所述的装置,其特征在于,
    所述获取链上文件模块,用于获取到所述当前哈希值所对应的文件压缩包,包括:获取到所述当前哈希值所对应文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
  30. 一种共享文件的***,其特征在于,包括:权利要求24所述的共享文件的装置、以及权利要求28所述的共享文件的装置。
  31. 一种共享文件的方法,其特征在于,包括:
    获取设定周期内待共享的文件,形成多个文件压缩包;
    对所述多个文件压缩包进行分组,得到至少两组文件压缩包;对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值;
    基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值;将所述第二哈希值作为当前哈希值,循环执行以下操作,直至 所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数;
    将所述当前哈希值作为根哈希值,并发送所述当前哈希值。
  32. 根据权利要求31所述的方法,其特征在于,
    对所述多个文件压缩包进行分组,得到至少两组文件压缩包;包括:
    将设定分段周期内形成的多个所述文件压缩包作为一组文件压缩包,得到至少两组文件压缩包,所述设定周期包含至少两个设定分段周期。
  33. 根据权利要求31所述的方法,其特征在于,
    对所述多个文件压缩包进行分组,得到至少两组文件压缩包;包括:
    根据设定文件数量对所述多个文件压缩包进行分组,得到至少两组文件压缩包。
  34. 根据权利要求31所述的方法,其特征在于,
    获取设定周期内待共享的文件,形成多个文件压缩包,包括:
    获取设定周期内待共享的文件,形成多个文件包,根据网络带宽,确定所述文件包中文件的数量。
  35. 根据权利要求34所述的方法,其特征在于,
    分别对每一组所述文件包执行压缩和加密操作,形成所述文件压 缩包。
  36. 根据权利要求31所述的方法,其特征在于,
    对每一组包含的所述文件压缩包执行区块链并发上链操作。
  37. 一种共享文件的方法,其特征在于,包括:
    接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;
    确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;
    A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;
    A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
  38. 根据权利要求37所述的方法,其特征在于,
    获取到所述当前哈希值所对应的文件压缩包,包括:
    获取所述当前哈希值所对应的文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
  39. 一种共享文件的装置,其特征在于,包括:文件压缩包上链模块、当前哈希值获取模块和根哈希值获取模块;其中,
    所述文件压缩包上链模块,用于获取设定周期内待共享的文件,形成多个文件压缩包;对所述多个文件压缩包进行分组,得到至少两组文件压缩包;对每一组所述文件压缩包执行区块链上链操作,并从区块链获取每一组包含的所述文件压缩包对应的第一哈希值;
    所述当前哈希值获取模块,用于基于每一组包含的所述第一哈希值生成中间哈希值,分别对所述中间哈希值执行区块链上链操作,并分别从区块链获取对应的第二哈希值;将所述第二哈希值作为当前哈希值,循环执行以下操作,直至所述当前哈希值的数量为1:从所述至少两个当前哈希值中,选择预定义数量个当前哈希值,基于选择出的 预定义数量个所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的第二哈希值;当存在未被选择过的所述当前哈希值、且未被选择过的所述当前哈希值的数量小于所述预定义数量时,基于未被选择过的所述当前哈希值生成中间哈希值,对所述中间哈希值执行区块链上链操作,并从区块链获取对应的成第二哈希值;将所述第二哈希值作为所述当前哈希值;所述预定义数量为大于1的整数;
    所述根哈希值获取模块,用于将所述当前哈希值作为根哈希值,并发送所述当前哈希值。
  40. 根据权利要求39所述的装置,其特征在于,
    所述文件压缩包上链模块,用于对所述多个文件压缩包进行分组,得到至少两组文件压缩包;包括:将设定分段周期内形成的多个所述文件压缩包作为一组文件压缩包,得到至少两组文件压缩包,所述设定周期包含至少两个设定分段周期。
  41. 根据权利要求39所述的装置,其特征在于,
    所述文件压缩包上链模块,用于对所述多个文件压缩包进行分组,得到至少两组文件压缩包;包括:根据设定文件数量对所述多个文件压缩包进行分组,得到至少两组文件压缩包。
  42. 根据权利要求39所述的装置,其特征在于,
    所述文件压缩包上链模块,用于获取设定周期内待共享的文件,形成多个文件压缩包,包括:获取设定周期内待共享的文件,形成多个文件包,根据网络带宽,确定所述文件包中文件的数量。
  43. 根据权利要求42所述的装置,其特征在于,
    所述文件压缩包上链模块,用于分别对每一组所述文件包执行压缩和加密操作,形成所述文件压缩包。
  44. 根据权利要求39所述的装置,其特征在于,
    所述文件压缩包上链模块,用于对每一组包含的所述文件压缩包执行区块链并发上链操作。
  45. 一种共享文件的装置,其特征在于,包括:获取链上文件模块;其中,
    所述获取链上文件模块,用于接收当前哈希值;循环执行以下步骤,直至获取到所述当前哈希值所对应的文件压缩包;
    确定所述区块链上存在与所述当前哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;
    A1:从所述区块链上获取所述当前哈希值所对应的文件压缩包;
    A2:确定所述当前哈希值对应的各个下级哈希值,并将所述下级哈希值作为所述当前哈希值。
  46. 根据权利要求45所述的装置,其特征在于,
    所述获取链上文件模块,用于获取到所述当前哈希值所对应的文件压缩包,包括:获取所述当前哈希值所对应的文件压缩包,对所述文件压缩包执行解压和解密操作,获取文件压缩包中的文件。
  47. 一种共享文件的***,其特征在于,包括:权利要求39所述的共享文件的装置、以及权利要求46所述的共享文件的装置。
  48. 一种更新共享文件的方法,其特征在于,包括:
    获取更新文件,根据所述更新文件的文件名查找待更新文件;
    根据所述更新文件,形成第一文件压缩包,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应的第一哈希值;
    利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;
    所述分叉树包括至少三个哈希值;
    根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;
    根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;
    利用所述第四哈希值替换位置相对应的所述第三哈希值;将最高级的第四哈希值作为新的根哈希值,并发送所述新的根哈希值。
  49. 根据权利要求48所述的方法,其特征在于,
    根据所述更新文件,形成第一文件压缩包,包括:
    根据所述更新文件的文件名查找待更新文件所处的第二文件包,当所述第二文件包中包括除所述待更新文件以外的其他文件时,根据所述其他文件以及所述更新文件,生成第一文件包。
  50. 根据权利要求49所述的方法,其特征在于,
    对所述第一文件包执行压缩和加密操作,形成所述第一文件压缩包。
  51. 一种更新共享文件的方法,其特征在于,包括:
    接收根哈希值;确定所述根哈希值对应的子哈希值;
    循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;
    确定所述区块链上存在与所述子哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;
    A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;
    A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
  52. 根据权利要求51所述的方法,其特征在于,
    获取所述子哈希值所对应的更新文件压缩包中的更新文件,包括:
    获取所述子哈希值对应的更新文件压缩包,对所述更新文件压缩包执行解压和解密操作,获取文件包中的更新文件。
  53. 一种更新共享文件的装置,其特征在于,包括:文件更新模块、哈希值更新模块和根哈希值更新模块;其中,
    所述文件更新模块,用于获取更新文件,根据所述更新文件的文件名查找待更新文件;根据所述更新文件,形成第一文件压缩包,并对所述第一文件压缩包执行区块链上链操作,从区块链获取所述第一文件压缩包对应的第一哈希值;
    所述哈希值更新模块,用于利用所述第一哈希值替换区块链中的分叉树中的第二哈希值,所述第二哈希值对应的第二文件压缩包包括所述待更新文件;所述分叉树包括至少三个哈希值;根据所述分叉树的结构,确定所述分叉树中与所述第二哈希值相关联且位于所述第二哈希值上级的至少一个第三哈希值;所述上级为分叉树中靠近根哈希值的层级;根据所述第一哈希值以及所述分叉树的结构,获取至少一个第四哈希值,所述至少一个第四哈希值与所述至少一个第三哈希值在所述分叉树中的位置一一对应;利用所述第四哈希值替换位置相对应的所述第三哈希值;
    所述根哈希值更新模块,用于将最高级的第四哈希值作为新的根哈希值,并发送所述新的根哈希值。
  54. 根据权利要求53所述的装置,其特征在于,
    所述文件更新模块,用于根据所述更新文件,形成第一文件压缩包,包括:根据所述更新文件的文件名查找待更新文件所处的第二文件包,当所述第二文件包中包括除所述待更新文件以外的其他文件时,根据所述其他文件以及所述更新文件,生成第一文件包。
  55. 根据权利要求54所述的装置,其特征在于,
    所述文件更新模块,用于对所述第一文件包执行压缩和加密操作, 形成所述第一文件压缩包。
  56. 一种更新共享文件的装置,其特征在于,包括:获取更新文件模块;其中,
    所述获取更新文件模块,用于接收根哈希值;确定所述根哈希值对应的子哈希值;
    循环执行以下步骤,直至获取到所述子哈希值所对应的文件压缩包,所述文件压缩包包括更新文件;确定所述区块链上存在与所述子哈希值相同的文件压缩包哈希值,如果是,执行A1;否则执行A2;A1:从所述区块链上获取所述子哈希值所对应的文件压缩包;A2:确定所述子哈希值对应的下级哈希值,并将所述下级哈希值作为所述子哈希值。
  57. 根据权利要求56所述的装置,其特征在于,
    所述获取更新文件模块,用于获取所述子哈希值所对应的更新文件压缩包中的更新文件,包括:获取所述子哈希值对应的更新文件压缩包,对所述更新文件压缩包执行解压和解密操作,获取文件包中的更新文件。
  58. 一种更新共享文件的***,其特征在于,包括:权利要求53所述的共享文件的装置、以及权利要求56所述的共享文件的装置。
  59. 一种电子设备,其特征在于,包括:
    一个或多个处理器;
    存储装置,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-8或者18-23或者31-38或者48-52中任一所述的方法。
  60. 一种计算机可读介质,其上存储有计算机程序,其特征在于, 所述程序被处理器执行时实现如权利要求1-8或者18-23或者31-38或者48-52中任一所述的方法。
PCT/CN2021/110599 2020-08-04 2021-08-04 共享文件的方法、装置和*** WO2022028486A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
EP21852328.0A EP4180984A1 (en) 2020-08-04 2021-08-04 File sharing method, device, and system

Applications Claiming Priority (8)

Application Number Priority Date Filing Date Title
CN202010773252.3 2020-08-04
CN202010772425.XA CN111984612B (zh) 2020-08-04 2020-08-04 一种共享文件的方法、装置和***
CN202010772434.9 2020-08-04
CN202010772434.9A CN111984614B (zh) 2020-08-04 2020-08-04 一种共享文件的方法、装置和***
CN202010772432.XA CN111984613B (zh) 2020-08-04 2020-08-04 一种共享文件的方法、装置和***
CN202010773252.3A CN111984616B (zh) 2020-08-04 2020-08-04 一种更新共享文件的方法、装置和***
CN202010772425.X 2020-08-04
CN202010772432.X 2020-08-04

Publications (1)

Publication Number Publication Date
WO2022028486A1 true WO2022028486A1 (zh) 2022-02-10

Family

ID=80120045

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/110599 WO2022028486A1 (zh) 2020-08-04 2021-08-04 共享文件的方法、装置和***

Country Status (2)

Country Link
EP (1) EP4180984A1 (zh)
WO (1) WO2022028486A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107633088A (zh) * 2017-09-29 2018-01-26 深圳市金证科技股份有限公司 一种文件管理方法及装置
US20190197174A1 (en) * 2017-12-22 2019-06-27 Warevalley Co., Ltd. Method and system for replicating data to heterogeneous database and detecting synchronization error of heterogeneous database through sql packet analysis
CN111984613A (zh) * 2020-08-04 2020-11-24 中国人民银行数字货币研究所 一种共享文件的方法、装置和***
CN111984614A (zh) * 2020-08-04 2020-11-24 中国人民银行数字货币研究所 一种共享文件的方法、装置和***
CN111984616A (zh) * 2020-08-04 2020-11-24 中国人民银行数字货币研究所 一种更新共享文件的方法、装置和***
CN111984612A (zh) * 2020-08-04 2020-11-24 中国人民银行数字货币研究所 一种共享文件的方法、装置和***

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107633088A (zh) * 2017-09-29 2018-01-26 深圳市金证科技股份有限公司 一种文件管理方法及装置
US20190197174A1 (en) * 2017-12-22 2019-06-27 Warevalley Co., Ltd. Method and system for replicating data to heterogeneous database and detecting synchronization error of heterogeneous database through sql packet analysis
CN111984613A (zh) * 2020-08-04 2020-11-24 中国人民银行数字货币研究所 一种共享文件的方法、装置和***
CN111984614A (zh) * 2020-08-04 2020-11-24 中国人民银行数字货币研究所 一种共享文件的方法、装置和***
CN111984616A (zh) * 2020-08-04 2020-11-24 中国人民银行数字货币研究所 一种更新共享文件的方法、装置和***
CN111984612A (zh) * 2020-08-04 2020-11-24 中国人民银行数字货币研究所 一种共享文件的方法、装置和***

Also Published As

Publication number Publication date
EP4180984A1 (en) 2023-05-17

Similar Documents

Publication Publication Date Title
KR102322729B1 (ko) 블록체인 월드 스테이트 머클 패트리샤 트라이 서브트리의 업데이트
KR102277289B1 (ko) 블록체인 월드 스테이트 머클 패트리샤 트리 서브트리 구성
CN111612388A (zh) 合并目标订单的方法和装置
WO2022028484A1 (zh) 共享文件的方法、装置及***
CN111371753B (zh) 一种资源共享方法和装置
CN111339206A (zh) 一种基于区块链的数据共享方法和装置
Balajee et al. A comparative study on efficient cloud security, services, simulators, load balancing, resource scheduling and storage mechanisms
WO2022028486A1 (zh) 共享文件的方法、装置和***
WO2020257123A1 (en) Systems and methods for blockchain-based authentication
CN111984613B (zh) 一种共享文件的方法、装置和***
CN111984614B (zh) 一种共享文件的方法、装置和***
CN111984616B (zh) 一种更新共享文件的方法、装置和***
CN113536748A (zh) 一种生成图表数据的方法和装置
CN111984612B (zh) 一种共享文件的方法、装置和***
US20210336795A1 (en) Hassh profiling mechanism
CN116204580A (zh) 在多部署数据库中复制帐户安全特征
CN110705935B (zh) 一种物流单据的处理方法和装置
CN115129425A (zh) 一种复制镜像的方法和装置
WO2022164726A1 (en) Dynamic facilitation of communications services
CN109657481B (zh) 数据管理方法及装置
CN109446183B (zh) 全局防重的方法和装置
CN112579075B (zh) 同质化***重构的方法和装置
CN117349321B (zh) 一种文档数据库多表连接查询方法及装置
CN111258572A (zh) 生成业务代码框架的方法和装置
CN116743408A (zh) 基于区块链的分布式文件共享方法和***

Legal Events

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

Ref document number: 21852328

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021852328

Country of ref document: EP

Effective date: 20230209

NENP Non-entry into the national phase

Ref country code: DE