CN102790660A - Data checking method and data checking device - Google Patents

Data checking method and data checking device Download PDF

Info

Publication number
CN102790660A
CN102790660A CN2012103228152A CN201210322815A CN102790660A CN 102790660 A CN102790660 A CN 102790660A CN 2012103228152 A CN2012103228152 A CN 2012103228152A CN 201210322815 A CN201210322815 A CN 201210322815A CN 102790660 A CN102790660 A CN 102790660A
Authority
CN
China
Prior art keywords
check code
data
arabic numerals
length
original text
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2012103228152A
Other languages
Chinese (zh)
Inventor
吴俊杰
王伟江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NANJING TIANSU AUTOMATION CONTROL SYSTEM CO Ltd
Original Assignee
NANJING TIANSU AUTOMATION CONTROL SYSTEM 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 NANJING TIANSU AUTOMATION CONTROL SYSTEM CO Ltd filed Critical NANJING TIANSU AUTOMATION CONTROL SYSTEM CO Ltd
Priority to CN2012103228152A priority Critical patent/CN102790660A/en
Publication of CN102790660A publication Critical patent/CN102790660A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a data checking method and a data checking device. The data checking method includes a check code generation step. The check code generation step includes: obtaining a message digest of data by performing MD5 (message-digest algorithm 5) for the data; then, placing Arabic numerals in the message digest into a queue with the maximum length of n; and finally, judging whether the queue with the maximum length of n is filled to the full or not, taking the content in the queue as a check code if the queue with the maximum length of n is filled to the full, otherwise, combining the data and the message digest to new data, and repeating the steps again. Compared with a common checking method, the data checking method is higher in safety, can be widely applied to various fields and is particularly applicable to checking of short messages or identification.

Description

The method and apparatus of data check
Technical field
The present invention relates to the communication technology, particularly the credible checking of data validity.
Background technology
Data check is one of basis of the communication technology.The method of data check is also a lot, such as exclusive or check, and CRC check.But these methods of calibration are under some needs higher security fields, and seeming is not very suitable, such as sign checkings such as the verification of identity card, the verifications of commodity sequence code.A kind of to have the high security verification be to adopt one-way hash function that former sign computing is obtained informative abstract, and informative abstract can be used as the check code of this sign, but the sign length that obtains like this is oversize.The informative abstract length that obtains such as the message digest algorithm of MD5 is 512 bits, and what represent with 16 systems is the content of 32 bytes.On the other hand, in the ID checking, need identifying code be met the form of sign, and sign is made up of Arabic numerals usually, representes that with the Arabic numerals of 10 systems 512 informative abstract is obviously longer.
Summary of the invention
Problem to be solved by this invention: sign verification.
For solving the special case of sign verification, the scheme that the present invention solves is following:
A kind of data verification method may further comprise the steps:
E1: obtain original text S;
E2: check code generates step, and S is obtained C with the MD5 computing, from C, chooses the check code U of Arabic numerals as S again.
In the above-mentioned process, original text S and the check code U that obtains are made up the data content P that the back just can obtain the tape verifying sign indicating number.Corresponding, the data content of tape verifying sign indicating number is carried out validation verification, can adopt identical method:
P is split into original text S and check code V;
The computing of original text being done above-mentioned E2 step obtains verification U;
Then check code V and check code U are done comparison, if both are identical, then data are effective, otherwise data are invalid.
Just, during data validation, as long as outside above-mentioned steps E1 and E2, increase:
E3: obtain check code V;
E4: the check code comparison step, check code U that comparison step E2 obtains and check code V, if both are identical, then data are effective, otherwise invalid.
Because a lot of signs have length restriction, thereby check code also has length restriction, and check code generates step and further comprises thus:
E21: S is obtained C with the MD5 computing;
E22: from C, select Arabic numerals to put into formation A;
E23: if the full n of formation A length, then length is that the Arabic numerals of n are the check code U of S among the formation A, otherwise changes E24;
E24: merge S and C and generate new S, change E21.
Length n in the above-mentioned step is generally 4 to 8.Wherein C is the character string of 32 bytes of character string of representing of 16 systems, wherein such as comprising Arabic numerals, can comprise 20 Arabic numerals in the 16 system character strings of average in theory one 32 byte length.Thereby 4-8 Arabic numerals generally can disposablely obtain, but unusual situation also possibly occur, so a cyclic process is arranged.
Technique effect of the present invention:
1, the check code generative process can be regarded as a kind of distortion of a kind of one-way hash function MD5, and the check code that obtains can be used as consistency checking;
2, the check code of the present invention's generation all is Arabic numerals, the validation verification that is specially adapted to identify;
3, check code has suitable length, and the MD5 message digest algorithm is the international algorithm of comparative maturity, thereby also the present invention has certain fail safe.
Description of drawings
Fig. 1 is modular structure sketch map of the present invention and application.
Fig. 2 is regular length check code product process figure of the present invention.
Fig. 3 adds the regular length check code product process figure behind the private data for the present invention.
Embodiment
Below in conjunction with accompanying drawing the present invention is elaborated.
Fig. 1 has provided general application of the present invention, and is as shown in Figure 1, divides transmit leg and recipient.Transmit leg generates check code to original data processing, then data and check code is together sent to the recipient.After the recipient receives data and check code, data are carried out a check code again generate, whether the check code that relatively generates then is identical with the check code that receives.If both check codes are inequality, the recipient has reason to believe that data have occurred wrong or transmit leg is fly-by-night in transmission.
Transmit leg includes three modules, is respectively: input module, check code generation module, check code data combination module.Input module is used to receive initial data, also may do further processed to initial data, for example, initial data is carried out the Base64 computing or initial data is changed into Arabic numerals.Data original text through input module generates check code in the check code generation module, the original text that then combination of the check code that obtains and data original text is obtained being used to transmit and the data splitting bag of check code.In the check code generation module data original text is done the MD5 computing, in the informative abstract that obtains, select numeral then as check code.
The recipient comprises four modules, is respectively: receiver module, the check code data split module, check code generation module, check code comparison module.Receiver module is used to receive the packet from transmit leg.In the application of reality, the transmission of packet has variety of way, possibly be through network, memory or people.During for example sign is used, can above-mentioned verification code generating method be applied in the generation of identification number, so individual's ID card No. is made up of two parts, a part is the number that is used to identify personal identification, and a part is a check code.Identification card number can be by hand through the keyboard input, and under this situation, above-mentioned receiver module is exactly the keyboard input module of identification card number.The check code data split module, are used for data message and check code are separated, and the method for separating can be in advance according to rule definition, and in existing 18 ID card No., preceding 17 is data message, and last 1 is check code.The check code generation module is identical with the check code generation module of transmit leg.For the recipient, receiver module and check code data split the input module that module constitutes the check code generation module.Obtain check code and above-mentioned check code data in the check code generation module and split the check code that obtains in the module and be admitted at last in the check code comparison module and contrast, thereby the recipient draws whether effective or believable conclusion of the packet that receives.This shows that interpolation checking procedure and data check process are basic identical.
Check code generates and mainly comprises two steps: the generation of informative abstract; In informative abstract, select Arabic numerals.Informative abstract can obtain through one-way hash function.As everyone knows, such one-way hash function has MD5, SHA-1, Haval scheduling algorithm.What adopt among the present invention is the MD5 algorithm.The MD5 algorithm obtains is 512 information, representes with 16 systems, can obtain 32 length, 16 system character strings.For example, MD5 (" Hello ")=8B1A9953C4611296A827ABF8C47804D7.Generally all can include numeral in the informative abstract of 32 length of representing with 16 systems; On average; Informative abstract includes the Arabic numerals of 20 characters, and the Arabic numerals that obtain among the for example above-mentioned MD5 (" Hello ") are " 81995346112968278478047 ".Among the present invention with the check code of these Arabic numerals as data.
In a lot of signs were used, the length of sign was fixed, and check code length is also fixed, and for example the length of existing identification number is 18, and check code length is 1.And the number of the Arabic numerals that above-mentioned informative abstract obtains is unfixed.Can do a length restriction for this reason, such as 8 Arabic numerals as check code.Get preceding 8 Arabic numerals among the MD5 (" Hello ") and promptly obtain " 81995346 "; " 81995346 " are promptly as " Hello " check code; If restriction check code length is 4; Then can get preceding 4 Arabic numerals as check code, for example aforesaid MD5 (" Hello ") gets " 8199 " as check code.Although the Arabic numerals quantity in the MD5 informative abstract is enough usually, do not get rid of the situation of some exception, i.e. not enough 8 Arabic numerals in the 16 system character strings of 32 length yet.Under this situation, obtain enough Arabic numerals with this through iterative computation.
As shown in Figure 2, be the flow chart of regular length check code iterative computation of the present invention.Comprise:
Informative abstract generates: original text S is obtained informative abstract C with the MD5 computing;
Select numeral to get into formation: from informative abstract C, to select Arabic numerals to put into formation A;
Judge queue length: if the full n of formation A length, then length is that the Arabic numerals of n are the check code U of original text S among the formation A, generates new original text otherwise merge original text S with informative abstract C, the generation of transfering the letter breath summary.
Can find out that by flow chart the original text S that informative abstract generates in the step might not be the original text that obtains in the input unit, also possibly be the original text S that obtains after original text and informative abstract merge.The length of formation A can be fixed, and also can be on-fixed.Under the situation of fixing maximum length, fixedly maximum length can be set to n in advance, then when judging whether formation A length expires n, is equal to and judges whether completely formation A.If queue length is variable, when then selecting numeral to get into formation, the length that obtains formation A maybe be greater than n, and at this moment, preceding n numeral can selecting formation A is as check code.What n represented here is the regular length of check code, can select 4-8.
By said process, those skilled in the art can know that the check code generative process of transmit leg is fixed, and the adulterator can adopt the data of same method construct forgery and the check code of data falsification.For this reason, can in the step before informative abstract generates, add private data.Its process is as shown in Figure 3, and this section private data is a key, has only transmit leg and recipient just can obtain.Owing to the non repudiation of MD5 algorithm, the adulterator can't forge check code, thereby can't data falsification like this.

Claims (10)

1. a data verification method is characterized in that, may further comprise the steps:
E1: obtain original text S;
E2: check code generates step, and S is obtained C with the MD5 computing, from C, chooses the check code U of Arabic numerals as S again.
2. data verification method as claimed in claim 1 is characterized in that, described step e 2 comprises:
E21: S is obtained C with the MD5 computing;
E22: from C, select Arabic numerals to put into formation A;
E23: if the full n of formation A length, then length is that the Arabic numerals of n are the check code U of S among the formation A, otherwise changes E24;
E24: merge S and C and generate new S, change E21.
3. data verification method as claimed in claim 2 is characterized in that, described length n is 4-8.
4. like claim 1 or 2 or 3 described data verification methods, it is characterized in that, further comprising the steps of:
E3: obtain check code V;
E4: the check code comparison step, check code U that comparison step E2 obtains and check code V, if both are identical, then data are effective, otherwise invalid.
5. like claim 1 or 2 or 3 described data verification methods, it is characterized in that described step e 1 also comprises:
Behind original text S, add private data.
6. a digital data verification calibration equipment is characterized in that, comprising:
Obtain the device of original text;
Check code generation apparatus through computing obtains the summary of original text to original text MD5, is chosen Arabic numerals as check code again from summary.
7. data calibration device as claimed in claim 6 is characterized in that, described check code generation apparatus comprises:
Through data are carried out the informative abstract that the MD5 computing obtains data;
Arabic numerals in the informative abstract are put into formation;
Be used to judge whether queue length expires n, if fill up, then preceding n Arabic numerals in the formation merge device as check code otherwise get into data;
Data and informative abstract are merged into new data, put into the summary generating apparatus.
8. data calibration device as claimed in claim 7 is characterized in that, described length n is 4-8.
9. like claim 6 or 7 or 8 described data calibration devices, it is characterized in that, also comprise:
Obtain contrast check code device;
Comparison means compares according to check code that obtains in the check code generation apparatus and the check code that obtains contrast check code device, if both are identical, it is effective then to explain data, otherwise the expression data are invalid.
10. like claim 6 or 7 or 8 described data calibration devices, it is characterized in that the device that obtains original text includes the private data adding set.
CN2012103228152A 2012-09-04 2012-09-04 Data checking method and data checking device Pending CN102790660A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012103228152A CN102790660A (en) 2012-09-04 2012-09-04 Data checking method and data checking device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012103228152A CN102790660A (en) 2012-09-04 2012-09-04 Data checking method and data checking device

Publications (1)

Publication Number Publication Date
CN102790660A true CN102790660A (en) 2012-11-21

Family

ID=47155968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012103228152A Pending CN102790660A (en) 2012-09-04 2012-09-04 Data checking method and data checking device

Country Status (1)

Country Link
CN (1) CN102790660A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102970145A (en) * 2012-12-21 2013-03-13 飞天诚信科技股份有限公司 Signature method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1653751A (en) * 2002-03-13 2005-08-10 比姆托拉斯股份有限公司 A method of processing an electronic payment cheque
US20090022307A1 (en) * 2007-07-20 2009-01-22 Freescale Semiconductor, Inc. Systems and methods for efficient generation of hash values of varying bit widths
CN101409622A (en) * 2008-11-26 2009-04-15 北京飞天诚信科技有限公司 Digital signing system and method
CN101902477A (en) * 2010-07-26 2010-12-01 北京邦天信息技术有限公司 Transmitting system, receiving system and media stream identification method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1653751A (en) * 2002-03-13 2005-08-10 比姆托拉斯股份有限公司 A method of processing an electronic payment cheque
US20090022307A1 (en) * 2007-07-20 2009-01-22 Freescale Semiconductor, Inc. Systems and methods for efficient generation of hash values of varying bit widths
CN101409622A (en) * 2008-11-26 2009-04-15 北京飞天诚信科技有限公司 Digital signing system and method
CN101902477A (en) * 2010-07-26 2010-12-01 北京邦天信息技术有限公司 Transmitting system, receiving system and media stream identification method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102970145A (en) * 2012-12-21 2013-03-13 飞天诚信科技股份有限公司 Signature method and device
CN102970145B (en) * 2012-12-21 2015-01-14 飞天诚信科技股份有限公司 Signature method and device

Similar Documents

Publication Publication Date Title
US11240042B2 (en) Merkle signature scheme tree expansion
US10237074B2 (en) Redactable document signatures
JPH06315027A (en) Method and equipment for data authentication in data communication environment
CN105515778B (en) Cloud storage data integrity services signatures method
US11575515B2 (en) Post-quantum secure remote attestation for autonomous systems
CN107864037A (en) SM9 Combination with Digital endorsement method and device
CN106027228A (en) Encryption and decryption methods and encryption and decryption systems for webpage identification
CN104080059A (en) Method, device and system of implementing short message sending and receiving
CN106961329A (en) A kind of solution for being directed to ADS B agreements confidentiality and integrality
CN107968696A (en) A kind of method and apparatus in UE for variable check bit number, base station
CN106452790A (en) Multi-party quantum digital signature method without trusted center
CN114124502A (en) Message transmission method, device, equipment and medium
CN104601563A (en) MLE-based (message-locked encryption-based) publicly accessible cloud storage data procession checking method
CN114051006A (en) Data transmission method, data transmission device, computer equipment and storage medium
US20160156610A1 (en) Message Pushing System And Method
CN109191149A (en) A kind of commodity digital identity generation method based on block chain
CN113517982B (en) Password generation method, password execution method and terminal
CN102790660A (en) Data checking method and data checking device
CN116664123A (en) Digital wallet design method based on blockchain technology
CN114398651A (en) Secret data sharing method and distributed system
CN110336678B (en) Signature algorithm for preventing falsification of mass data in Internet of vehicles
CN105338004B (en) The applicable public audit method with secret protection of low-performance equipment under cloud environment
Dang SP 800-106. Randomized Hashing for Digital Signatures
CN105591751A (en) Off-line verifying device and method
CN106130718B (en) A kind of the signed data generation method and verification method of digital record

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20121121