CN102968725A - Method for tracing anti-fake markings for agricultural product - Google Patents
Method for tracing anti-fake markings for agricultural product Download PDFInfo
- Publication number
- CN102968725A CN102968725A CN2012103713980A CN201210371398A CN102968725A CN 102968725 A CN102968725 A CN 102968725A CN 2012103713980 A CN2012103713980 A CN 2012103713980A CN 201210371398 A CN201210371398 A CN 201210371398A CN 102968725 A CN102968725 A CN 102968725A
- Authority
- CN
- China
- Prior art keywords
- code
- key
- state
- dkey
- agricultural product
- 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
Images
Landscapes
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention belongs to the technical field of a tracing system of agricultural products and discloses a method for tracing anti-fake markings for agricultural products. The agricultural products are coded based on a supervision model to form agricultural product tracing supervision codes; then the agricultural product tracing supervision codes are compressed and encrypted to generate a one-dimensional tracing code, the result obtained through an encryption algorithm is unique, the fact that one product with one code is achieved, individual marking and tracing can be achieved, and the anti-fake function is high. The one-dimensional tracing code and an encryption initial key of the one-dimensional tracing code are stored in a two-dimensional bar code, because the two-dimensional bar code is provided with good error correcting capacity, when the one-dimensional tracing code is damaged and cannot be recognized, the one-dimensional tracing code can be obtained from the two-dimensional bar code for the tracing, and when a network is unavailable, off-line tracing of basic information can be performed directly through the two-dimensional bar code. Simultaneously, flexible tracing for individuals and batches can be achieved through associating the one-dimensional code with the two-dimensional bar code.
Description
Technical field
The present invention relates to agricultural product traceability system technical field, particularly relate to a kind of agricultural product back-tracing anti-fake identification method.
Background technology
Quality Safety Problems of Agricultural Products becomes increasingly conspicuous in recent years, and the domestic agricultural product security quality time happens occasionally.Agricultural product quality and safety is a global hot issue, the events such as " clenbuterol hydrochloride ", " the ordeal bean bud " that China constantly occured in recent years, " dyeing steamed bun ", " hormone cucumber " have proved absolutely that the Agricultural Products safety problem allows of no optimist, and have caused very big harm to people are healthy with the export of farm produce.The consumer hopes that on the one hand functional government departments strengthen the agricultural product quality supervision, ensure the agricultural product edible safety, also wish in time to understand the information of agricultural product production, circulation and processing overall process on the other hand.Set up the trackability that agricultural product quality and safety is reviewed system, realized agricultural product quality and safety, promote the consumer to the degree of belief of agricultural product cating quality, demonstrated the meaning that becomes more and more important.
Set up the identification method that key that agricultural product review is to provide the agricultural product label.The agricultural product of present stage are reviewed the most bar code labels that adopt of label, this label adopts Word message to add the bar code technology and combines to realize, Word message can allow the client see very clearly title and the related content of product, the use of barcode technology can allow enterprise finish quickly and accurately reading of information.
This bar code Product labelling although read simply, has certain defective, is embodied in the following aspects:
1, dependency database can't be reviewed by off-line.Content in the bar code label can only comprise English, numeral and indivedual several symbol, and will wonder the real meaning of their representatives, import it into computer by scanning device, goes out the original implication of its representative by database search.
2, rely on network.Orient towards the whole country or sell in a big way such as fruit product, reviewing so product must the Adoption Network platform, and long-range reading out data if this locality does not possess network environment, just can only be reviewed the product related information that has in the local data base.
3, quantity of information is little.The bar code label that uses at present, general what adopt is more popular bar code standard, such as 39 yards, EAN code, UPC code, 128 yards.The character figure place that comprises is at most less than 30 characters or numeral.
4, a little less than the security.Relative two-dimensional bar code, bar code are in security, and what generally adopt is to upset character sequence, or directly chooses several characters with the specific meanings of representing, and will change by database during inquiry.Not only safe bar code a little less than, and label itself do not take false proof measure, implements easily replicate run.
5, slightly have impaired, None-identified.Because bar code do not have the error correcting code verification, in case stain is slightly arranged, draw the slightly damageds such as horizontal, can't distinguish, cause reviewing unsuccessfully.
6, can't realize individuality with batch related reviewing.Present bar code is mainly batch to review, can't carry out simultaneously individual with batch related reviewing.
Summary of the invention
The technical matters that (one) will solve
For addressing the above problem, the invention provides a kind of agricultural product back-tracing anti-fake identification method.
(2) technical scheme
In order to solve the problems of the technologies described above, the invention provides a kind of agricultural product back-tracing anti-fake identification method, comprising:
Obtain agricultural product and review supervision code and compress, obtain compressing agricultural product and review supervision code, described agricultural product are reviewed supervision code and are comprised administrative division code, enterprise code eID, item category code, source entity identifying code, date of manufacture and check code;
By cryptographic algorithm described compression agricultural product are reviewed supervision code and be encrypted, generate the one dimension traceability code;
With the encryption initial key Key of described one dimension traceability code and the described one dimension traceability code a part of generating two-dimension bar-code as the two-dimensional bar code content.
Aforesaid agricultural product back-tracing anti-fake identification method preferably, also comprises:
By the AES block encryption algorithm described two-dimensional bar code is encrypted.
Aforesaid agricultural product back-tracing anti-fake identification method, preferably, described one dimension compression agricultural product are reviewed the detailed process that supervision code is encrypted be:
S1, obtain one dimension compression agricultural product and review supervision code and described one dimension compression agricultural product are reviewed the supervision code matrixing, generate the traceability code state matrix, be designated as State[i by the row storage], wherein, i is natural number;
S2, read initial key Key, generate Nr dynamic key Dkey[j by initial key Key according to the dynamic key rule], described Nr dynamic key Dkey[j] composition round key table Len, wherein, j, Nr are natural number;
S3, to traceability code state matrix State[i] carry out round transformation Nr-1 time, the k time described round transformation comprises successively that the S box is replaced, row displacement, row mix, with described round key table Len in k dynamic key Dkey[j] according to the preset algorithm computing, but described preset algorithm is inverse operation, wherein, k is natural number, 1≤k≤Nr-1;
S4, successively to traceability code state matrix State[i] carry out that the S box is replaced, the row displacement, with described round key table in Nr dynamic key according to the preset algorithm computing, but described preset algorithm is inverse operation;
S5, output one dimension traceability code;
Wherein, the Sbox permutation table of described S box replacement is decimal system permutation table;
Described row mixing is specially:
Described traceability code state matrix State[i] premultiplication one reversible positive integer matrix, then carry out modulo operation to 10.
Aforesaid agricultural product back-tracing anti-fake identification method preferably, generates Nr dynamic key DKey[j by initial key Key] detailed process be:
100, read initial key Key, round transformation number of times k and enterprise code eID, and with described initial key Key and enterprise code eID matrixing respectively, be designated as Key[j], eID[j], wherein, j=0;
101, round transformation number of times k is designated as K to 4 deliverys;
102, when K=0, DKey[j]=(Key[j]+(eID[j]+k) mod10) mod10, and storage, or
When K=1, DKey[j]=(Key[j]+Sbox[(eID[j]+k) mod10]) mod10, and storage, or
When K=2, DKey[i]=(Key[j]-Sbox[(eID[j]-k) mod10]) mod10, and storage, or
When K=3, DKey[i]=(Key[j]-(eID[j]-k) mod10) mod10, and storage;
103、(K+1)mod4,j+1;
104, when j<m, repeating step 102,103, wherein, m is the length of dynamic key Dkey;
105, when j=m, output dynamic key DKey[m].
Aforesaid agricultural product back-tracing anti-fake identification method, preferably, described traceability code state matrix State[i] with described round key table Len in k dynamic key DKey[j] according to the preset algorithm computing, wherein, 1≤k≤Nr is specially:
200, obtain k dynamic key Dkey[j of the k time round transformation], wherein, i=0, j=0;
201, with dynamic key Dkey[j] all step-by-step additions then carry out modulo operation to 4, be designated as K;
202, when K=0, State[i]=(State[i]+Dkey[j]) mod10, and storage, or
When K=1, State[i]=(State[i]+Sbox[Dkey[j] mod10]) mod10, and storage, or
When K=2, State[i]=(State[i]-Sbox[Dkey[j] mod10]) mod10, and storage, or
When K=3, State[i]=(State[i]-Dkey[j]) mod10;
203、i+1,j+1;
204, when i<n, repeating step 202, wherein, n is traceability code state matrix State[i] length;
205, when i=n, output traceability code state matrix State[n], described traceability code state matrix State[n] be the one dimension traceability code that agricultural product are reviewed supervision code.
Aforesaid agricultural product back-tracing anti-fake identification method preferably, adopts packed compressed algorithm that agricultural product are reviewed supervision code and compresses.
(3) beneficial effect
Agricultural product back-tracing anti-fake identification method provided by the present invention forms agricultural product and reviews supervision code by agricultural product being carried out the coding based on regulatory format; Then compress these agricultural product and review supervision code and encrypt generation one dimension traceability code, the result who obtains according to cryptographic algorithm has uniqueness, has realized a product one yard, can reach to realize individual sign and review, and antiforge function is strong.And the encryption initial key of one dimension traceability code and one dimension traceability code deposited in the two-dimensional bar code, because two-dimensional bar code has good error correcting capability, when the one dimension traceability code impaired and can't distinguish the time, can distinguish two-dimensional bar code obtains the one dimension traceability code and reviews, in the situation that does not have network, the off-line that can be directly carries out essential information by two-dimensional bar code is reviewed.Simultaneously, bar code and two-dimensional bar code are carried out related, can realize individual with batch review flexibly, when reviewing individuality, only need the scanning bar code to review; When needs were reviewed batch, scanning two-dimension bar code obtained the encryption initial key of one dimension traceability code and one dimension traceability code, then deciphered the one dimension traceability code and obtained agricultural product and review supervision code, carried out batch reviewing.
Description of drawings
Fig. 1 is the process flow diagram of embodiment of the invention middle peasant product back-tracing anti-fake identification method;
Fig. 2 is the packed compressed process flow diagram that aquatic products are reviewed supervision code in the embodiment of the invention;
Fig. 3 is the encryption flow figure that the compression agricultural product are reviewed supervision code in the embodiment of the invention;
Fig. 4 is the deciphering process flow diagram of one dimension traceability code in the embodiment of the invention;
Fig. 5 is the algorithm flow chart that generates dynamic key in the embodiment of the invention;
Fig. 6 is round key control algolithm process flow diagram in the embodiment of the invention.
Embodiment
Below in conjunction with drawings and Examples, the specific embodiment of the present invention is described in further detail.Following examples are used for explanation the present invention, but are not used for limiting the scope of the invention.
Fig. 1 is the process flow diagram of embodiment of the invention middle peasant product back-tracing anti-fake identification method.To specify as an example of aquatic products example principle and the process of agricultural product back-tracing anti-fake identification method in the embodiment of the invention.
As shown in Figure 1, embodiment of the invention middle peasant product back-tracing anti-fake identification method comprises:
A, obtain agricultural product and review supervision code and compress, obtain compressing agricultural product and review supervision code, these agricultural product are reviewed supervision code and are comprised administrative division code, the serial number eID of enterprise, item category code, source entity identifying code, date of manufacture and check code;
The coding that aquatic products are reviewed supervision code is the angle from government regulation, with batch as reviewing the unit, then go out the product of same kind in pond as coding unit with the same time of same cultivation main body in same pond for aquatic products, be that One-Dimensional Water product back-tracing supervision code forms concrete structure such as table 1 by administrative division code, enterprise code eID, item category code (aquatic products kind), source entity identifying code (pond code), date of manufacture and check code.
Table 1 aquatic products one dimension is reviewed supervision code 27 bit architectures
Wherein, vendor identification code 10 bit digital, the administrative division code can be specific at county level, specifically can be with reference to the coding of GB/T 2260-1999; Enterprise code is comprised of 1 type of business cognizance code and 3 enterprise's order serial numbers; Batch number code 16 bit digital were comprised of 6 item category codes, 4 potential source entity reference codes and 6 dates of manufacture, and item category code sees GB11782-89 aquatic products name class for details according to the design of layer code.The computing method of check code are ground algorithm by the odd even school and are carried out, specifically can be with reference to the computing method of GB 12904-2003 appendix B.
Adopt the above-mentioned aquatic products that generate by the aquatic products area under one's jurisdiction to review totally 27 of supervision codes, for consumers, can only carry out batch reviewing, can't review individuality; Exist simultaneously length long, be not easy to the shortcomings such as product back-tracing.In order to realize individuality and batch related reviewing, need that at first aquatic products are reviewed supervision code and compress.
Adopt packed compressed algorithm that aquatic products are reviewed supervision code in the present embodiment and compress, be specially:
As shown in Figure 2, review the coding rule of supervision code according to aquatic products, adopt the method for grouping that each yard section is carried out compression coding.The basic thought of compression coding is to adopt the method for exhaustion that each yard section is carried out the recompile design according to the maximum occurrences scope.Wherein, check code is calculated by vendor identification code, batch number code, can ignore when compression; Quantity is drawn by administrative areas at the county level to be had about 2800, therefore, adopts 4 decimal digits to represent that enterprise code eID remains unchanged, and the aquatic products Sort Code adopts 3 decimal digits to represent that 1000 main flow breed varieties can satisfy the aquatic products application demand fully.The source entity identifying code is that enterprise's pond code remains unchanged, and the date of manufacture calculated according to 100 years, about 36500 days, adopted 5 decimal digits to represent.
Therefore, the pressurized water product after packed compressed is reviewed totally 20 of supervision codes.
B, by cryptographic algorithm described compression agricultural product are reviewed supervision code and be encrypted, generate the one dimension traceability code;
Adopt the pressurized water product after the packed compressed compression algorithm to review supervision code, realized the minimizing of code length, but its security and anti-counterfeiting performance are relatively poor, need to be encrypted it, and needing to keep length constant before and after encrypting, a product one yard is reviewed to realize individuality.
Cryptographic algorithm of the prior art has a variety of, such as DES, IDEA, RSA, AES etc., wherein, aes algorithm is as the substitute of des encryption algorithm, comprise that the S box is replaced (ByteSub), row displacement (ShiftRows), row mix (MixColumn), four kinds of cryptographic calculations of InvAddRoundKey (AddRounds), have safety, efficient, and under different soft and hardware running environment, all have the advantage such as superperformance.
Therefore, preferably by aes algorithm pressurized water product supervision code is encrypted in the present embodiment.But aes algorithm is only applicable to binary-coded encryption, in the present embodiment by aes algorithm is improved, four kinds of cryptographic calculation S boxes in the redesign aes algorithm are replaced, row is shifted, row mix, InvAddRoundKey, the requirement of directly encrypting to adapt to decimal number.For strengthening Cipher Strength, guarantee to generate the uniqueness of one dimension traceability code simultaneously, make same plaintext generate irregular ciphertext, realize " one-time pad " antifalse effect, adopt dynamic key Dkey[j] pressurized water product supervision code is carried out the chaos accidental enciphering, wherein, j is natural number.
Concrete encryption flow comprises as shown in Figure 3:
S1, obtain the compression agricultural product and review supervision code and should compress agricultural product and review the supervision code matrixing, generate the traceability code state matrix, be designated as State[i by being listed as to store], wherein, i is natural number;
S2, read initial key Key, generate Nr dynamic key Dkey[j by initial key Key according to the dynamic key rule], Nr dynamic key Dkey[j] composition round key table Len, wherein, Nr is natural number;
Wherein, initial key can independently be specified.
The main expansion that realizes initial key Key in this step, corresponding (through a large amount of experimental results show that with 128 expanded keys in the aes algorithm for realizing, it has sufficiently high security performance), in the present embodiment initial key Key expanded to the decimal system dynamic key Dkey[j of length m=32].
As shown in Figure 5, generate Nr 32 decimal system dynamic key Dkey[j by initial key Key in the present embodiment] detailed process be:
100, read initial key Key, round transformation number of times k and enterprise code eID, and with initial key Key and the serial number eID of enterprise matrixing respectively, be designated as Key[j], eID[j], wherein, j=0;
Dynamic key is related with enterprise code, go for the cryptographic calculation of different enterprises, improve the practicality of cryptographic algorithm.
101, round transformation number of times k is designated as K to 4 deliverys;
Round transformation number of times k is not limited to 4 deliverys, 2 ~ 9 natural number average can, and with different K value corresponding one such as the evaluation algorithm in the step 102.
102, when K=0, DKey[j]=(Key[j]+(eID[j]+k) mod10) mod10, and storage, or
When K=1, DKey[j]=(Key[j]+Sbox[(eID[j]+k) mod10]) mod10, and storage, or
When K=2, DKey[j]=(Key[j]-Sbox[(eID[j]-k) mod10]) mod10, and storage, or
When K=3, DKey[j]=(Keyj]-(eID[j]-k) mod10) mod10, and storage;
Wherein, Sbox is the permutation table of operation S box replace Algorithm, and for being applicable to metric direct encryption requirement, the Sbox permutation table is decimal system permutation table, and concrete replacement process will specifically be introduced in following content.
Certainly, these algorithms are not unique, as long as encrypt, the expansion algorithm to initial key Key in the decrypting process is identical, can realize correct encryption, deciphering.
103、(K+1)mod4,i+1;
104, when j<32, repeating step 102,103;
105, when j=32, output dynamic key DKey[32].
S3, to traceability code state matrix State[i] carry out round transformation Nr-1 time, the k time round transformation comprises successively that the S box is replaced, row displacement, row mix, with round key table Len in k dynamic key Dkey according to the preset algorithm computing, but this preset algorithm is inverse operation, wherein, k is natural number, 1≤k≤Nr-1;
S4, successively to traceability code state matrix State[i] carry out that the S box is replaced, the row displacement, with round key table Len in Nr dynamic key according to the preset algorithm computing, but this preset algorithm is inverse operation;
S5, output one dimension traceability code.
Wherein, round transformation mainly comprises following committed step:
What (i) the Sbox permutation table of the replacement of the S box in the present embodiment adopted is that the decimal number word location changes table, can be as shown in table 2, and namely 0 ~ 9 decimal system number average replaces with other numeral corresponding with it, replaces with 7 such as decimal number 4.In the digit order number displacement that each is taken turns, the decimal digit that can reach half changes.The decommutation table corresponding with table 2 is as shown in table 3, is used for the decommutation of decrypting process shown in Figure 4.
Table 2Sbox digit order number displacement table
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
6 | 8 | 4 | 9 | 7 | 2 | 1 | 0 | 5 | 3 |
Table 3Sbox digit order number inverse permutation table
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
7 | 6 | 5 | 9 | 2 | 8 | 0 | 4 | 1 | 3 |
(ii) it is identical with capable shift rule in the aes algorithm to go shifting algorithm: the first row is mobile, 1 of the second row ring shift left, 2 of the third line ring shift lefts, 3 of fourth line ring shift lefts, for example: table 4 is 20 traceability code state matrix State[i], table 5 is 20 traceability code state matrix State[i] the row shifting function.
Table 420 a traceability code state matrix
2 | 7 | 7 | 0 | 1 |
6 | 4 | 5 | 0 | 2 |
3 | 1 | 0 | 1 | 0 |
4 | 1 | 0 | 3 | 3 |
Table 520 a capable shifting function of traceability code state matrix
2 | 7 | 7 | 0 | 1 |
4 | 5 | 0 | 2 | 6 |
0 | 1 | 0 | 3 | 1 |
3 | 3 | 4 | 1 | 0 |
(iii) traceability code state matrix State[i] the row married operation is with a reversible positive integer matrix M premultiplication traceability code mode bit matrix S tate[i], then carry out modulo operation to 10, the result who obtains is put back to traceability code state matrix State[i] in.Formula (1) is the traceability code state matrix State[i of row married operation in the ciphering process] expression, formula (2) is that row mix inverse operation traceability code state matrix State[i in the decrypting process] expression.
(iv) traceability code state matrix State[i in the present embodiment] with round key table Len in dynamic key Dkey[j] according to the preset algorithm computing, but this preset algorithm is inverse operation, is specifically as follows as shown in Figure 6:
200, obtain k dynamic key Dkey[j of the k time round transformation], wherein, i=0, j=0;
201, with dynamic key Dkey[j] all step-by-step additions then carry out modulo operation to 4, be designated as K;
202, when K=0, State[i]=(State[i]+Dkey[j]) mod10, and storage, or
When K=1, State[i]=(State[i]+Sbox[Dkey[j] mod10]) mod10, and storage, or
When K=2, State[i]=(State[i]-Sbox[Dkey[j] mod10]) mod10, and storage, or
When K=3, State[i]=(State[i]-Dkey[j]) mod10;
Wherein, Sbox is the decimal system permutation table of operation S box replace Algorithm.
In the AES cryptographic algorithm, the InvAddRoundKey algorithm is to utilize binary keys and traceability code state matrix State[i] corresponding byte is done XOR, but XOR does not have reversibility for decimal number.In order to make traceability code mode bit State[i] with dynamic key Dkey[j] have reversibility behind the operation of confusion, with the scale-of-two XOR in the aes algorithm, make metric round key control algorithm into.
The round key control algorithm is the dynamic key Dkey[j that takes turns according to each] difference, but carry out different inverse operations, and the computing entrance is taken turns dynamic key Dkey[j by each] all step-by-step additions and 4 deliverys are determined.
But each takes turns dynamic key Dkey[j] all step-by-step additions and be not limited to 4 deliverys, 2 ~ 9 natural number average can, and with one of different K value correspondence such as the reversible evaluation algorithm in the step 202.
Certainly, each reversible evaluation algorithm is not unique, as long as satisfy the reversibility in the InvAddRoundKey algorithm in the aes algorithm.
203、i+1,j+1;
204, when i<20, repeating step 202, wherein, n is traceability code state matrix State[i] length, be 20 in the present embodiment;
205, when i=20, output traceability code state matrix State[20], traceability code state matrix State[20] be the one dimension traceability code of One-Dimensional Water product supervision code.
Because traceability code state matrix State[i] and dynamic key Dkey[j] all positions be decimal number, carry out modulo operation to 10, have reversibility, can realize decrypting process.
With real enterprise aquatic products explanation One-Dimensional Water product back-tracing supervision code ciphering process, the specific coding form is:
The administrative division code of enterprise is: 440902
The type of business: breeding enterprise (1)
Enterprise's order serial number: 001
The large class of aquatic products: bright, the category of living
Aquatic products kind: fresh-water fishes
Aquatic products title: green card board Shelled Turtle Trionyx Sinensis
Go out the pond date: on November 20th, 2010
Review the supervision code coding rule according to aquatic products, calculating 6 administrative division codes is 440902; 4 enterprise's serial numbers are 1001; 6 item category codes are 010122; 4 potential source entity reference codes, namely the aquaculture enterprise product goes out the pond numbering in pond, and numbering position in pond is decided to be 0001 here; 6 date of formation codes are 101120; Check code is 0, and comprehensive above information is reviewed for 27 of this this batch products of enterprise and is encoded to: 440902100101012200011011200.When going out the pond date when being on November 21st, 2010,27 traceability codes of this batch products are: 440902100101012200011011211.
Wherein, bar code adopts the EAN-128 code system, reviews supervision code by aquatic products and generates through the cryptographic algorithm of this paper, as shown in Figure 6.Through after the algorithm for encryption of this paper, in November, 2010, the one dimension traceability code of Shelled Turtle Trionyx Sinensis in 20 sunrise ponds was: 77888427347123231562, and process is:
November 21 in 2010, the Shelled Turtle Trionyx Sinensis one dimension traceability code in sunrise pond was: 09404382050494370518, and process is:
After overcompression, under the condition that guarantees practical and expansion, shortened code length, satisfied one of requirement of coding guide rule, and the uniqueness of having accomplished the one dimension traceability code, thereby can realize that individuality reviews, not see any implication that it comprises from one dimension traceability code digital surface, even and behind the coding rule of learning the one dimension traceability code, also can't obtain the information of the inside, security is greatly improved.
C, convert the encryption initial key Key of one dimension traceability code and one dimension traceability code to two-dimensional bar code.
The encryption initial key Key of one dimension traceability code and one dimension traceability code is stored in the two-dimensional bar code, if the consumer need to review individuality, so only needs the scanning bar code, connection data storehouse realization individuality is reviewed; If review batch, the consumer at first needs scanning two-dimension bar code, inverse process deciphering two-dimensional bar code by two dimensional encryption takes out one dimension key information wherein, and by the inverse process of bar code cryptographic algorithm, the deciphering bar code obtains a batch coding and realizes batch reviewing.Thereby realize individual with batch related reviewing.
Because two-dimensional bar code can store Word message, when not having in the obstructed situation of network or network, the consumer can distinguish the information in the two-dimensional bar code, obtains basic tracing information, need not to realize that by the network inquiry data off-line of product reviews; Have error correcting capability owing to two-dimensional bar code self on the other hand, fouling resistance, fuzzy ability, so when the bar code None-identified, thereby the bar code information that the consumer can read in the two-dimensional bar code realizes reviewing.
Distort in order to prevent that information in the two-dimensional bar code is replicated, preferably utilize AES short block encipherment algorithm that Chinese letter co is encrypted in the embodiment of the invention, detailed process does not repeat them here.
As can be seen from the above embodiments, agricultural product back-tracing anti-fake identification method provided by the present invention carries out coding based on regulatory format by compression to agricultural product, forms agricultural product and reviews supervision code; Then these agricultural product are reviewed supervision code and encrypt to be generated the one dimension traceability code, and the result who obtains according to cryptographic algorithm has uniqueness, has realized a product one yard, can reach individual sign and review, and antiforge function is strong.And the encryption initial key of one dimension traceability code and one dimension traceability code deposited in the two-dimensional bar code, because two-dimensional bar code has good error correcting capability, when the one dimension traceability code impaired and can't distinguish the time, can from two-dimensional bar code, obtain the encryption initial key of one dimension traceability code and one dimension traceability code and review.In the situation that does not have network, the off-line that can be directly carries out essential information by two-dimensional bar code is reviewed.Simultaneously, bar code and two-dimensional bar code are carried out related, can realize individual with batch review flexibly, when reviewing individuality, only need the scanning bar code to review; When needs were reviewed batch, scanning two-dimension bar code obtained the encryption initial key of one dimension traceability code and one dimension traceability code, then deciphered the one dimension traceability code and obtained agricultural product and review supervision code, carried out batch reviewing.
The above only is preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the technology of the present invention principle; can also make some improvement and replacement, these improvement and replacement also should be considered as protection scope of the present invention.
Claims (6)
1. an agricultural product back-tracing anti-fake identification method is characterized in that, comprising:
Obtain agricultural product and review supervision code and compress, obtain compressing agricultural product and review supervision code, described agricultural product are reviewed supervision code and are comprised administrative division code, enterprise code eID, item category code, source entity identifying code, date of manufacture and check code;
By cryptographic algorithm described compression agricultural product are reviewed supervision code and be encrypted, generate the one dimension traceability code;
With the encryption initial key Key of described one dimension traceability code and the described one dimension traceability code a part of generating two-dimension bar-code as the two-dimensional bar code content.
2. agricultural product back-tracing anti-fake identification method according to claim 1 is characterized in that, also comprises:
By the AES block encryption algorithm described two-dimensional bar code content is encrypted.
3. agricultural product back-tracing anti-fake identification method according to claim 1 is characterized in that, described compression agricultural product is reviewed the detailed process that supervision code is encrypted be:
S1, obtain the compression agricultural product and review supervision code and described compression agricultural product are reviewed the supervision code matrixing, generate the traceability code state matrix, be designated as State[i by the row storage], wherein, i is natural number;
S2, read initial key Key, generate Nr dynamic key Dkey[j by initial key Key according to the dynamic key rule], described Nr dynamic key Dkey[j] composition round key table Len, wherein, j, Nr are natural number;
S3, to traceability code state matrix State[i] carry out round transformation Nr-1 time, the k time described round transformation comprises successively that the S box is replaced, row displacement, row mix, with described round key table Len in k dynamic key Dkey[j] according to the preset algorithm computing, but described preset algorithm is inverse operation, wherein, k is natural number, 1≤k≤Nr-1;
S4, successively to traceability code state matrix State[i] carry out that the S box is replaced, the row displacement, with described round key table in Nr dynamic key according to the preset algorithm computing, but described preset algorithm is inverse operation;
S5, output one dimension traceability code;
Wherein, the Sbox permutation table of described S box replacement is decimal system permutation table;
Described row mixing is specially:
Described traceability code state matrix State[i] premultiplication one reversible positive integer matrix, then carry out modulo operation to 10.
4. agricultural product back-tracing anti-fake identification method according to claim 3 is characterized in that, generates Nr dynamic key DKey[j by initial key Key] detailed process be:
100, read initial key Key, round transformation number of times k and enterprise code eID, and with described initial key Key and enterprise code eID matrixing respectively, be designated as Key[j], eID[j], wherein, j=0;
101, round transformation number of times k is designated as K to 4 deliverys;
102, when K=0, DKey[j]=(Key[j]+(eID[j]+k) mod10) mod10, and storage, or
When K=1, DKey[j]=(Key[j]+Sbox[(eID[j]+k) mod10]) mod10, and storage, or
When K=2, DKey[i]=(Key[j]-Sbox[(eID[j]-k) mod10]) mod10, and storage, or
When K=3, DKey[i]=(Key[j]-(eID[j]-k) mod10) mod10, and storage;
103、(K+1)mod4,j+1;
104, when j<m, repeating step 102,103, wherein, m is the length of dynamic key Dkey;
105, when j=m, output dynamic key DKey[m].
5. agricultural product back-tracing anti-fake identification method according to claim 3 is characterized in that, described traceability code state matrix State[i] with described round key table Len in k dynamic key DKey[j] according to the preset algorithm computing, wherein, 1≤k≤Nr is specially:
200, obtain k dynamic key Dkey[j of the k time round transformation], wherein, i=0, j=0;
201, with dynamic key Dkey[j] all step-by-step additions then carry out modulo operation to 4, be designated as K;
202, when K=0, State[i]=(State[i]+Dkey[j]) mod10, and storage, or
When K=1, State[i]=(State[i]+Sbox[Dkey[j] mod10]) mod10, and storage, or
When K=2, State[i]=(State[i]-Sbox[Dkey[j] mod10]) mod10, and storage, or
When K=3, State[i]=(State[i]-Dkey[j]) mod10;
203、i+1,j+1;
204, when i<n, repeating step 202, wherein, n is traceability code state matrix State[i] length;
205, when i=n, output traceability code state matrix State[n], described traceability code state matrix State[n] be the one dimension traceability code that agricultural product are reviewed supervision code.
6. agricultural product back-tracing anti-fake identification method according to claim 1 is characterized in that, adopts packed compressed algorithm that agricultural product are reviewed supervision code and compresses.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2012103713980A CN102968725A (en) | 2012-09-28 | 2012-09-28 | Method for tracing anti-fake markings for agricultural product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2012103713980A CN102968725A (en) | 2012-09-28 | 2012-09-28 | Method for tracing anti-fake markings for agricultural product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102968725A true CN102968725A (en) | 2013-03-13 |
Family
ID=47798855
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2012103713980A Pending CN102968725A (en) | 2012-09-28 | 2012-09-28 | Method for tracing anti-fake markings for agricultural product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102968725A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103646331A (en) * | 2013-11-22 | 2014-03-19 | 江西省计算技术研究所 | A liquor false proof traceablility method based on encrypted bar code identifiers |
CN104751342A (en) * | 2015-04-21 | 2015-07-01 | 张川 | Commodity information coding and decoding method for tracking commodities |
CN104766217A (en) * | 2015-04-21 | 2015-07-08 | 张川 | Commodity information coding method and commodity information decoding method used in interference process |
CN105450399A (en) * | 2015-12-23 | 2016-03-30 | 山东省农业机械科学研究院 | Anti-fake tracing method based on hyper-elliptic curve cryptosystem |
CN108337082A (en) * | 2017-12-28 | 2018-07-27 | 浙江兆信数码技术有限公司 | Encryption method and system for security code |
CN108833703A (en) * | 2018-06-20 | 2018-11-16 | 深圳正品创想科技有限公司 | A kind of commodity association message rendering method and its device, mobile terminal |
CN108848135A (en) * | 2018-05-29 | 2018-11-20 | 中化现代农业有限公司 | Agricultural product information method for pushing, acquisition methods and device, system |
CN109255625A (en) * | 2018-08-16 | 2019-01-22 | 山东省标准化研究院 | Electric business transaction platform trace back data interface system and method based on bar code |
CN110006831A (en) * | 2019-03-19 | 2019-07-12 | 江苏大学 | A kind of instant tea powder Quality Safety retrospective device and method based on Fast Detection Technique |
CN110782263A (en) * | 2019-11-04 | 2020-02-11 | 中国电子信息产业发展研究院 | Method for capturing, removing duplicate and repairing tracing data |
CN111612440A (en) * | 2020-03-11 | 2020-09-01 | 上海十进制网络信息科技有限公司 | Digital currency circulation method, device, server and readable storage medium |
CN111798254A (en) * | 2020-09-08 | 2020-10-20 | 平安国际智慧城市科技股份有限公司 | Tracing code generation method, device, equipment and readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102270312A (en) * | 2011-07-19 | 2011-12-07 | 北京中科联众科技股份有限公司 | Method for making point bitmap, and goods-fleeing prevention verification method |
CN102270294A (en) * | 2011-08-12 | 2011-12-07 | 华南农业大学 | Bar code and two-dimension code hybrid coding and decoding methods and devices |
CN102521679A (en) * | 2011-11-03 | 2012-06-27 | 北京农业信息技术研究中心 | Agricultural product electronic tracing supervision code generation method and apparatus thereof |
-
2012
- 2012-09-28 CN CN2012103713980A patent/CN102968725A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102270312A (en) * | 2011-07-19 | 2011-12-07 | 北京中科联众科技股份有限公司 | Method for making point bitmap, and goods-fleeing prevention verification method |
CN102270294A (en) * | 2011-08-12 | 2011-12-07 | 华南农业大学 | Bar code and two-dimension code hybrid coding and decoding methods and devices |
CN102521679A (en) * | 2011-11-03 | 2012-06-27 | 北京农业信息技术研究中心 | Agricultural product electronic tracing supervision code generation method and apparatus thereof |
Cited By (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103646331B (en) * | 2013-11-22 | 2017-06-06 | 江西省计算技术研究所 | Wine anti-counterfeit source tracing method based on enciphered bar code mark |
CN103646331A (en) * | 2013-11-22 | 2014-03-19 | 江西省计算技术研究所 | A liquor false proof traceablility method based on encrypted bar code identifiers |
CN104751342B (en) * | 2015-04-21 | 2019-01-11 | 张川 | It is a kind of for tracing the merchandise news decoding method of commodity |
CN104766217A (en) * | 2015-04-21 | 2015-07-08 | 张川 | Commodity information coding method and commodity information decoding method used in interference process |
CN104751342A (en) * | 2015-04-21 | 2015-07-01 | 张川 | Commodity information coding and decoding method for tracking commodities |
CN104766217B (en) * | 2015-04-21 | 2019-03-29 | 张川 | A kind of merchandise news coding method, coding/decoding method when being disturbed |
CN105450399A (en) * | 2015-12-23 | 2016-03-30 | 山东省农业机械科学研究院 | Anti-fake tracing method based on hyper-elliptic curve cryptosystem |
CN108337082A (en) * | 2017-12-28 | 2018-07-27 | 浙江兆信数码技术有限公司 | Encryption method and system for security code |
CN108848135B (en) * | 2018-05-29 | 2021-01-19 | 中化现代农业有限公司 | Agricultural product information pushing method, agricultural product information acquisition method, agricultural product information pushing device, agricultural product information acquisition device and agricultural product information pushing system |
CN108848135A (en) * | 2018-05-29 | 2018-11-20 | 中化现代农业有限公司 | Agricultural product information method for pushing, acquisition methods and device, system |
CN108833703A (en) * | 2018-06-20 | 2018-11-16 | 深圳正品创想科技有限公司 | A kind of commodity association message rendering method and its device, mobile terminal |
CN109255625A (en) * | 2018-08-16 | 2019-01-22 | 山东省标准化研究院 | Electric business transaction platform trace back data interface system and method based on bar code |
CN110006831A (en) * | 2019-03-19 | 2019-07-12 | 江苏大学 | A kind of instant tea powder Quality Safety retrospective device and method based on Fast Detection Technique |
CN110006831B (en) * | 2019-03-19 | 2021-10-12 | 江苏大学 | Instant tea powder quality safety tracing device and method based on rapid detection technology |
CN110782263A (en) * | 2019-11-04 | 2020-02-11 | 中国电子信息产业发展研究院 | Method for capturing, removing duplicate and repairing tracing data |
CN111612440A (en) * | 2020-03-11 | 2020-09-01 | 上海十进制网络信息科技有限公司 | Digital currency circulation method, device, server and readable storage medium |
CN111612440B (en) * | 2020-03-11 | 2024-03-12 | 上海十进制网络信息科技有限公司 | Method and device for circulating digital currency, server and readable storage medium |
CN111798254A (en) * | 2020-09-08 | 2020-10-20 | 平安国际智慧城市科技股份有限公司 | Tracing code generation method, device, equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102968725A (en) | Method for tracing anti-fake markings for agricultural product | |
CN109472338B (en) | Batch generation method of commodity anti-counterfeiting two-dimensional codes | |
CN102184380B (en) | Color-superposition two-dimension code system and application method thereof | |
CN104486073B (en) | A kind of encryption and decryption method of character type data | |
CN104680220B (en) | A kind of commodity counterfeit prevention code Mass production method | |
CN105447546B (en) | The two dimensional code and its coding and decoding methods and equipment of embeddable large scale figure | |
CN101086761A (en) | Efficient information lattice image and its generation and decoding method | |
CN103310255A (en) | Color character encoding method and decoding method | |
CN103646331B (en) | Wine anti-counterfeit source tracing method based on enciphered bar code mark | |
CN102930192A (en) | Method for generating and acquiring safety information and relevant devices | |
CN102916804A (en) | Two-dimension code coding and decoding method and device based on local color verification | |
CN104527535B (en) | A kind of automotive license plate of band encryption QR Quick Response Code | |
CN104091272A (en) | Identifying and tracing system with unique identity and method | |
CN106874819B (en) | It can be by sparse horizontal and vertical parity check code control method of handset identity | |
CN102521679B (en) | Agricultural product electronic tracing supervision code generation method and apparatus thereof | |
Sun et al. | Anti-counterfeit code for aquatic product identification for traceability and supervision in China | |
CN104657871A (en) | Generation method of commodity anti-counterfeiting code | |
CN107609621A (en) | A kind of dot matrix security code design method and its application system based on chaos encryption | |
CN107239709A (en) | A kind of method of New chaotic image encryption, apparatus and system | |
CN112163230B (en) | Commodity anti-counterfeiting code generation method based on Chinese character encryption | |
CN106789063B (en) | A kind of double factor authentication method based on convolution sum circulation dual coding | |
CN111062456A (en) | Two-dimensional code encryption algorithm | |
CN112217627B (en) | Layered encrypted commodity anti-counterfeiting code generation method | |
CN104899521B (en) | 18 ID card No. bleachings and reverse method for bleaching | |
CN110290511A (en) | The method and device of RFID label tag encryption |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20130313 |