CN109460807A - Generation method, recognition methods, generating means and the identification device of two dimensional code - Google Patents
Generation method, recognition methods, generating means and the identification device of two dimensional code Download PDFInfo
- Publication number
- CN109460807A CN109460807A CN201910025547.XA CN201910025547A CN109460807A CN 109460807 A CN109460807 A CN 109460807A CN 201910025547 A CN201910025547 A CN 201910025547A CN 109460807 A CN109460807 A CN 109460807A
- Authority
- CN
- China
- Prior art keywords
- information
- encrypted
- text
- dimensional code
- sequence
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000010586 diagram Methods 0.000 description 8
- 238000013478 data encryption standard Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000003860 storage Methods 0.000 description 4
- 238000012360 testing method Methods 0.000 description 4
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 238000007639 printing Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 2
- 238000000926 separation method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K19/00—Record carriers for use with machines and with at least a part designed to carry digital markings
- G06K19/06—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
- G06K19/06009—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
- G06K19/06037—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
Abstract
The present invention provides generation method, recognition methods, generating means and the identification device of a kind of two dimensional code, it is related to two-dimension code anti-counterfeit technical field, the generation method of the two dimensional code includes: to obtain ciphering sequence according to random sequence number and check bit, then ciphering sequence and predetermined encryption text information are encrypted respectively, obtain encrypted ciphering sequence and encrypted ciphertext information, finally according to encrypted ciphering sequence, encrypted ciphertext information, variable information text and separator, the corresponding two dimensional code of variable information text is generated.Due to being encrypted respectively by preset Encryption Algorithm to ciphering sequence and predetermined encryption text information first, improve the complexity that information loaded encrypts in two dimensional code, therefore the two dimensional code generated based on encrypted ciphering sequence, encrypted ciphertext information, variable information text and separator is not easy to be replicated and be decoded, so as to avoid two dimensional code that the safety problems such as information leakage occur by malicious exploitation.
Description
Technical field
The present invention relates to two-dimension code anti-counterfeit technical fields, generation method, identification side in particular to a kind of two dimensional code
Method, generating means and identification device.
Background technique
The characteristics of two dimensional code can be stored information abundant and be easily moved terminal recognition due to its own, has been widely applied
In multiple fields such as logistics, supermarket and printings, and gradually by the attention of all trades and professions.
Two dimensional code is that certain specific geometric figure comes in the chequered with black and white figure of two-dimensional surface distribution according to certain rules
Record information.Two dimensional code is the carrier of information and the important method and means of information collection, propagation.But due to existing
Two dimensional code do not have the function of secrecy, contained information is easy to be replicated and decode, so as to cause the safety such as information leakage
Problem.
Summary of the invention
It is an object of the present invention in view of the deficiency of the prior art, provide a kind of generation method of two dimensional code, know
Other method, generating means and identification device, to be encrypted to information recorded in two dimensional code, in case two dimensional code is by malice benefit
With safety problems such as caused information leakages.
To achieve the above object, technical solution used in the embodiment of the present invention is as follows:
In a first aspect, the embodiment of the invention provides a kind of generation methods of two dimensional code, comprising: according to random sequence number with
Check bit obtains ciphering sequence;The ciphering sequence is encrypted using the first preset algorithm and is encrypted using the second preset algorithm pre-
If ciphertext information, encrypted ciphering sequence and encrypted ciphertext information are obtained respectively;After the encryption
Ciphering sequence, the encrypted ciphertext information, variable information text and separator, generate variable information text
This corresponding two dimensional code, wherein the separator is for separating the encrypted ciphering sequence and the encrypted encryption
Text information.
Optionally, described that ciphering sequence is obtained according to random sequence number and check bit, comprising: to generate the random sequence
Number;According to the random sequence number and third preset algorithm, calculates and obtain the check bit;It will be described in check bit insertion
Random sequence number obtains the ciphering sequence.
Optionally, described according to the encrypted ciphering sequence, the encrypted ciphertext information, variable information
Text and separator generate the corresponding two dimensional code of the variable information text, comprising: the separator is added to described add
Between ciphering sequence, the encrypted ciphertext information after close, encryption data is generated;According to the encryption data and institute
Variable information text is stated, the corresponding two dimensional code of the variable information text is generated.
Optionally, described that predetermined encryption text information is encrypted using the second preset algorithm, comprising: obtaining includes n bit digital
Encryption factor, wherein n is integer greater than 2;The encryption factor is substituted into second preset algorithm, to described default
Ciphertext information is encrypted.
Optionally, the predetermined encryption text information includes following one or more: date information, product batches information,
Enterprise's identification information, product identification information.
Second aspect, the embodiment of the invention also provides a kind of recognition methods of two dimensional code, comprising: reads variable information text
This corresponding two dimensional code obtains the variable information text and encrypted ciphering sequence, encrypted ciphertext letter
Breath, separator, wherein the separator is believed for separating the encrypted ciphering sequence and the encrypted ciphertext
Breath;Compare the variable information text of reading and the variable information text prestored;If the variable information text with it is described pre-
The variable information text deposited is consistent, then it is corresponding original to obtain the encrypted ciphering sequence using default decryption key decryption
Ciphering sequence and the corresponding original encryption text information of the encrypted ciphertext information;If successful decryption is distinguished
Compare the original encryption sequence and prestores whether consistent ciphering sequence, the original encryption text information and prestore ciphertext
Whether information is consistent;If the original encryption sequence prestores ciphering sequence, the original encryption text information and prestores with described
Ciphertext information is consistent, then identifies that the two dimensional code is true two dimensional code.
The third aspect, the embodiment of the invention also provides a kind of generating means of two dimensional code, comprising: obtains module, is used for
Ciphering sequence is obtained according to random sequence number and check bit;Encrypting module, for encrypting the encryption using the first preset algorithm
Sequence simultaneously encrypts predetermined encryption text information using the second preset algorithm, after obtaining encrypted ciphering sequence and encryption respectively
Ciphertext information;Generation module, for being believed according to the encrypted ciphering sequence, the encrypted ciphertext
Breath, variable information text and separator, generate the corresponding two dimensional code of the variable information text, wherein the separator is used
In the separation encrypted ciphering sequence and the encrypted ciphertext information.
Optionally, the acquisition module includes: the first generation submodule, for generating the random sequence number;Calculate son
Module, for calculating and obtaining the check bit according to the random sequence number and third preset algorithm;It is inserted into submodule, is used
In the check bit is inserted into the random sequence number, the ciphering sequence is obtained.
Optionally, the generation module includes: addition submodule, described encrypted for the separator to be added to
Between ciphering sequence, the encrypted ciphertext information, encryption data is generated;Second generates submodule, for according to institute
Encryption data and the variable information text are stated, the corresponding two dimensional code of the variable information text is generated.
Fourth aspect, the embodiment of the invention also provides a kind of identification devices of two dimensional code, comprising: read module is used for
The corresponding two dimensional code of variable information text is read, after obtaining the variable information text and encrypted ciphering sequence, encryption
Ciphertext information, separator, wherein after the separator is for separating the encrypted ciphering sequence and the encryption
Ciphertext information;First comparison module, the variable information text and the variable information prestored text for comparing reading
This;Deciphering module, if consistent with the variable information text prestored for the variable information text, using default decryption
Key decryption obtains the corresponding original encryption sequence of the encrypted ciphering sequence and the encrypted ciphertext letter
Cease corresponding original encryption text information;Second comparison module is respectively compared the original encryption sequence if being used for successful decryption
Arrange and prestore whether ciphering sequence consistent, the original encryption text information with whether prestore ciphertext information consistent;Identification
Module, if for the original encryption sequence and described prestoring ciphering sequence, the original encryption text information and prestoring encryption
Text information is consistent, then identifies that the two dimensional code is true two dimensional code.
The beneficial effects of the present invention are: in the generation method of two dimensional code provided by the invention, according to random sequence number and school
It tests position and obtains ciphering sequence, then ciphering sequence and predetermined encryption text information are encrypted respectively using Encryption Algorithm, obtained
Take encrypted ciphering sequence and encrypted ciphertext information, finally according to encrypted ciphering sequence, it is encrypted plus
Close text information, variable information text and separator generate the corresponding two dimensional code of variable information text.Pass through preset encryption
Algorithm encrypts ciphering sequence and predetermined encryption text information, improves the complexity that information loaded encrypts in two dimensional code,
Therefore two generated based on encrypted ciphering sequence, encrypted ciphertext information, variable information text and separator
Dimension code is not easy to be replicated and decode, so as to avoid two dimensional code that the safety problems such as information leakage occur by malicious exploitation.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached
Figure is briefly described, it should be understood that the following drawings illustrates only certain embodiments of the present invention, therefore is not construed as pair
The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this
A little attached drawings obtain other relevant attached drawings.
Fig. 1 is a kind of flow chart of the generation method of two dimensional code provided in an embodiment of the present invention;
Fig. 2 is the flow chart of the generation method of another two dimensional code provided in an embodiment of the present invention;
Fig. 3 is a kind of flow chart of the recognition methods of two dimensional code provided in an embodiment of the present invention;
Fig. 4 is a kind of module diagram of the generating means of two dimensional code provided in an embodiment of the present invention;
Fig. 5 is the module diagram of the generating means of another two dimensional code provided in an embodiment of the present invention;
Fig. 6 is the module diagram of the generating means of another two dimensional code provided in an embodiment of the present invention;
A kind of Fig. 7 module diagram of the identification device of two dimensional code provided in an embodiment of the present invention;
Fig. 8 is the schematic diagram of the generating means of another two dimensional code provided in an embodiment of the present invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.
A kind of generation method of two dimensional code provided in an embodiment of the present invention, can be applied to terminal device or server.
Fig. 1 is please referred to, is a kind of flow chart of the generation method of two dimensional code provided in an embodiment of the present invention.Include:
Step S101 obtains ciphering sequence according to random sequence number and check bit.
In order to avoid by malicious exploitation the safety problems such as information leakage occur for two dimensional code, need to information loaded in two dimensional code
It is encrypted, therefore, during generating two dimensional code, ciphering sequence can be obtained according to random sequence number and check bit, into
And it can be encrypted to by random sequence number and the ciphering sequence that check bit forms.
Wherein, random sequence number can be a series of Serial No. generated at random, in embodiments of the present invention, at random
Sequence number can be continuous sequence number, such as can be with are as follows: 00000001,00000002,00000003,00000004 ...
Deng.
In addition, random sequence number can be generated by code generator, certainly, in practical applications, it can also be passed through
His mode generates random sequence number, for example user can generate random sequence number by editing procedure.
Check bit is to calculate the one-bit digital obtained by other data, and in embodiments of the present invention, check bit is
The one-bit digital obtained is calculated by random sequence number.
Step S102 encrypts predetermined encryption using the first preset algorithm encrypting sequence and using the second preset algorithm
Text information obtains encrypted ciphering sequence and encrypted ciphertext information respectively.
In order to further increase the complexity encrypted to information loaded in two dimensional code, to avoid the occurrence of two dimensional code by malice
Using generation information leakage the problems such as, ciphering sequence and predetermined encryption text information can be encrypted respectively, the same to time-division
Encrypted ciphering sequence and encrypted ciphertext information are not obtained.
Wherein, the first preset algorithm is the Encryption Algorithm being previously set, and optionally, in embodiments of the present invention, first is pre-
Imputation method can be MD5 (Message-Digest Algorithm 5, Message-Digest Algorithm 5), it can using MD5 to adding
Close sequence is encrypted.Certainly, in practical applications, ciphering sequence can also be added using other kinds of Encryption Algorithm
It is close.
MD5 algorithm is one of widely applied hash algorithm of computer, also known as digest algorithm or hash algorithm, Ke Yiyong
In ensure information transmission it is complete with it is consistent.It is another fixed-length value that its principle, which is by number or text operation,.
For example, in embodiments of the present invention, when being encrypted to ciphering sequence, if random sequence number is 12345678 and school
When to test position be 0, i.e., when ciphering sequence is 123456780,16 MD5 small letter ciphertexts after using MD5 to convert for
Ffc99c565a6a9460 capitalizes ciphertext using 32 MD5 after the conversion of MD5 algorithm are as follows: 9AF763C0FFC99C565A6A9
460E1A2CA7E。
Second preset algorithm is that preset one kind can be to the Encryption Algorithm that predetermined encryption text information is encrypted.
For example, the second preset algorithm can be DES (Data Encrytion Standard, data encryption standards) algorithm.Wherein, DES
Algorithm is a kind of algorithm of DSE arithmetic, has high safety, and key is to use in DES algorithm for encryption decrypting process
Key, data be encrypting and decrypting data, mode is operating mode.When operating mode be encryption mode when, key for pair
Data encryption, when operating mode is decryption mode, key is used to decrypt data.
Predetermined encryption text information is the information of pre-determined certain company for needing to encrypt, for example, predetermined encryption text
Information can be * * * * Co., Ltd.
Step S103 according to encrypted ciphering sequence, encrypted ciphertext information, variable information text and divides
Every symbol, the corresponding two dimensional code of variable information text is generated, wherein after separator is for separating encrypted ciphering sequence and encryption
Ciphertext information.
Due to also needing to be loaded into batch number information, such as producing and selling and after-sale service in commodity in two dimensional code
The information such as manufacturer, the time of making the product of commodity can be loaded into journey in two dimensional code, therefore above- mentioned information can be saved as variable
Information text can be according to encrypted ciphering sequence, encryption after to encrypting respectively to ciphering sequence and ciphertext information
Ciphertext information, variable information text and separator afterwards generate the corresponding two dimensional code of variable information text.
Wherein, variable information can be batch number information, for example, variable information can be with are as follows: the quasi- mark 2018 of national tax sign section
No. 22 2018.12.26 of year.
Separator is the symbol for separating encrypted ciphering sequence and encrypted ciphertext information, for example, separator
Can be " ".
Specifically, system first can be generated based on two dimensional code and generates blank two dimensional code, which can be to encryption
Sequence, ciphertext information and variable information text are read out, and are generated containing ciphering sequence, ciphertext information and can
Become the two dimensional code of information text.
In the present embodiment, ciphering sequence is obtained according to random sequence number and check bit, it is then right respectively using Encryption Algorithm
Ciphering sequence and predetermined encryption text information are encrypted, and encrypted ciphering sequence and encrypted ciphertext letter are obtained
Breath generates finally according to encrypted ciphering sequence, encrypted ciphertext information, variable information text and separator
The corresponding two dimensional code of variable information text.Ciphering sequence and predetermined encryption text information are added by preset Encryption Algorithm
It is close, the complexity that information loaded encrypts in two dimensional code is improved, therefore based on encrypted ciphering sequence, encrypted encryption text
The two dimensional code that this information, variable information text and separator generate is not easy to be replicated and decode, so as to avoid two dimensional code
The safety problems such as information leakage are occurred by malicious exploitation.
It referring to figure 2., is the flow chart of the generation method of another two dimensional code provided in an embodiment of the present invention.Include:
Step S201 generates random sequence number.
Due to that can obtain ciphering sequence according to random sequence number and check bit, therefore, it is necessary to generate random sequence number.Its
In, the mode of random sequence number is generated, the associated description in aforementioned is may refer to, no longer repeats one by one herein.
Step S202 is calculated according to random sequence number and third preset algorithm and is obtained check bit.
In order to further increase the complexity of ciphering sequence, to improve the complexity encrypted to information loaded in two dimensional code
Property, it can calculate according to random sequence number and third preset algorithm and obtain check bit, i.e., by random sequence number and verification hyte
At ciphering sequence.
Third preset algorithm is a kind of mathematic(al) representation being previously set, and can be calculated random sequence number, is obtained
One bit check position.For example, third preset algorithm can be y=x2/ 13, wherein x indicates random sequence number, x can be substituted into number
Learn expression formula y=x2/ 13, check bit is used as by first of the remainder being calculated.
Certainly, in practical applications, check bit can also be determined by other means, for example, by using random letters as school
Test position etc..
Check bit is inserted into random sequence number, obtains ciphering sequence by step S203.
Since check bit can be obtained by calculate to random sequence number, check bit can be inserted into random
Sequence number obtains ciphering sequence, is then encrypted using the first preset algorithm to ciphering sequence, generates two dimensional code to improve
Safety.
Step S204 encrypts predetermined encryption using the first preset algorithm encrypting sequence and using the second preset algorithm
Text information obtains encrypted ciphering sequence and encrypted ciphertext information respectively.
Wherein, predetermined encryption text is encrypted using the first preset algorithm encrypting sequence and using the second preset algorithm
Information obtains the mode of encrypted ciphering sequence and encrypted ciphertext information respectively, may refer to the phase in aforementioned
Description is closed, is no longer repeated one by one herein.
Optionally, predetermined encryption text information is encrypted using the second preset algorithm, comprising: obtain adding comprising n bit digital
The close factor, wherein n is the integer greater than 2;Encryption factor is substituted into the second preset algorithm, predetermined encryption text information is carried out
Encryption.
It, therefore, can be with due to can freely set encryption factor and be encrypted with treating encryption information in ciphering process
The encryption factor comprising n bit digital is obtained, encryption factor is substituted into the second preset algorithm, predetermined encryption text information is added
It is close.
Optionally, encryption factor can be freely set as the encryption factor of 8 bit digitals.
Optionally, predetermined encryption text information includes following one or more: date information, product batches information, enterprise
Identification information, product identification information.
Since information contained in the two dimensional code of generation can be the relevant information of certain product of certain enterprise production, accordingly
Ground, predetermined encryption text information can be selected following one or more: date information, product batches information, enterprise's identification information,
Product identification information.
Wherein, date information is the date of production of product.Product batches information is the batch information of production.Enterprise's mark
Knowing information is the title with product producer.Product identification information is product quality for identification, feature and application method institute
The general designation for the various expressions done.
For example, in embodiments of the present invention, predetermined encryption text information can be with are as follows: * * * * Co., Ltd's X batch * * * *
* August * * days year was printed.
Separator is added between encrypted ciphering sequence, encrypted ciphertext information by step S205, is generated
Encryption data.
Since separator can separate encrypted ciphering sequence and encrypted ciphertext information, it can be with
Separator is added between encrypted ciphering sequence, encrypted ciphertext information, encryption data is generated.
For example, working as, ciphering sequence is 123456780 and ciphertext information is * * * * Co., Ltd's X batch * * * * * 8
When month * printing in * day, by separator " && " it is inserted into encryption data can be generated: 123456780&&**** Co., Ltd X
It criticizes * * * * * August * * days and prints.
Step S206 generates the corresponding two dimensional code of variable information text according to encryption data and variable information text.
Wherein, according to encryption data and variable information text, the mode for generating the corresponding two dimensional code of variable information text can
With referring to aforementioned middle according to encrypted ciphering sequence, encrypted ciphertext information, variable information text and separator,
The mode for generating the corresponding two dimensional code of variable information text, no longer repeats one by one herein.
In the present embodiment, random sequence number is generated, and is calculated according to the random sequence number of generation and obtains check bit, then
Check bit is inserted into random sequence number, obtains ciphering sequence, then using Encryption Algorithm respectively to ciphering sequence and predetermined encryption text
This information is encrypted, and obtains encrypted ciphering sequence and encrypted ciphertext information, then separator is added to and is added
Between ciphering sequence, encrypted ciphertext information after close, encryption data is generated, finally according to encryption data and variable letter
Informative text generates the corresponding two dimensional code of variable information text.Due to first respectively by preset Encryption Algorithm to ciphering sequence
It is encrypted with predetermined encryption text information, improves the complexity that information loaded encrypts in two dimensional code, therefore be based on after encrypting
Ciphering sequence, the two dimensional code that generates of encrypted ciphertext information, variable information text and separator is not easy to be replicated
And decoding, so as to avoid two dimensional code that the safety problems such as information leakage occur by malicious exploitation.
It referring to figure 3., is a kind of flow chart of the recognition methods of two dimensional code provided in an embodiment of the present invention.Include:
Step S301 reads the corresponding two dimensional code of variable information text, obtain variable information text and it is encrypted plus
Close sequence, encrypted ciphertext information, separator, wherein separator is for separating encrypted ciphering sequence and encryption
Ciphertext information afterwards.
Due to the generating process of two dimensional code and the identification process of two dimensional code on the contrary, therefore, in the identification process of two dimensional code,
The corresponding two dimensional code of variable information text can be read first, obtained variable information text and encrypted ciphering sequence, added
Ciphertext information after close, separator.
Step S302 compares the variable information text of reading and the variable information text prestored.
In order to identify whether two dimensional code to be identified is true two dimensional code, the variable information text of reading can be compared and prestored
Variable information text it is whether consistent.
Step S303, if variable information text is consistent with the variable information text prestored, using default decruption key solution
The encrypted corresponding original encryption sequence of ciphering sequence of close acquisition and encrypted ciphertext information it is corresponding it is original plus
Close text information.
If variable information text and the variable information text prestored are inconsistent, it may determine that the two dimensional code is false two dimension
Code, if unanimously, obtaining the corresponding original encryption sequence of encrypted ciphering sequence, Yi Jijia using default decryption key decryption
The corresponding original encryption text information of ciphertext information after close.
Wherein, original encryption sequence is sequence not encrypted before generating two dimensional code, by original random sequence number and inspection
Test position composition.
Original encryption text information is text information not encrypted before generating two dimensional code, for example can be in aforementioned
The printings in batches of * * * * * August * * days of * * * * Co., Ltd's X.
Step S304 is respectively compared original encryption sequence and whether prestore ciphering sequence consistent, original if successful decryption
Ciphertext information with whether prestore ciphertext information consistent.
Encrypted ciphering sequence or encrypted ciphertext information can not be solved according to default decruption key
It is close, then it may determine that two dimensional code is vacation, if successful decryption, can be respectively compared original encryption sequence with ciphering sequence is prestored is
No consistent, original encryption text information with whether prestore ciphertext information consistent.
Step S305, if original encryption sequence and prestoring ciphering sequence, original encryption text information and prestoring ciphertext
Information is consistent, then identifies that two dimensional code is true two dimensional code.
If finding original encryption sequence in comparison process and prestoring ciphering sequence or original encryption text information and prestore
Ciphertext information then may determine that two dimensional code is false there are inconsistent.
In embodiments of the present invention, a kind of recognition methods of two dimensional code is provided, it is corresponding by reading variable information text
Two dimensional code, whether information and the raw information before encrypting for comparing reading consistent, it is possible to authenticate two dimensional code to be identified it is true
It is false.
It referring to figure 4., is a kind of module diagram of the generating means of two dimensional code provided in an embodiment of the present invention, comprising:
Obtain module 401, encrypting module 402, generation module 403, in which:
Module 401 is obtained, for obtaining ciphering sequence according to random sequence number and check bit;Encrypting module 402, for adopting
Predetermined encryption text information is encrypted with the first preset algorithm encrypting sequence and using the second preset algorithm, obtains add respectively
Ciphering sequence and encrypted ciphertext information after close;Generation module 403 is used for according to encrypted ciphering sequence, adds
Ciphertext information, variable information text and separator after close generate the corresponding two dimensional code of variable information text, wherein
Separator is for separating encrypted ciphering sequence and encrypted ciphertext information.
Optionally, as shown in figure 5, acquisition module 401 includes:
First generates submodule 4011, for generating random sequence number.
Computational submodule 4012, for calculating and obtaining check bit according to random sequence number and third preset algorithm.
It is inserted into submodule 4013, for check bit to be inserted into random sequence number, obtains ciphering sequence.
Optionally, as Fig. 6 shows, generation module 403 includes:
Submodule 4031 is added, for separator to be added to encrypted ciphering sequence, encrypted ciphertext is believed
Between breath, encryption data is generated.
Second generates submodule 4032, for generating variable information text pair according to encryption data and variable information text
The two dimensional code answered.
Fig. 7 is please referred to, is a kind of module diagram of the identification device of two dimensional code provided in an embodiment of the present invention, comprising:
Read module 701, the first comparison module 702, deciphering module 703, the second comparison module 704, identification module 705.Wherein:
Read module 701 obtains variable information text, Yi Jijia for reading the corresponding two dimensional code of variable information text
Ciphering sequence, encrypted ciphertext information, separator after close, wherein separator is for separating encrypted encryption sequence
Column and encrypted ciphertext information;First comparison module 702, for compare the variable information text of reading with prestore can
Become information text;Deciphering module 703, if consistent with the variable information text prestored for variable information text, using default
Decryption key decryption obtains the encrypted corresponding original encryption sequence of ciphering sequence and encrypted ciphertext information pair
The original encryption text information answered;Second comparison module 704, if be used for successful decryption, be respectively compared original encryption sequence with
Prestore whether ciphering sequence consistent, original encryption text information with whether prestore ciphertext information consistent;Identification module 705,
If for original encryption sequence with prestore ciphering sequence, original encryption text information and to prestore ciphertext information consistent,
Identification two dimensional code is true two dimensional code.
The method that above-mentioned apparatus is used to execute previous embodiment offer, it is similar that the realization principle and technical effect are similar, herein not
It repeats again.
The above module can be arranged to implement one or more integrated circuits of above method, such as: one
Or multiple specific integrated circuits (Application Specific Integrated Circuit, abbreviation ASIC), or, one
Or multi-microprocessor (digital singnal processor, abbreviation DSP), or, one or more field programmable gate
Array (Field Programmable Gate Array, abbreviation FPGA) etc..For another example, when some above module passes through processing elements
When the form of part scheduler program code is realized, which can be general processor, such as central processing unit (Central
Processing Unit, abbreviation CPU) or it is other can be with the processor of caller code.For another example, these modules can integrate
Together, it is realized in the form of system on chip (system-on-a-chip, abbreviation SOC).
Fig. 8 is the schematic diagram of the generating means of another two dimensional code provided in an embodiment of the present invention, which can integrate
In terminal device or the chip of terminal device, which can be the computer equipment for having producible two dimensional code function.
The device includes: processor 801, memory 802.
Memory 802 is for storing program, the program that processor 801 calls memory 802 to store, to execute the above method
Embodiment.Specific implementation is similar with technical effect, and which is not described herein again.
The present invention also provides a kind of program product, such as computer readable storage medium, including program, which is being located
For executing above method embodiment when reason device executes.
In several embodiments provided by the present invention, it should be understood that disclosed device and method can pass through it
Its mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the division of the unit, only
Only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can be tied
Another system is closed or is desirably integrated into, or some features can be ignored or not executed.Another point, it is shown or discussed
Mutual coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or logical of device or unit
Letter connection can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at one
In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computer
Equipment (can be personal computer, server or the network equipment etc.) or processor (English: processor) execute this hair
The part steps of bright each embodiment the method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory
(English: Read-Only Memory, abbreviation: ROM), random access memory (English: Random Access Memory, letter
Claim: RAM), the various media that can store program code such as magnetic or disk.
Claims (10)
1. a kind of generation method of two dimensional code characterized by comprising
Ciphering sequence is obtained according to random sequence number and check bit;
The ciphering sequence is encrypted using the first preset algorithm and predetermined encryption text information is encrypted using the second preset algorithm,
Encrypted ciphering sequence and encrypted ciphertext information are obtained respectively;
According to the encrypted ciphering sequence, the encrypted ciphertext information, variable information text and separator,
Generate the corresponding two dimensional code of the variable information text, wherein the separator is for separating the encrypted ciphering sequence
With the encrypted ciphertext information.
2. the generation method of two dimensional code as described in claim 1, which is characterized in that described according to random sequence number and check bit
Obtain ciphering sequence, comprising:
Generate the random sequence number;
According to the random sequence number and third preset algorithm, calculates and obtain the check bit;
The check bit is inserted into the random sequence number, obtains the ciphering sequence.
3. the generation method of two dimensional code as described in claim 1, which is characterized in that described according to the encrypted encryption sequence
Column, the encrypted ciphertext information, variable information text and separator, it is corresponding to generate the variable information text
Two dimensional code, comprising:
The separator is added between the encrypted ciphering sequence, the encrypted ciphertext information, is generated
Encryption data;
According to the encryption data and the variable information text, the corresponding two dimensional code of the variable information text is generated.
4. the generation method of two dimensional code as described in claim 1, which is characterized in that described pre- using the encryption of the second preset algorithm
If ciphertext information, comprising:
Obtain the encryption factor comprising n bit digital, wherein n is the integer greater than 2;
The encryption factor is substituted into second preset algorithm, the predetermined encryption text information is encrypted.
5. the generation method of two dimensional code as described in claim 1, which is characterized in that under the predetermined encryption text information includes
It states one or more: date information, product batches information, enterprise's identification information, product identification information.
6. a kind of recognition methods of two dimensional code characterized by comprising
The corresponding two dimensional code of variable information text is read, the variable information text and encrypted ciphering sequence is obtained, adds
Ciphertext information after close, separator, wherein the separator adds for separating the encrypted ciphering sequence with described
Ciphertext information after close;
Compare the variable information text of reading and the variable information text prestored;
If the variable information text is consistent with the variable information text prestored, obtained using default decryption key decryption
The corresponding original encryption sequence of encrypted ciphering sequence and the encrypted ciphertext information are corresponding original
Ciphertext information;
If successful decryption, it is respectively compared the original encryption sequence and prestores whether ciphering sequence consistent, the original encryption
Text information with whether prestore ciphertext information consistent;
If the original encryption sequence and ciphering sequence, the original encryption text information of prestoring are believed with ciphertext is prestored
Breath is consistent, then identifies that the two dimensional code is true two dimensional code.
7. a kind of generating means of two dimensional code characterized by comprising
Module is obtained, for obtaining ciphering sequence according to random sequence number and check bit;
Encrypting module, for encrypting the ciphering sequence using the first preset algorithm and being encrypted using the second preset algorithm default
Ciphertext information obtains encrypted ciphering sequence and encrypted ciphertext information respectively;
Generation module, for according to the encrypted ciphering sequence, the encrypted ciphertext information, variable information text
Sheet and separator, generate the corresponding two dimensional code of the variable information text, wherein the separator is for separating the encryption
Ciphering sequence and the encrypted ciphertext information afterwards.
8. the generating means of two dimensional code as claimed in claim 7, which is characterized in that the acquisition module includes:
First generates submodule, for generating the random sequence number;
Computational submodule, for calculating and obtaining the check bit according to the random sequence number and third preset algorithm;
It is inserted into submodule, for the check bit to be inserted into the random sequence number, obtains the ciphering sequence.
9. the generating means of two dimensional code as claimed in claim 7, which is characterized in that the generation module includes:
Submodule is added, for the separator to be added to the encrypted ciphering sequence, the encrypted encryption text
Between this information, encryption data is generated;
Second generates submodule, for generating the variable information text according to the encryption data and the variable information text
This corresponding two dimensional code.
10. a kind of identification device of two dimensional code characterized by comprising
Read module, for reading the corresponding two dimensional code of variable information text, after obtaining the variable information text and encryption
Ciphering sequence, encrypted ciphertext information, separator, wherein the separator for separate it is described it is encrypted plus
Close sequence and the encrypted ciphertext information;
First comparison module, for comparing the variable information text of reading and the variable information text prestored;
Deciphering module, if consistent with the variable information text prestored for the variable information text, using default solution
Key decryption obtains the encrypted corresponding original encryption sequence of ciphering sequence and the encrypted ciphertext
The corresponding original encryption text information of information;
Second comparison module, if being used for successful decryption, being respectively compared the original encryption sequence and whether prestoring ciphering sequence
Unanimously, the original encryption text information with whether prestore ciphertext information consistent;
Identification module, if for the original encryption sequence and it is described prestore ciphering sequence, the original encryption text information with
It is consistent to prestore ciphertext information, then identifies that the two dimensional code is true two dimensional code.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910025547.XA CN109460807A (en) | 2019-01-11 | 2019-01-11 | Generation method, recognition methods, generating means and the identification device of two dimensional code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910025547.XA CN109460807A (en) | 2019-01-11 | 2019-01-11 | Generation method, recognition methods, generating means and the identification device of two dimensional code |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109460807A true CN109460807A (en) | 2019-03-12 |
Family
ID=65616218
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910025547.XA Pending CN109460807A (en) | 2019-01-11 | 2019-01-11 | Generation method, recognition methods, generating means and the identification device of two dimensional code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109460807A (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4972475A (en) * | 1987-02-10 | 1990-11-20 | Veritec Inc. | Authenticating pseudo-random code and apparatus |
CN1204099A (en) * | 1997-06-28 | 1999-01-06 | 北京恒懋商贸有限责任公司 | Anti-false bar code and producing and distinguishing method thereof |
US20060236400A1 (en) * | 2003-07-10 | 2006-10-19 | Betware A Islandi Hf. | Secure and auditable on-line system |
US7508945B1 (en) * | 1999-05-18 | 2009-03-24 | Ferre Herrero Angel Jose | Self-corrector randomisation-encryption and method |
CN102831455A (en) * | 2012-08-09 | 2012-12-19 | 陕西煤航安全印务有限公司 | Multiple anti-fake method based on two-dimensional bar code |
CN103646264A (en) * | 2013-11-06 | 2014-03-19 | 杭州电子科技大学 | Multiple information encrypted two-dimensional code anti-counterfeiting method |
CN104835046A (en) * | 2015-04-20 | 2015-08-12 | 信码互通(北京)科技有限公司 | Data identification method for two-dimension code safety verification |
CN105976005A (en) * | 2016-04-26 | 2016-09-28 | 鸿博股份有限公司 | Two-dimensional code encrypting method, two-dimensional code generating device and two-dimensional code scanning device |
CN108960385A (en) * | 2018-06-29 | 2018-12-07 | 苏州酷豆物联科技有限公司 | Two dimensional code generation and verification method and system based on the encryption of multiple code key |
-
2019
- 2019-01-11 CN CN201910025547.XA patent/CN109460807A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4972475A (en) * | 1987-02-10 | 1990-11-20 | Veritec Inc. | Authenticating pseudo-random code and apparatus |
CN1204099A (en) * | 1997-06-28 | 1999-01-06 | 北京恒懋商贸有限责任公司 | Anti-false bar code and producing and distinguishing method thereof |
US7508945B1 (en) * | 1999-05-18 | 2009-03-24 | Ferre Herrero Angel Jose | Self-corrector randomisation-encryption and method |
US20060236400A1 (en) * | 2003-07-10 | 2006-10-19 | Betware A Islandi Hf. | Secure and auditable on-line system |
CN102831455A (en) * | 2012-08-09 | 2012-12-19 | 陕西煤航安全印务有限公司 | Multiple anti-fake method based on two-dimensional bar code |
CN103646264A (en) * | 2013-11-06 | 2014-03-19 | 杭州电子科技大学 | Multiple information encrypted two-dimensional code anti-counterfeiting method |
CN104835046A (en) * | 2015-04-20 | 2015-08-12 | 信码互通(北京)科技有限公司 | Data identification method for two-dimension code safety verification |
CN105976005A (en) * | 2016-04-26 | 2016-09-28 | 鸿博股份有限公司 | Two-dimensional code encrypting method, two-dimensional code generating device and two-dimensional code scanning device |
CN108960385A (en) * | 2018-06-29 | 2018-12-07 | 苏州酷豆物联科技有限公司 | Two dimensional code generation and verification method and system based on the encryption of multiple code key |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Li et al. | A novel plaintext-related image encryption scheme using hyper-chaotic system | |
Souyah et al. | An image encryption scheme combining chaos-memory cellular automata and weighted histogram | |
EP2924677B1 (en) | Splitting s-boxes in a white-box implementation to resist attacks | |
Praveenkumar et al. | Fusion of confusion and diffusion: a novel image encryption approach | |
CN110061840A (en) | Data ciphering method, device, computer equipment and storage medium | |
CN105976005A (en) | Two-dimensional code encrypting method, two-dimensional code generating device and two-dimensional code scanning device | |
CN108494546A (en) | A kind of whitepack encryption method, device and storage medium | |
CN111010266B (en) | Message encryption and decryption, reading and writing method and device, computer equipment and storage medium | |
CN106530206B (en) | Image encryption and decryption method and device based on optical encryption and decryption technology | |
Wang et al. | Cross-plane multi-image encryption using chaos and blurred pixels | |
Zareai et al. | A new Grayscale image encryption algorithm composed of logistic mapping, Arnold cat, and image blocking | |
CN107665314B (en) | The trusted processes method and device signed on the electronic document | |
CN110598433A (en) | Anti-counterfeiting information processing method and device based on block chain | |
Acharya | Image encryption using a new chaos based encryption algorithm | |
CN116455572B (en) | Data encryption method, device and equipment | |
Mohan et al. | Secure visual cryptography scheme with meaningful shares | |
Alshehri et al. | Cryptanalysis of 2D-SCMCI Hyperchaotic Map Based Image Encryption Algorithm. | |
RU2710670C2 (en) | Cryptographic system and method | |
EP2940917B1 (en) | Behavioral fingerprint in a white-box implementation | |
CN106341384A (en) | Methods for facilitating secure communication | |
CN114374518B (en) | PSI (program specific information) intersection information acquisition method and device with intersection counting function and storage medium | |
CN109460807A (en) | Generation method, recognition methods, generating means and the identification device of two dimensional code | |
Rajendran et al. | An update on medical data steganography and encryption | |
Shawkat et al. | Optimization-based pseudo random key generation for fast encryption scheme | |
CN110401533B (en) | Private key encryption method and device |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190312 |