CN110503434B - Data verification method, device, equipment and storage medium based on Hash algorithm - Google Patents

Data verification method, device, equipment and storage medium based on Hash algorithm Download PDF

Info

Publication number
CN110503434B
CN110503434B CN201910635310.3A CN201910635310A CN110503434B CN 110503434 B CN110503434 B CN 110503434B CN 201910635310 A CN201910635310 A CN 201910635310A CN 110503434 B CN110503434 B CN 110503434B
Authority
CN
China
Prior art keywords
data
target file
hash value
bit
file data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910635310.3A
Other languages
Chinese (zh)
Other versions
CN110503434A (en
Inventor
李艳萍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201910635310.3A priority Critical patent/CN110503434B/en
Publication of CN110503434A publication Critical patent/CN110503434A/en
Application granted granted Critical
Publication of CN110503434B publication Critical patent/CN110503434B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Storage Device Security (AREA)

Abstract

The application relates to the technical field of block chains, and provides a data verification method, a device, equipment and a storage medium based on a hash algorithm, wherein the method comprises the following steps: acquiring target file data; performing hash operation on the target file data by adopting a preset hash algorithm to obtain a check hash value; calling a reference hash value corresponding to the target file data; if the verification hash value is the same as the reference hash value, judging that the target file data is not tampered; and if the verification hash value is different from the reference hash value, judging that the target file data is tampered. The authenticity and the effectiveness of the target file data are verified and identified through the Hash algorithm of the third-party evidence storage mechanism, the legal evidence effectiveness of the target file data is endowed, the efficiency and the reliability of the target file data verification are improved, the target file data are preserved through the Hash value, and the target file data are effectively prevented from being leaked.

Description

Data verification method, device, equipment and storage medium based on Hash algorithm
Technical Field
The present application relates to the field of data storage, and in particular, to a data verification method, apparatus, device, and storage medium based on a hash algorithm.
Background
With the rapid growth of the internet, electronic commerce has become widespread in various countries, which has caused a great change in the form of conventional transactions. Electronic contracts are widely used by people as an important basis and means for electronic commerce operation, which greatly promotes the development of digital economy. Individuals, businesses, and governments are currently unable to handle daily transactions and other business activities without leaving electronic contracts.
In the field of electronic contracts, in many cases, some original documents related to electronic contracts need to be stored, such as evidence, and these original documents are generally stored separately from the electronic contracts, and when verifying whether these original documents are tampered, the original documents themselves need to be verified separately, which has the defects of high complexity and long time consumption.
Disclosure of Invention
The application provides a data verification method, a data verification device, data verification equipment and a storage medium based on a Hash algorithm, and can solve the problem that the authenticity verification of an original file is complex.
A data verification method based on a hash algorithm comprises the following steps: acquiring target file data; performing binary conversion on the target file data to obtain original binary data; adding n-bit filling data at the tail of the original binary data to obtain complementary bit binary data; the bit number of the complementary bit binary data is an integer multiple of 512; equally dividing the complementary binary data into a plurality of groups of 512-bit sub-binary data; carrying out Hash operation processing on each group of sub-binary data in sequence to generate a check Hash value; calling a reference hash value corresponding to the target file data; if the check hash value is the same as the reference hash value, judging that the target file data is not tampered; and if the verification hash value is different from the reference hash value, judging that the target file data is tampered.
Optionally, the sequentially performing hash operation processing on each group of sub-binary data to generate a check hash value includes: allocating 4 32-bit operational variables A1, A2, A3 and A4, and respectively initializing the operational variables A1, A2, A3 and A4; sequentially performing cyclic operation on each group of sub-binary data by using the initialized operational variables A1, A2, A3 and A4 and a preset cyclic algorithm to respectively obtain final values of the operational variables A1, A2, A3 and A4; concatenating the final values of the operational variables A1, A2, A3, A4 to generate the 128-bit check hash value; the cyclic algorithm comprises four rounds of operations, the first round of operations comprises 20 times of first assignment operations, and each time of the first assignment operations is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F1=(A2&A3)||(~A2&A4);
A1,A2,A3,A4<-(A4+F1+R 5 (A1)+W t +K t1 ),A1,R 30 (A1),A3;
the second round of operation has 20 second assignment operations, and each second assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F2=A2⊕A3⊕A4;
A1,A2,A3,A4<-(A4+F2+R 5 (A1)+W t +K t2 ),A1,R 30 (A1),A3;
the third round of operation has 20 third assignment operations, each of which is:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F3=(A2&A3)||(A2&A4)||(A3&A4);
A1,A2,A3,A4<-(A4+F3+R 5 (A1)+W t +K t3 ),A1,R 30 (A1),A3;
the fourth round of operation has 20 fourth assignment operations, each fourth assignment operation is:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F4=(A2 NAND A3)⊕A4;
A1,A2,A3,A4<-(A5+F4+R 5 (A1)+W t +K t4 ),A1,R 30 (A2),A3;
wherein, W t Representing a 32-bit word to be processed in the t-th sub-binary data; r k (A1) Indicating that the loop variable A1 is shifted to the left by k bits; k t1 、K t2 、K t3 、K t4 4 different constants for addition are represented; "+" is modulo 2 32 An addition operator; "&"bitwise and operator; "| |" is bitwise or operator; "to" is the operator of bit-wise negation; [ ] C ] is a bitwise XOR operator; "NAND" is a bitwise NAND operator; "< -" indicates an assignment operation.
Optionally, the format of the padding data is: a start flag field + an invalid field + a digit record field; the start flag field is used for identifying the position of the padding data in the complementary binary data; the invalid field is an invalid bit of the padding data; the invalid field is filled with logic 0; the bit number recording field is used for recording the original bit number of the binary data.
Optionally, the expression of n is:
Figure GDA0004000309900000021
c=a%512
wherein, a represents the original digit of the original binary data, d is the sum of the digits of the initial mark field and the digit record field,% is the operator of remainder, a and d are positive integers respectively.
Alternatively, the initial value of the operational variable A1 is 0x67452301, the initial value of the operational variable A2 is 0 xefclab 89, the initial value of the operational variable A3 is 0x98badcfe, and the initial value of the operational variable A4 is 0x10325476.
Optionally, before the obtaining the target file data, the method further includes: receiving original target file data transmitted by a data provider, and acquiring a timestamp when the original target file data is received; performing hash operation on the original target file data by adopting the hash algorithm to obtain the reference hash value; generating a signature file corresponding to the original target file data and the timestamp; the signature file comprises a digital signature, a file identifier and the timestamp; and transmitting the signature file and the timestamp back to a data provider, and performing associated storage on the reference hash value and the signature file.
Based on the same technical concept, the application also provides a data verification device based on the hash algorithm, which comprises:
and the transceiver module is used for acquiring the target file data.
The processing module is used for carrying out binary conversion on the target file data acquired by the acquisition module to obtain original binary data; adding n-bit filling data at the tail of the original binary data to obtain complementary bit binary data; the bit number of the complementary bit binary data is an integer multiple of 512; equally dividing the complementary bit binary data into a plurality of groups of 512-bit sub binary data; carrying out Hash operation processing on each group of sub-binary data in sequence to generate a check Hash value; calling a reference hash value corresponding to the target file data; if the check hash value is the same as the reference hash value, judging that the target file data is not tampered; and if the verification hash value is different from the reference hash value, judging that the target file data is tampered.
Optionally, the processing module is specifically configured to allocate 4 32-bit operational variables A1, A2, A3, and A4, and initialize the operational variables A1, A2, A3, and A4, respectively; sequentially performing cyclic operation on each group of sub-binary data by using initialized operational variables A1, A2, A3 and A4 and a preset cyclic algorithm to respectively obtain final values of the operational variables A1, A2, A3 and A4; concatenating the final values of the operational variables A1, A2, A3, A4 to generate the 128-bit check hash value; the cyclic algorithm comprises four rounds of operations, wherein the first round of operation comprises 20 times of first assignment operations, and each time of the first assignment operations is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F1=(A2&A3)||(~A2&A4);
A1,A2,A3,A4<-(A4+F1+R 5 (A1)+W t +K t1 ),A1,R 30 (A1),A3;
the second round of operation has 20 second assignment operations, and each second assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F2=A2⊕A3⊕A4;
A1,A2,A3,A4<-(A4+F2+R 5 (A1)+W t +K t2 ),A1,R 30 (A1),A3;
the third round of operation has 20 third assignment operations, each of which is:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F3=(A2&A3)||(A2&A4)||(A3&A4);
A1,A2,A3,A4<-(A4+F3+R 5 (A1)+W t +K t3 ),A1,R 30 (A1),A3;
the fourth round of operation has 20 times of fourth assignment operation, and each time of the fourth assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F4=(A2 NAND A3)⊕A4;
A1,A2,A3,A4<-(A5+F4+R 5 (A1)+W t +K t4 ),A1,R 30 (A2),A3;
wherein, W t Representing a 32-bit word to be processed in the t-th sub-binary data; r is k (A1) Indicating that the loop variable A1 is shifted to the left by k bits; k t1 、K t2 、K t3 、K t4 4 different constants for addition are represented; "+" is modulo 2 32 An addition operator; "&"is bitwise and operator; "| |" is bitwise or operator; "-" is a bitwise negation operator; [ ] C ] is a bitwise XOR operator; "NAND" is a bitwise NAND operator; "< -" indicates an assignment operation.
Optionally, the format of the padding data is: start flag field + invalid field + digit record field. The start flag field is used for identifying the position of the padding data in the complementary bit binary data; the invalid field is an invalid bit of the padding data; the invalid field is filled with logic 0; the bit number recording field is used for recording the original bit number of the binary data.
Optionally, the expression of n is:
Figure GDA0004000309900000041
c=a%512
wherein, a represents the original digit of the original binary data, d is the sum of the digits of the initial mark field and the digit record field,% is the operator of remainder, a and d are positive integers respectively.
Alternatively, the initial value of the operational variable A1 is 0x67452301, the initial value of the operational variable A2 is 0 xefclab 89, the initial value of the operational variable A3 is 0x98badcfe, and the initial value of the operational variable A4 is 0x10325476.
Optionally, the processing module is further configured to receive original target file data transmitted by a data provider, and obtain a timestamp when the original target file data is received; performing hash operation on the original target file data by adopting the hash algorithm to obtain the reference hash value; generating a signature file corresponding to the original target file data and the timestamp; the signature file comprises a digital signature, a file identifier and the timestamp; and transmitting the signature file and the timestamp back to a data provider, and storing the reference hash value and the signature file in an associated manner.
Based on the same technical concept, the present application also provides a computer device, comprising an input-output unit, a memory and a processor, wherein the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, cause the processor to execute the steps of the method as described above.
Based on the same technical concept, the present application also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the method as described above.
The beneficial effect of this application: the authenticity and the effectiveness of the target file data are verified and identified through the Hash algorithm of the third-party evidence storage mechanism, the legal evidence effectiveness of the target file data is given, the efficiency and the reliability of the target file data verification are improved, the target file data are preserved through the Hash value, and the target file data are effectively prevented from being leaked.
Drawings
Fig. 1 is a schematic flow chart of a data verification method based on a hash algorithm in the present application.
Fig. 2 is a schematic diagram of a data verification device based on a hash algorithm in the present application.
Fig. 3 is a schematic structural diagram of a computer device in an embodiment of the present application.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
As used herein, the singular forms "a", "an", "the" and "the" may include the plural forms as well, unless expressly stated otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, procedures, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, procedures, steps, operations, elements, components, and/or groups thereof.
Fig. 1 is a flowchart of a data verification method based on a hash algorithm in some embodiments of the present application, where the method is executed by a data verification device of a third-party certification storage platform, and is used to verify the authenticity and validity of target file data sent by a verification requester, as shown in fig. 1, the method may include the following steps S1 to S3:
s1, acquiring target file data; and performing hash operation on the target file data by adopting a preset hash algorithm to obtain a check hash value.
And the data verification equipment of the third-party evidence storage platform acquires the target file data from the verification request party and generates a verification hash value corresponding to the target file data by using a hash algorithm. The target file data of the verification requester is provided by the data provider. And the verification requester acquires the target file data from the data provider, sends the acquired target file data to the third-party certificate storage platform, and the third-party certificate storage platform verifies whether the target file data is tampered.
For example, the data provider is a bank, the verification requester is an arbitration mechanism, and the target files include a borrowing contract made between the bank and the borrower, an identification file of the borrower, a personal credit file of the borrower, and the like. And when the bank signs a borrowing combination with the borrower, the target file data are sent to the third-party certificate storage platform, and the third-party certificate storage platform generates a reference hash value according to the target file data and stores the reference hash value. If the borrower performs default behaviors, repayment to the bank is refused, the bank mentions arbitration to the borrower to the arbitration mechanism, the bank needs to submit target file data to the arbitration mechanism, and the arbitration mechanism sends the acquired target file data to the third-party evidence storage platform. After the third-party evidence storing platform acquires the target file data, a verification hash value corresponding to the target file data is generated by using a hash algorithm, the third-party evidence storing platform identifies whether the target file data is tampered or not according to the verification hash value, and the identification result is fed back to the arbitration mechanism.
In some embodiments, the target document data includes document data, electronic signature image data, and face recognition information data.
The documents are certificates, such as credit certificates, contracts, documents, certificates, and the like, which can be used as documents.
In some embodiments, the performing hash operation on the target file data by using a preset hash algorithm in step S1 to obtain a check hash value specifically includes the following steps S11 to S14:
and S11, carrying out binary conversion on the target file data to obtain original binary data.
The computer stores data in units of bytes, each byte having an 8-bit binary number.
And S12, adding n-bit filling data at the tail of the original binary data to obtain complementary bit binary data.
The number of bits of the complementary binary data is an integer multiple of 512.
The format of the padding data is as follows: start flag field + invalid field + digit record field.
The start flag field is used to identify the location of the padding data in the complementary binary data.
The invalid field is an invalid bit of the padding data; the invalid field is filled with a logical 0.
The bit number recording field is used for recording the original bit number of the binary data.
The number of bits of the start flag field and the number of bits recording field is fixed, and the number of bits of the invalid field is determined by the size of n.
In some embodiments, the expression of n is:
Figure GDA0004000309900000071
c=a%512
wherein, a represents the original digit of the original binary data, d is the sum of the digits of the initial mark field and the digit record field,% is the operator of remainder, a and d are positive integers respectively.
And S13, evenly dividing the complementary binary data into a plurality of groups of sub-binary data.
The number of bits of each set of sub-binary data is 512.
According to the parameters, after the complementary binary data is divided averagely, the (a + n)/512 groups of sub-binary data are obtained.
And S14, carrying out hash operation processing on each group of sub-binary data in sequence to generate a check hash value.
In some embodiments, step S14 includes the following steps S141-S143:
s141, 4 32-bit operational variables A1, A2, A3, and A4 are assigned, and the operational variables A1, A2, A3, and A4 are initialized, respectively.
The initialization values of the operational variables are respectively as follows: a1=0x67452301, A2=0 xefclab 89, A3=0x98badcfe, a4=0x10325476; wherein "0x" is a hexadecimal identifier, each hexadecimal operation variable has 8 bits, and the converted binary is 8 × 4=32 bits.
S142, carrying out circular operation on each group of sub-binary data in sequence by using the initialized operational variables A1, A2, A3 and A4 and a preset circular algorithm to respectively obtain final values of the operational variables A1, A2, A3 and A4; concatenating the final values of the operational variables A1, A2, A3, A4 to generate the check hash value of 128 bits.
Specifically, the cyclic algorithm comprises four rounds of operations, wherein the first round of operations comprises 20 first assignment operations, and each first assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F1=(A2&A3)||(~A2&A4);
A1,A2,A3,A4<-(A4+F1+R 5 (A1)+W t +K t1 ),A1,R 30 (A1),A3;
the second round of operation has 20 second assignment operations, and each second assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F2=A2⊕A3⊕A4;
A1,A2,A3,A4<-(A4+F2+R 5 (A1)+W t +K t2 ),A1,R 30 (A1),A3;
the third round of operation has 20 third assignment operations, each of which is:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F3=(A2&A3)||(A2&A4)||(A3&A4);
A1,A2,A3,A4<-(A4+F3+R 5 (A1)+W t +K t3 ),A1,R 30 (A1),A3;
the fourth round of operation has 20 times of fourth assignment operation, and each time of the fourth assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F4=(A2 NAND A3)⊕A4;
A1,A2,A3,A4<-(A5+F4+R 5 (A1)+W t +K t4 ),A1,R 30 (A2),A3;
wherein, W t Representing a 32-bit word to be processed in the t-th sub-binary data; r is k (A1) Indicating that the loop variable A1 is shifted to the left by k bits; k t1 、K t2 、K t3 、K t4 4 different constants for addition are represented; "+" is modulo 2 32 An addition operator; "&"is bitwise and operator; "| |" is bitwise or operator; "to" is the operator of bit-wise negation; [ ] C ] is a bitwise XOR operator; "NAND" is a bitwise NAND operator; "< -" indicates an assignment operation.
After the cyclic algorithm sequentially processes all the sub-binary data, the final values of the operational variables A1, A2, A3, and A4 are concatenated to obtain the check hash value of 4 × 32=128 bits.
And S2, calling a reference hash value corresponding to the target file data.
When the original target file data of the user is input by the data provider, the target file data is sent to the third-party evidence storage platform, and the third-party evidence storage platform generates a reference hash value corresponding to the target file data by using a hash algorithm and stores the reference hash value. It can be seen that the reference hash value stored by the third-party evidence storage platform is calculated according to the original target file data, and if the content of the target file data is tampered, the hash value generated by using the hash algorithm will be different from the reference hash value.
When the third-party evidence storage platform stores the reference hash value, a unique identifier is set for the reference hash value, the reference hash value is called according to the identifier, and the identifier can be an enterprise organization code or an identity card number of a certified person and the like. The identification is typically information in the target file data. And after the third-party evidence storing platform acquires the target file data provided by the verification requester, the identification is identified from the target file data, and then the reference hash value corresponding to the identification is searched from the database according to the identification. If the reference hash value can not be found, the identification is incorrect.
In some embodiments, prior to step S1, the method further comprises the following steps S01-S04:
s01, receiving original target file data transmitted by a data provider, and acquiring a time stamp when the original target file data is received.
And S02, carrying out hash operation on the original target file data by adopting the hash algorithm to obtain the reference hash value.
And the third party certificate storage platform generates the reference hash value according to the original target file data, namely, the certificate storage of the original target file data is completed.
And S03, generating a signature file corresponding to the original target file data and the time stamp.
The signature file comprises a digital signature, a file identification and the timestamp.
The file identification is the only identification of the original target file data and is used for the data provider to store the signature file and the original target file data in a correlation mode.
And S04, transmitting the signature file and the timestamp back to a data provider, and performing associated storage on the reference hash value and the signature file.
Generally, the third party is an institution having a notarization role, which accepts a data provider commission, performs certification storage for original target document data, and provides an original signature of the original target document data for the data provider to prove that the original target document data has been certified for storage.
Specifically, the third-party certificate storing platform records a timestamp when the original target file data is received, generates a signature file by adopting a preset signature algorithm, and transmits the signature file and the timestamp back to the data provider. And the file identifier of the data provider is an index, and the signature file is stored, so that the signature file can be conveniently searched later. And the third-party certificate storage platform associates the reference hash value with the signature file through the file identification, and stores the reference hash value and the signature file for stub.
S3, if the check hash value is the same as the reference hash value, judging that the target file data is not tampered; and if the verification hash value is different from the reference hash value, judging that the target file data is tampered.
And the third party certificate storage platform compares the verification hash value with the reference hash value, if the verification hash value is the same as the reference hash value, the target file data obtained by the verification request party is judged not to be tampered, and if the verification hash value is the same as the reference hash value, the target file data obtained by the verification request party is judged to be tampered. And the third party certificate storage platform feeds the hash verification result back to the verification request party, and the verification request party identifies the authenticity of the target file data according to the hash verification result.
In the embodiment, the authenticity and the effectiveness of the target file data are identified through the hash verification of the third-party evidence storage mechanism, the legal proof effectiveness of the target file data is given, the efficiency and the reliability of the target file data verification are improved, the target file data are preserved through the hash value, and the target file data are effectively prevented from being leaked.
Based on the same technical concept, the application also provides a data verification device based on the hash algorithm, as shown in fig. 2, the device includes a transceiver module 1 and a processing module 2. The processing module 2 is used for controlling the transceiving operation of the transceiving module 1.
The transceiver module 1 is used for acquiring target file data.
The processing module 2 is configured to perform binary conversion on the target file data acquired by the acquisition module 1 to obtain original binary data; adding n-bit filling data at the tail of the original binary data to obtain complementary bit binary data; the bit number of the complementary bit binary data is an integral multiple of 512; equally dividing the complementary bit binary data into a plurality of groups of 512-bit sub binary data; carrying out Hash operation processing on each group of sub-binary data in sequence to generate a check Hash value; calling a reference hash value corresponding to the target file data; if the check hash value is the same as the reference hash value, judging that the target file data is not tampered; and if the verification hash value is different from the reference hash value, judging that the target file data is tampered.
In some embodiments, the processing module 2 is specifically configured to allocate 4 32-bit operands A1, A2, A3, and A4, and initialize the operands A1, A2, A3, and A4, respectively; sequentially performing cyclic operation on each group of sub-binary data by using the initialized operational variables A1, A2, A3 and A4 and a preset cyclic algorithm to respectively obtain final values of the operational variables A1, A2, A3 and A4; concatenating the final values of the operational variables A1, A2, A3, A4 to generate the 128-bit check hash value; the cyclic algorithm comprises four rounds of operations, the first round of operations comprises 20 times of first assignment operations, and each time of the first assignment operations is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F1=(A2&A3)||(~A2&A4);
A1,A2,A3,A4<-(A4+F1+R 5 (A1)+W t +K t1 ),A1,R 30 (A1),A3;
the second round of operation has 20 second assignment operations, and each second assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F2=A2⊕A3⊕A4;
A1,A2,A3,A4<-(A4+F2+R 5 (A1)+W t +K t2 ),A1,R 30 (A1),A3;
the third round of operation has 20 third assignment operations, each of which is:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F3=(A2&A3)||(A2&A4)||(A3&A4);
A1,A2,A3,A4<-(A4+F3+R 5 (A1)+W t +K t3 ),A1,R 30 (A1),A3;
the fourth round of operation has 20 times of fourth assignment operation, and each time of the fourth assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F4=(A2 NAND A3)⊕A4;
A1,A2,A3,A4<-(A5+F4+R 5 (A1)+W t +K t4 ),A1,R 30 (A2),A3;
wherein, W t Representing a 32-bit word to be processed in the t-th sub-binary data; r k (A1) Indicating that the loop variable A1 is shifted to the left by k bits; k t1 、K t2 、K t3 、K t4 4 different constants for addition are represented; "+" is modulo 2 32 An addition operator; "&"is bitwise and operator; "| |" is bitwise or operator; "-" is a bitwise negation operator; [ ] C ] is a bitwise XOR operator; "NAND" is a bitwise NAND operator; "< -" indicates an assignment operation.
The format of the padding data is as follows: start flag field + invalid field + digit record field. The start flag field is used for identifying the position of the padding data in the complementary bit binary data; the invalid field is an invalid bit of the padding data; the invalid field is filled with a logic 0; the bit number recording field is used for recording the original bit number of the binary data.
In some embodiments, the expression of n is:
Figure GDA0004000309900000111
c=a%512
wherein, a represents the original digit of the original binary data, d is the sum of the digits of the initial mark field and the digit record field,% is the operator of remainder, a and d are positive integers respectively.
In some embodiments, the initial value of the operational variable A1 is 0x67452301, the initial value of the operational variable A2 is 0 xefclab 89, the initial value of the operational variable A3 is 0x98badcfe, and the initial value of the operational variable A4 is 0x10325476.
In some embodiments, the processing module 2 is further configured to receive original target file data transmitted by a data provider, and obtain a timestamp when the original target file data is received; performing hash operation on the original target file data by adopting the hash algorithm to obtain the reference hash value; generating a signature file corresponding to the original target file data and the timestamp; the signature file comprises a digital signature, a file identifier and the timestamp; and transmitting the signature file and the timestamp back to a data provider, and performing associated storage on the reference hash value and the signature file.
In the embodiment, the authenticity and the effectiveness of the target file data are identified through the Hash verification of the third-party evidence storage mechanism, the legal proof effectiveness of the target file data is endowed, the efficiency and the reliability of the target file data verification are improved, the target file data are preserved through the Hash value, and the target file data are effectively prevented from being leaked.
Based on the same technical concept, the present application further provides a computer device, as shown in fig. 3, the computer device includes an input/output unit 31, a processor 32 and a memory 33, where the memory 33 stores computer-readable instructions, and when the computer-readable instructions are executed by the processor 32, the processor executes the steps of the data verification method based on the hash algorithm in the above embodiments.
The physical device corresponding to the transceiver module 1 shown in fig. 2 is the input/output unit 31 shown in fig. 3, and the input/output unit 31 can implement part or all of the functions of the transceiver module 1, or implement the same or similar functions as the transceiver module 1.
The entity device corresponding to the processing module 2 shown in fig. 2 is the processor 32 shown in fig. 3, and the processor 32 can implement part or all of the functions of the processing module 2, or implement the same or similar functions as the processing module 2.
Based on the same technical concept, the present application also provides a storage medium storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the steps of the hash algorithm-based data verification method in the above embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present application or portions thereof contributing to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (e.g., ROM/RAM), and includes several instructions for enabling a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the method described in the embodiments of the present application.
The embodiments of the present application have been described above with reference to the drawings, but the present application is not limited to the above-mentioned embodiments, which are only illustrative and not restrictive, and those skilled in the art can make many changes and modifications without departing from the spirit and scope of the present application and the protection scope of the claims, and all changes and modifications that come within the meaning and range of equivalency of the claims are to be embraced within their scope.

Claims (8)

1. A data verification method based on a hash algorithm is characterized by comprising the following steps:
acquiring target file data;
carrying out binary conversion on the target file data to obtain original binary data; adding n-bit filling data at the tail of the original binary data to obtain complementary bit binary data; the bit number of the complementary bit binary data is an integral multiple of 512; equally dividing the complementary binary data into a plurality of groups of 512-bit sub-binary data; carrying out hash operation processing on each group of sub-binary data in sequence to generate a check hash value;
calling a reference hash value corresponding to the target file data;
if the check hash value is the same as the reference hash value, judging that the target file data is not tampered; if the check hash value is different from the reference hash value, the target file data is judged to be tampered;
the hash operation processing is sequentially carried out on each group of the sub-binary data to generate the check hash value, and the method comprises the following steps:
allocating 4 32-bit operational variables A1, A2, A3 and A4, and respectively initializing the operational variables A1, A2, A3 and A4;
sequentially performing cyclic operation on each group of sub-binary data by using initialized operational variables A1, A2, A3 and A4 and a preset cyclic algorithm to respectively obtain final values of the operational variables A1, A2, A3 and A4; concatenating the final values of the operational variables A1, A2, A3, A4 to generate the 128-bit check hash value; the cyclic algorithm comprises four rounds of operations, the first round of operations comprises 20 times of first assignment operations, and each time of the first assignment operations is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F1=(A2&A3)||(~A2&A4);
A1,A2,A3,A4<-(A4+F1+R 5 (A1)+W t +K t1 ),A1,R 30 (A1),A3;
the second round of operation has 20 second assignment operations, each second assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F2=A2⊕A3⊕A4;
A1,A2,A3,A4<-(A4+F2+R 5 (A1)+W t +K t2 ),A1,R 30 (A1),A3;
the third round of operation has 20 third assignment operations, each of which is:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F3=(A2&A3)||(A2&A4)||(A3&A4);
A1,A2,A3,A4<-(A4+F3+R 5 (A1)+W t +K t3 ),A1,R 30 (A1),A3;
the fourth round of operation has 20 times of fourth assignment operation, and each time of the fourth assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F4=(A2 NAND A3)⊕A4;
A1,A2,A3,A4<-(A4+F4+R 5 (A1)+W t +K t4 ),A1,R 30 (A2),A3;
wherein, W t Representing a 32-bit word to be processed in the t-th sub-binary data; r k (A1) Indicating that the loop variable A1 is shifted to the left by k bits, R k (A2) Indicating that the loop variable A2 is shifted to the left by k bits; k t1 、K t2 、K t3 、K t4 Represents 4 different constants for addition; "+" is modulo 2 32 An addition operator; "&"is bitwise and operator; "| |" is bitwise or operator; "to" is the operator of bit-wise negation; [ ] C ] is a bitwise XOR operator; "NAND" is bitwiseA NAND operator; "< -" indicates an assignment operation.
2. The hash-algorithm-based data verification method according to claim 1,
the format of the padding data is as follows: a start flag field + an invalid field + a digit record field;
the start flag field is used for identifying the position of the padding data in the complementary binary data;
the invalid field is an invalid bit of the padding data; the invalid field is filled with logic 0;
the bit number recording field is used for recording the original bit number of the binary data.
3. The hash-algorithm-based data verification method according to claim 2,
the expression of n is as follows:
Figure FDA0004000309890000021
c=a%512
wherein, a represents the original digit of the original binary data, d is the sum of the digits of the initial mark field and the digit record field,% is the operator of remainder, a and d are positive integers respectively.
4. The hash-algorithm-based data verification method according to any one of claims 1 to 3,
the initial value of the operational variable A1 is 0x67452301, the initial value of the operational variable A2 is 0 xefclab 89, the initial value of the operational variable A3 is 0x98badcfe, and the initial value of the operational variable A4 is 0x10325476.
5. The hash-algorithm-based data verification method according to claim 1,
before the acquiring target file data, the method further comprises:
receiving original target file data transmitted by a data provider, and acquiring a timestamp when the original target file data is received;
performing hash operation on the original target file data by adopting a hash algorithm to obtain the reference hash value;
generating a signature file corresponding to the original target file data and the timestamp; the signature file comprises a digital signature, a file identifier and the timestamp;
and transmitting the signature file and the timestamp back to a data provider, and storing the reference hash value and the signature file in an associated manner.
6. A data verification device based on a hash algorithm is characterized by comprising:
the acquisition module is used for acquiring target file data;
the processing module is used for carrying out binary conversion on the target file data acquired by the acquisition module to obtain original binary data; adding n-bit filling data at the tail of the original binary data to obtain complementary bit binary data; the bit number of the complementary bit binary data is an integer multiple of 512; equally dividing the complementary binary data into a plurality of groups of 512-bit sub-binary data; carrying out Hash operation processing on each group of sub-binary data in sequence to generate a check Hash value; calling a reference hash value corresponding to the target file data; if the check hash value is the same as the reference hash value, judging that the target file data is not tampered; if the check hash value is different from the reference hash value, the target file data is judged to be tampered;
the sequentially performing hash operation processing on each group of the sub-binary data to generate the check hash value includes:
allocating 4 32-bit operational variables A1, A2, A3 and A4, and respectively initializing the operational variables A1, A2, A3 and A4; sequentially performing cyclic operation on each group of sub-binary data by using initialized operational variables A1, A2, A3 and A4 and a preset cyclic algorithm to respectively obtain final values of the operational variables A1, A2, A3 and A4; concatenating the final values of the operational variables A1, A2, A3, A4 to generate the 128-bit check hash value; the cyclic algorithm comprises four rounds of operations, the first round of operations comprises 20 times of first assignment operations, and each time of the first assignment operations is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F1=(A2&A3)||(~A2&A4);
A1,A2,A3,A4<-(A4+F1+R 5 (A1)+W t +K t1 ),A1,R 30 (A1),A3;
the second round of operation has 20 second assignment operations, and each second assignment operation is as follows:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F2=A2⊕A3⊕A4;
A1,A2,A3,A4<-(A4+F2+R 5 (A1)+W t +K t2 ),A1,R 30 (A1),A3;
the third round of operation has 20 third assignment operations, each of which is:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F3=(A2&A3)||(A2&A4)||(A3&A4);
A1,A2,A3,A4<-(A4+F3+R 5 (A1)+W t +K t3 ),A1,R 30 (A1),A3;
the fourth round of operation has 20 fourth assignment operations, each fourth assignment operation is:
A1=A2+A3;A2=A3+A4;A3=A4+A1;A4=A1+A2;
F4=(A2 NAND A3)⊕A4;
A1,A2,A3,A4<-(A4+F4+R 5 (A1)+W t +K t4 ),A1,R 30 (A2),A3;
wherein, W t Representing a 32-bit word to be processed in the t-th sub-binary data; r k (A1) Indicating that the loop variable A1 is shifted to the left by k bits, R k (A2) Indicates that the loop variable A2 is loopedShifting the left by k bits; k is t1 、K t2 、K t3 、K t4 4 different constants for addition are represented; "+" is modulo 2 32 An addition operator; "&"bitwise and operator; "| |" is bitwise or operator; "to" is the operator of bit-wise negation; [ ] C ] is a bitwise XOR operator; "NAND" is a bitwise NAND operator; "< -" indicates an assignment operation.
7. A computer device comprising an input-output unit, a memory and a processor, the memory having stored therein computer-readable instructions which, when executed by the processor, cause the processor to carry out the steps in the hash algorithm based data verification method according to any one of claims 1 to 5.
8. A storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps in the hash algorithm based data verification method of any one of claims 1 to 5.
CN201910635310.3A 2019-07-15 2019-07-15 Data verification method, device, equipment and storage medium based on Hash algorithm Active CN110503434B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910635310.3A CN110503434B (en) 2019-07-15 2019-07-15 Data verification method, device, equipment and storage medium based on Hash algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910635310.3A CN110503434B (en) 2019-07-15 2019-07-15 Data verification method, device, equipment and storage medium based on Hash algorithm

Publications (2)

Publication Number Publication Date
CN110503434A CN110503434A (en) 2019-11-26
CN110503434B true CN110503434B (en) 2023-04-07

Family

ID=68586127

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910635310.3A Active CN110503434B (en) 2019-07-15 2019-07-15 Data verification method, device, equipment and storage medium based on Hash algorithm

Country Status (1)

Country Link
CN (1) CN110503434B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125781B (en) * 2019-12-24 2020-12-01 腾讯科技(深圳)有限公司 File signature method and device and file signature verification method and device
CN111737534B (en) * 2020-06-19 2024-04-09 北京百度网讯科技有限公司 File processing method, device and equipment
CN111885125A (en) * 2020-07-07 2020-11-03 普华云创科技(北京)有限公司 Data transmission method, system and computer readable storage medium for end-to-end network
WO2022120572A1 (en) * 2020-12-08 2022-06-16 深圳欣锐科技股份有限公司 Tamper verification method and apparatus
CN114579954B (en) * 2021-08-26 2023-03-24 华为技术有限公司 Method for safely starting verification and electronic equipment
CN113873482A (en) * 2021-08-27 2021-12-31 青岛中科英泰商用系统股份有限公司 Method, system, equipment and medium for testing compatibility of Android system to Bluetooth module
CN114124357B (en) * 2021-11-24 2024-01-30 中国银行股份有限公司 Ciphertext generation method, server, medium and device based on Fourier series
CN114579521B (en) * 2022-05-05 2022-08-05 深圳市元芯信息科技有限公司 Electronic data evidence storing method, system, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101872338A (en) * 2010-06-04 2010-10-27 杭州电子科技大学 Modified SHA-1 hash algorithm
CN107608769A (en) * 2017-09-13 2018-01-19 郑州云海信息技术有限公司 A kind of data processing method and device
CN107871063A (en) * 2017-11-16 2018-04-03 王磊 Anti-tamper video and audio recording digital signature method, device and storage medium
CN109064120A (en) * 2018-07-10 2018-12-21 马上游科技股份有限公司 Tourism electric contract number deposit system based on region chain and deposit card method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10554753B2 (en) * 2017-07-06 2020-02-04 Acronis International Gmbh System and method for service level agreement based data storage and verification

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101872338A (en) * 2010-06-04 2010-10-27 杭州电子科技大学 Modified SHA-1 hash algorithm
CN107608769A (en) * 2017-09-13 2018-01-19 郑州云海信息技术有限公司 A kind of data processing method and device
CN107871063A (en) * 2017-11-16 2018-04-03 王磊 Anti-tamper video and audio recording digital signature method, device and storage medium
CN109064120A (en) * 2018-07-10 2018-12-21 马上游科技股份有限公司 Tourism electric contract number deposit system based on region chain and deposit card method

Also Published As

Publication number Publication date
CN110503434A (en) 2019-11-26

Similar Documents

Publication Publication Date Title
CN110503434B (en) Data verification method, device, equipment and storage medium based on Hash algorithm
US11544487B2 (en) Large data transfer using visual codes with feedback confirmation
US11263415B2 (en) Transferring data files using a series of visual codes
CN111859348B (en) Identity authentication method and device based on user identification module and block chain technology
CN107342867B (en) Signature verification method and device
CN109741056B (en) Method and device for uploading electronic certificate
CN111628868A (en) Digital signature generation method and device, computer equipment and storage medium
US11227037B2 (en) Computer system, verification method of confidential information, and computer
CN109493054B (en) Multi-chain information management method, device, storage medium and block chain identity analyzer
US11568085B2 (en) Systems and methods for tokenization to support pseudonymization of sensitive data
CN114329527A (en) Intersection data acquisition method, equipment and system
US20210334809A1 (en) Transaction method and apparatus based on blind signature
CN112118100B (en) Improved linkable ring signature method, verification method, device, electronic apparatus and medium
CN110598433A (en) Anti-counterfeiting information processing method and device based on block chain
CN114640463B (en) Digital signature method, computer equipment and medium
CN115118433A (en) Client authorization method and device, privacy protection set intersection calculation method and device
CN111641604B (en) Signing method based on online banking certificate and signing system based on online banking certificate
CN111539728B (en) Method for realizing anonymization identity verification based on computer software
CN113987446A (en) Authentication method and device
CN111681141B (en) File authentication method, file authentication device and terminal equipment
CN116049841B (en) Encryption method, device, equipment and medium for identity card number
CN115344893B (en) Transaction method, device and equipment based on character feature recognition
US20220385479A1 (en) Multi-message multi-user signature aggregation
US20220391327A1 (en) Methods for enrolling data in order to verify the authenticity of a security datum or for verifying the authenticity of a security datum
CN116074012A (en) Message digest generation method, device, computer equipment and storage medium

Legal Events

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