CN113159252A - Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules - Google Patents

Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules Download PDF

Info

Publication number
CN113159252A
CN113159252A CN202110378301.8A CN202110378301A CN113159252A CN 113159252 A CN113159252 A CN 113159252A CN 202110378301 A CN202110378301 A CN 202110378301A CN 113159252 A CN113159252 A CN 113159252A
Authority
CN
China
Prior art keywords
sequence
scrambling
rule
matrix
position change
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110378301.8A
Other languages
Chinese (zh)
Inventor
盛苏英
刘焰森
陆国平
张小美
张振娟
吴新华
任洁
朱建红
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nantong University
Original Assignee
Nantong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nantong University filed Critical Nantong University
Priority to CN202110378301.8A priority Critical patent/CN113159252A/en
Publication of CN113159252A publication Critical patent/CN113159252A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record 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/06009Record 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/06037Record 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

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Bakery Products And Manufacturing Methods Therefor (AREA)

Abstract

The invention discloses a commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules, which comprises the following steps: carrying out numerical data and 8-bit binary conversion on a commodity identification code representing unique identity information of a certain commodity to obtain a combined binary matrix B; adjusting extraction positions in real time, performing chaotic iteration and extracting to generate chaotic sequences Y1 and Y2; respectively carrying out row-column scrambling and row-column scrambling on the matrix B according to different scrambling rules by respectively utilizing respective ascending or descending sorting front and rear position change rules of the sequence Y1 and the sequence Y2 to obtain a binary matrix after row-column scrambling
Figure DDA0003011689380000011
Will matrix
Figure DDA0003011689380000012
And the numerical data converted from each row of elements are sequentially filled in a matrix representing the gray level picture to generate a gray level image, and the gray level image is combined to generate the commodity anti-counterfeiting two-dimensional code. The invention providesThe commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules is simple and feasible, has strong safety and is not easy to crack, and the generated commodity anti-counterfeiting two-dimensional code has uniqueness and non-forgeability.

Description

Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules
Technical Field
The invention relates to the technical field of digital anti-counterfeiting, in particular to a commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules.
Background
The digital anti-counterfeiting technology is based on increasingly rampant counterfeit and inferior products, and the modern digital anti-counterfeiting technology is a novel high-tech anti-counterfeiting technology which comprehensively utilizes the technologies of digital coding technology, encryption technology, database technology, computer network, interactive voice processing (IRV) and the like. The digital anti-counterfeiting technology is developed comprehensively due to various defects of the traditional anti-counterfeiting technology, and the different digital anti-counterfeiting technologies according to anti-counterfeiting code generation modes mainly go through three stages of a random bar code anti-counterfeiting model, an encrypted ordered serial number anti-counterfeiting model and a comprehensive anti-counterfeiting model. Under the continuous efforts of all people, the digital anti-counterfeiting technology has become one of the most widely applied technologies in the anti-counterfeiting industry, and plays a very important role in the field of product anti-counterfeiting.
With the continuous progress of society, the market is increasingly developed. For enterprises, digital anti-counterfeiting can keep good brands. Meanwhile, the anti-counterfeiting mode of 'one object and one code' greatly increases the counterfeiting cost of counterfeiters, can record the positioning information of products, count the product inquiry times and the inquiry mode, and set the inquiry warning line according to the enterprise requirements. At present, an intelligent terminal becomes an important part in daily life of people, a digital anti-counterfeiting technology is gradually integrated into the Internet, a user scans a commodity anti-counterfeiting two-dimensional code through the intelligent terminal to perform one-key type authenticity query, and the development and popularization of the Internet lay a good foundation for landing of a digital anti-counterfeiting system.
The most fundamental part in digital anti-counterfeiting is to generate a commodity anti-counterfeiting code by using an encryption algorithm, wherein the selection of the encryption algorithm becomes more important. The chaotic system has high randomness and parameter sensitivity, and the generated chaotic signal has great influence on the diffusivity and the scrambling of the encrypted signal, so that the chaotic signal is used as a natural password and introduced into digital anti-counterfeiting encryption, and the encryption of commodity information by using the chaotic password technology is a good choice. Under the condition, by utilizing the chaotic cipher technology, a commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules is provided to generate a commodity anti-counterfeiting two-dimensional code with uniqueness and non-forgeability, so that the method has good practical application and popularization values.
Disclosure of Invention
The purpose of the invention is as follows: the invention aims to solve the defects in the prior art and provides a commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules, which comprises the steps of utilizing chaotic mapping iteration to extract generated chaotic sequences, scrambling the combination converted from commodity identification codes according to the different scrambling rules according to rows and columns respectively, sequentially filling numerical data converted from each column of elements in a binary matrix after the rows and columns are scrambled into a matrix representing a gray level picture to generate a gray level image, and further combining to generate a commodity anti-counterfeiting two-dimensional code.
The technical scheme is as follows: a commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules is characterized by comprising the following steps:
(1) transcoding
Firstly, a commodity identification code A representing unique identity information of a certain commodity is converted into numerical data one by one to obtain a numerical sequence
Figure BDA0003011689360000021
Then, sequentially adding the elements in the numerical sequence PPiOne by one into a binary sequence of 8bits PBi1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8And will be
Figure BDA0003011689360000022
A binary sequence PBi1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8Fill it column by column from left to right in matrix B, where
Figure BDA0003011689360000023
A row of the matrix corresponds to a bit of each binary sequence, resulting in a combined binary matrix B,
Figure BDA0003011689360000024
wherein the commodity identification code A is a character of GBK code, and the length of the commodity identification code A is expressed as
Figure BDA0003011689360000025
The length of the numerical sequence P is
Figure BDA0003011689360000026
The size of the combined binary matrix B is
Figure BDA0003011689360000027
And is
Figure BDA0003011689360000028
(2) Generation of chaotic sequences
Firstly, an initial value x of Bernoulli chaotic mapping is respectively calculated and obtained by utilizing a numerical value sequence P and a combined binary matrix B converted by the numerical value sequence P and external keys alpha and beta according to the following formulas (1) to (3)1And a parameter lambda and a primary extraction position n,
order to
Figure BDA0003011689360000029
Then
x1=0.02+mod(α+kp,0.98), (1)
λ=0.01+mod(β+kp,0.99), (2)
Figure BDA00030116893600000210
Wherein the content of the first and second substances,<B>indicating the number of binary bits '0' contained in the combined binary matrix B, the external key satisfies α ∈ (0,1), β ∈ (0,1),
Figure BDA00030116893600000211
meaning that a number is rounded and the rounded value is not greater than the number,
then, the initial value x mapped by chaos1And a parameter lambda, iterating the Bernoulli chaotic mapping shown in the following formula (4), wherein k represents iteration times (k is 1, 2.), xk+1Represents the chaotic signal obtained by the k-th iteration,
Figure BDA0003011689360000031
obtaining a chaotic sequence X ═ X1,x2,...},
Finally, for the chaos sequence X ═ X1,x2,.. } the following operations are performed:
s10, making the chaotic sequence Y be a null sequence, and i is equal to 1,
s11, extracting the nth element from the chaotic sequence X and putting the nth element into the chaotic sequence Y, namely Y ═ Y, Xn],
S12, comparing i with
Figure BDA0003011689360000032
Size of (1), if
Figure BDA0003011689360000033
Then to the extraction positionn is adjusted as in the following equation (5) and i is made i +1, followed by the flow of the process to step S11,
Figure BDA0003011689360000034
if it is
Figure BDA0003011689360000035
The operation is stopped to obtain a chaotic sequence
Figure BDA0003011689360000036
(3) Scrambling of combined binary matrix B
First, from a chaotic sequence
Figure BDA0003011689360000037
Continuously extracting 8 elements from the 1 st element to obtain a chaotic sequence Y1 ═ Y11,Y12,...,Y17,Y18}={Y1,Y2,...,Y7,Y8From chaotic sequences simultaneously
Figure BDA0003011689360000038
The 9 th element starts to be continuously extracted
Figure BDA0003011689360000039
Element by element to obtain chaotic sequence
Figure BDA00030116893600000310
Then, the parameter rule _ select is calculated according to the following formula (6), different scrambling rules are selected according to the rule _ select,
Figure BDA00030116893600000311
when the rule _ select is 0, sorting the chaos sequence Y1 in descending order, and scrambling the rule according to the position change of the chaos sequence Y1 before and after sortingThen, the combined binary matrix B is scrambled according to rows to obtain a row-scrambled binary matrix
Figure BDA00030116893600000312
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18Sorting the chaotic sequence Y2 in a descending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure BDA00030116893600000313
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure BDA00030116893600000314
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA00030116893600000315
Figure BDA0003011689360000041
When the rule _ select is 1, sorting the chaos sequence Y1 in descending order, scrambling the combined binary matrix B according to rows according to the position change scrambling rule before and after the chaos sequence Y1 sorting to obtain the binary matrix after row scrambling
Figure BDA0003011689360000042
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18And sorting the chaotic sequence Y2 in ascending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure BDA0003011689360000043
Scrambling by row to obtain the scrambled row and columnBinary matrix
Figure BDA0003011689360000044
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000045
Figure BDA0003011689360000046
Figure BDA0003011689360000051
When the rule _ select is 2, sorting the chaos sequence Y1 in ascending order, scrambling the combined binary matrix B according to the row according to the position change scrambling rule before and after the chaos sequence Y1, and obtaining the binary matrix after row scrambling
Figure BDA0003011689360000052
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18Sorting the chaotic sequence Y2 in a descending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure BDA0003011689360000053
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure BDA0003011689360000054
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000055
Figure BDA0003011689360000056
When the rule _ select is 3, sorting the chaos sequence Y1 in ascending order, scrambling the combined binary matrix B according to the row according to the position change scrambling rule before and after the chaos sequence Y1 sorting to obtain the binary matrix after row scrambling
Figure BDA0003011689360000057
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18And sorting the chaotic sequence Y2 in ascending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure BDA0003011689360000061
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure BDA0003011689360000062
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000063
Figure BDA0003011689360000064
When the rule _ select is 4, sorting the chaos sequence Y2 in descending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y2, and obtaining the binary matrix after the column scrambling
Figure BDA0003011689360000065
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000066
Then the chaotic sequence Y1 is reducedSequencing, namely sequencing the binary matrix after the sequence scrambling according to the position change scrambling rule before and after the sequence of the chaotic sequence Y1
Figure BDA0003011689360000067
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000068
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure BDA0003011689360000069
Figure BDA0003011689360000071
When the rule _ select is 5, sorting the chaos sequence Y2 in descending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after sorting the chaos sequence Y2 to obtain a binary matrix after column scrambling
Figure BDA0003011689360000072
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000073
Then the chaotic sequence Y1 is sorted in ascending order, and the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure BDA0003011689360000074
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000075
Wherein the position change position of the chaos sequence Y1 before and after the sequenceThe random rule may be expressed as { T1 }1,T12,...,T17,T18},
Figure BDA0003011689360000076
When the rule _ select is 6, sorting the chaos sequence Y2 in ascending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y2, and obtaining the binary matrix after the column scrambling
Figure BDA0003011689360000077
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000078
Then the chaotic sequence Y1 is sorted in descending order, the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure BDA0003011689360000081
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000082
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure BDA0003011689360000083
When the rule _ select is 7, sorting the chaos sequence Y2 in ascending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y2, and obtaining the binary matrix after the column scrambling
Figure BDA0003011689360000084
Wherein the sequence Y is chaotic2 the position change scrambling rule before and after the ordering can be expressed as
Figure BDA0003011689360000085
Then the chaotic sequence Y1 is sorted in ascending order, and the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure BDA0003011689360000086
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000087
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure BDA0003011689360000088
Figure BDA0003011689360000091
Finally, the binary matrix after the row and column scrambling is orderly carried out
Figure BDA0003011689360000092
Each column of elements of
Figure BDA0003011689360000093
Conversion into numerical data
Figure BDA0003011689360000094
Wherein
Figure BDA0003011689360000095
Is shown as
Figure BDA0003011689360000096
Thereby obtaining a numerical sequence
Figure BDA0003011689360000097
(4) Two-dimensional code generation
Figure BDA0003011689360000098
Wherein the content of the first and second substances,
Figure BDA0003011689360000099
meaning that a number is rounded and the rounded value is not less than the number,
then, according to the self-defined matrix data filling rule, the numerical value sequence is processed
Figure BDA00030116893600000910
The medium elements are sequentially filled into a matrix M representing the gray-scale picture, so as to generate a gray-scale picture C, wherein the size of the matrix M is H multiplied by L, the size of the gray-scale picture C is 30H multiplied by 30L,
and finally, combining the commodity identification code A with the generated gray picture C, and converting the combined commodity identification code and gray picture into a two-dimensional code by using a two-dimensional code generator, thereby obtaining the commodity anti-counterfeiting two-dimensional code.
Further, in the method for generating the anti-counterfeiting two-dimensional code for the commodity based on different scrambling rules, the step (1) of converting the commodity identification code A representing the unique identity information of a certain commodity into numerical data one by converting characters in the commodity identification code A into the numerical data one by adopting a unicode2native (·) function, namely, the conversion of double-byte characters is expressed as
Figure BDA00030116893600000911
For a single byte character, the conversion is expressed as
Figure BDA00030116893600000912
Thereby obtaining a numerical sequence
Figure BDA00030116893600000914
Further, in the commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules, the elements P in the numerical sequence P are sequentially combined in the step (1)iOne by one into a binary sequence of 8bits PBi1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8Means that dec2bin (P) is usedi8) function, i.e. [ PB ]i1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8]=dec 2 bin(Pi,8)。
Further, in the commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules, the numerical value sequence is filled according to the customized matrix data filling rule in the step (4)
Figure BDA00030116893600000913
The middle elements are sequentially filled in a matrix M representing the gray level picture, and the method comprises the following three steps:
step 1. judging numerical value sequence
Figure BDA0003011689360000101
Length of (2)
Figure BDA0003011689360000102
Whether or not it is less than the value H x L,
if so, then in the numerical sequence
Figure BDA0003011689360000103
On the tail end of
Figure BDA0003011689360000104
Element, value size 0 and last element size
Figure BDA0003011689360000105
Obtaining a supplemented numerical sequence
Figure BDA0003011689360000106
Namely, it is
Figure BDA0003011689360000107
If not, the appended sequence of values is ordered
Figure BDA0003011689360000108
Is equal to a sequence of values
Figure BDA0003011689360000109
Namely, it is
Figure BDA00030116893600001010
And 2, starting from the position of the upper left corner of the matrix M representing the gray level picture, sequentially sequencing the supplemented numerical value sequence from left to right according to rows and each row
Figure BDA00030116893600001011
The medium elements are filled in a matrix M, which is expressed as follows,
Figure BDA00030116893600001012
step 3, each element in the matrix M is respectively replaced by a small matrix block, the matrix size of the small matrix block is 30 multiplied by 30, the element value is consistent with the element value in M, the expression is as follows,
Figure BDA00030116893600001013
the matrix MC is converted into a grayscale picture, thereby generating a grayscale picture C, wherein the size of the grayscale picture C is 30 hx 30L.
Further, the commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules combines the commodity identification code A and the generated gray-scale picture C in the step (4), which means that the generated gray-scale picture C and the commodity identification code A are connected up and down, that is, the commodity identification code A is placed right below the generated gray-scale picture C.
Has the advantages that: the invention utilizes chaotic mapping iteration and randomly extracts generated chaotic sequences, carries out scrambling on a combined binary matrix converted from a commodity identification code according to different scrambling rules of rows and columns respectively, fills numerical data converted from each column of elements in the binary matrix after the rows and columns are scrambled into a matrix representing a gray image in sequence to generate a gray image, and then combines to generate the commodity anti-counterfeiting two-dimensional code, thereby ensuring that the provided commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules is simple and feasible, has strong safety and is not easy to crack, and the generated commodity anti-counterfeiting two-dimensional code has uniqueness and non-counterfeiting property.
Drawings
FIG. 1 is a schematic diagram of a commodity anti-counterfeiting two-dimensional code generation process based on chaotic scrambling encryption according to the present invention;
fig. 2 is a grayscale picture C in embodiment 1 of the present invention;
fig. 3 is a two-dimensional anti-counterfeit code for merchandise in embodiment 1 of the present invention.
Detailed Description
As shown in fig. 1, a method for generating an anti-counterfeit two-dimensional code for a commodity based on different scrambling rules includes the following steps:
(1) transcoding
Firstly, a commodity identification code A representing the unique identity information of a certain commodity is converted into numerical data one by adopting a unicode2native (·) function, namely the conversion of double-byte characters is expressed as
Figure BDA0003011689360000111
For a single byte character, the conversion is expressed as
Figure BDA0003011689360000112
Thereby obtaining a numerical sequence
Figure BDA0003011689360000113
Figure BDA0003011689360000114
Then, dec2bin (P) was usedi8) function, sequentially combining the elements P in the numerical sequence PiOne by one into a binary sequence of 8bits PBi1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8And will be
Figure BDA0003011689360000115
A binary sequence PBi1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8Fill it column by column from left to right in matrix B, where
Figure BDA0003011689360000116
A row of the matrix corresponds to a bit of each binary sequence, resulting in a combined binary matrix B,
Figure BDA0003011689360000117
wherein the commodity identification code A is a character of GBK code, and the length of the commodity identification code A is expressed as
Figure BDA0003011689360000118
The length of the numerical sequence P is
Figure BDA0003011689360000119
The size of the combined binary matrix B is
Figure BDA00030116893600001110
And is
Figure BDA00030116893600001111
(2) Generation of chaotic sequences
Firstly, an initial value x of Bernoulli chaotic mapping is respectively calculated and obtained by using a numerical value sequence P and a combined binary matrix B converted by the numerical value sequence P, and external keys alpha and beta according to the following formula1And a parameter lambda and a primary extraction position n,
order to
Figure BDA0003011689360000121
Then
x1=0.02+mod(α+kp,0.98),
λ=0.01+mod(β+kp,0.99),
Figure BDA0003011689360000122
Wherein the content of the first and second substances,<B>indicating the number of binary bits '0' contained in the combined binary matrix B, the external key satisfies α ∈ (0,1), β ∈ (0,1),
Figure BDA0003011689360000123
meaning that a number is rounded and the rounded value is not greater than the number,
then, the initial value x mapped by chaos1And a parameter lambda, iterating the Bernoulli chaotic mapping shown in the following formula, wherein k represents iteration times (k is 1, 2.), xk+1Represents the chaotic signal obtained by the k-th iteration,
Figure BDA0003011689360000124
obtaining a chaotic sequence X ═ X1,x2,...},
Finally, for the chaos sequence X ═ X1,x2,.. } the following operations are performed:
s10, making the chaotic sequence Y be a null sequence, and i is equal to 1,
s11, extracting the nth element from the chaotic sequence X and putting the nth element into the chaotic sequence Y, namely Y ═ Y, Xn],
S12, comparing i with
Figure BDA0003011689360000125
Size of (1), if
Figure BDA0003011689360000126
Then pair of extractionThe position n is adjusted as shown below, and i is made i +1, followed by a shift to step S11,
Figure BDA0003011689360000127
if it is
Figure BDA0003011689360000128
The operation is stopped to obtain a chaotic sequence
Figure BDA0003011689360000129
(3) Scrambling of combined binary matrix B
First, from a chaotic sequence
Figure BDA00030116893600001210
Continuously extracting 8 elements from the 1 st element to obtain a chaotic sequence Y1 ═ Y11,Y12,...,Y17,Y18}={Y1,Y2,...,Y7,Y8From chaotic sequences simultaneously
Figure BDA00030116893600001211
The 9 th element starts to be continuously extracted
Figure BDA00030116893600001212
Element by element to obtain chaotic sequence
Figure BDA00030116893600001213
Then, the parameter rule _ select is calculated according to the following formula, different scrambling rules are selected according to the rule _ select,
Figure BDA00030116893600001214
when the rule _ select is 0, sorting the chaotic sequence Y1 in descending order, and sorting the positions before and after according to the chaotic sequence Y1Changing the scrambling rule, scrambling the combined binary matrix B according to rows to obtain a binary matrix after row scrambling
Figure BDA00030116893600001215
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18Sorting the chaotic sequence Y2 in a descending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure BDA0003011689360000131
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure BDA0003011689360000132
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000133
Figure BDA0003011689360000134
When the rule _ select is 1, sorting the chaos sequence Y1 in descending order, scrambling the combined binary matrix B according to rows according to the position change scrambling rule before and after the chaos sequence Y1 sorting to obtain the binary matrix after row scrambling
Figure BDA0003011689360000135
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18And sorting the chaotic sequence Y2 in ascending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure BDA0003011689360000136
Scrambling by row to obtain rows and columnsScrambled binary matrix
Figure BDA0003011689360000137
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000138
Figure BDA0003011689360000141
When the rule _ select is 2, sorting the chaos sequence Y1 in ascending order, scrambling the combined binary matrix B according to the row according to the position change scrambling rule before and after the chaos sequence Y1, and obtaining the binary matrix after row scrambling
Figure BDA0003011689360000142
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18Sorting the chaotic sequence Y2 in a descending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure BDA0003011689360000143
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure BDA0003011689360000144
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000145
Figure BDA0003011689360000146
Figure BDA0003011689360000151
When the rule _ select is 3, sorting the chaos sequence Y1 in ascending order, scrambling the combined binary matrix B according to the row according to the position change scrambling rule before and after the chaos sequence Y1 sorting to obtain the binary matrix after row scrambling
Figure BDA0003011689360000152
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18And sorting the chaotic sequence Y2 in ascending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure BDA0003011689360000153
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure BDA0003011689360000154
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000155
Figure BDA0003011689360000156
When the rule _ select is 4, sorting the chaos sequence Y2 in descending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y2, and obtaining the binary matrix after the column scrambling
Figure BDA0003011689360000157
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000158
Then the chaotic sequence Y1 is pressedSorting in descending order, and scrambling the binary matrix after column scrambling according to the position change scrambling rule before and after the chaos sequence Y1
Figure BDA0003011689360000161
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000162
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure BDA0003011689360000163
When the rule _ select is 5, sorting the chaos sequence Y2 in descending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after sorting the chaos sequence Y2 to obtain a binary matrix after column scrambling
Figure BDA0003011689360000164
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000165
Then the chaotic sequence Y1 is sorted in ascending order, and the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure BDA0003011689360000166
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000167
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure BDA0003011689360000168
Figure BDA0003011689360000171
When the rule _ select is 6, sorting the chaos sequence Y2 in ascending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y2, and obtaining the binary matrix after the column scrambling
Figure BDA0003011689360000172
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure BDA0003011689360000173
Then the chaotic sequence Y1 is sorted in descending order, the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure BDA0003011689360000174
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000175
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure BDA0003011689360000176
When the rule _ select is 7, sorting the chaos sequence Y2 in ascending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y2, and obtaining the binary matrix after the column scrambling
Figure BDA0003011689360000177
Wherein the order of chaosThe position change scrambling rule before and after the rank Y2 can be expressed as
Figure BDA0003011689360000178
Then the chaotic sequence Y1 is sorted in ascending order, and the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure BDA0003011689360000181
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000182
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure BDA0003011689360000183
Finally, the binary matrix after the row and column scrambling is orderly carried out
Figure BDA0003011689360000184
Each column of elements of
Figure BDA0003011689360000185
Conversion into numerical data
Figure BDA0003011689360000186
Wherein
Figure BDA0003011689360000187
Is shown as
Figure BDA0003011689360000188
Thereby obtaining a numerical sequence
Figure BDA0003011689360000189
(4) Two-dimensional code generation
Figure BDA00030116893600001810
Wherein the content of the first and second substances,
Figure BDA00030116893600001811
meaning that a number is rounded and the rounded value is not less than the number,
then, the method comprises the following steps in sequence:
firstly, judging numerical value sequence
Figure BDA00030116893600001812
Length of (2)
Figure BDA00030116893600001813
Whether or not it is less than the value H x L,
if so, then in the numerical sequence
Figure BDA00030116893600001814
On the tail end of
Figure BDA00030116893600001815
Element, value size 0 and last element size
Figure BDA00030116893600001816
Obtaining a supplemented numerical sequence
Figure BDA00030116893600001817
Namely, it is
Figure BDA00030116893600001818
If not, the appended sequence of values is ordered
Figure BDA0003011689360000191
Is equal to a sequence of values
Figure BDA0003011689360000192
Namely, it is
Figure BDA0003011689360000193
The supplemented numerical value sequence is sequentially arranged from the upper left corner of the matrix M representing the gray level picture according to the rows and from left to right of each row
Figure BDA0003011689360000194
The medium elements are filled in a matrix M, which is expressed as follows,
Figure BDA0003011689360000195
replacing each element in the matrix M with a small matrix block, wherein the matrix size of the small matrix block is 30 multiplied by 30, the element values are all consistent with the element values in the matrix M, and the element values are expressed as follows,
Figure BDA0003011689360000196
the matrix MC is converted into a grayscale picture, thereby generating a grayscale picture C, wherein the grayscale picture C has a size of 30H x 30L,
and finally, the generated gray picture C and the commodity identification code A are connected vertically in a combined mode, namely the commodity identification code A is placed under the generated gray picture C, and the combined commodity identification code and the gray picture are converted into a two-dimensional code by using a two-dimensional code generator, so that the commodity anti-counterfeiting two-dimensional code is obtained.
The invention is further illustrated by the following specific examples:
example 1
According to the commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules, the steps are as follows:
(1) first, a product identification code a representing unique identification information of a certain product is converted into numerical data one by one from a product identification code a "product identification code a of a product production date 2021-01-01 production line ii 01 production serial number 123456" of a # group x company of jiangsu province, so as to obtain a numerical sequence P of {189,173,203,213,202,161,163, 188,175,205,197,161,193, 185,171,203,190,161,238,42,42, 201,204,198,183,32,201,250,178,250,200,213,198,218,50,48,50,49,45,48,49,45,48,49,32,201,250,178,250,207,223,162,242,163,176,163,177,32,201,250,178,250,208,242,186,197,163,177,163,178,163,179,163,180,163,181,163,182}, in which the article identification code A is a GBK-encoded character and the length of the article identification code A is indicated as
Figure BDA0003011689360000201
The length of the numerical sequence P is
Figure BDA0003011689360000202
Then, sequentially adding the elements P in the numerical sequence PiConverting into binary sequences of 8bits one by one, and filling the binary sequences into a binary matrix B column by column from left to right to obtain a combined binary matrix B,
Figure BDA0003011689360000203
(2) generation of chaotic sequences
Firstly, using the value sequence P and its transformed binary matrix B, and the external keys α -0.12345 and β -0.54321, respectively calculating the initial values x of the Bernoulli chaotic map according to the following formulas1And a parameter lambda and a primary extraction position n,
order to
Figure BDA0003011689360000204
Then
x1=0.02+mod(0.12345+0.320977516596008,0.98)=0.464427516596008,
λ=0.01+mod(0.54321+0.320977516596008,0.99)=0.874187516596008,
Figure BDA0003011689360000205
Then, the user can use the device to perform the operation,initial value x mapped by chaos10.464427516596008 and 0.874187516596008, iterating the Bernoulli chaotic mapping shown in the following formula to obtain a chaotic sequence X ═ X ═ 0.8741875165960081,x2,...},
Figure BDA0003011689360000206
Finally, for the chaos sequence X ═ X1,x2,.. } the following operations are performed:
s10, making the chaotic sequence Y be a null sequence, and i is equal to 1,
s11, extracting the nth element from the chaotic sequence X and putting the nth element into the chaotic sequence Y, namely Y ═ Y, Xn],
S12, comparing the magnitudes of i and 93, if i < 93, adjusting the extraction position n according to the following formula, and making i equal to i +1, then going to step S11,
Figure BDA0003011689360000211
if i is 93, the operation is stopped, and a chaotic sequence Y is obtained1,Y2,...,Y92,Y93};
(3) Row and column scrambling of combined binary matrix B
First, from the chaotic sequence Y ═ Y1,Y2,...,Y92,Y93Sequentially extracting 8 elements from the 1 st element to obtain a chaotic sequence Y1 ═ Y1,Y2,...,Y7,Y8From the chaotic sequence Y ═ Y at the same time1,Y2,...,Y92,Y93Extracting 85 elements from the 9 th element in sequence to obtain a chaotic sequence Y2 ═ Y21,Y22,...,Y284,Y285},
Then, the parameter rule _ select is calculated according to the formula shown below, different scrambling rules are selected according to the rule _ select,
rule_select=mod(26024+4176991+6502309+13812+331,8)=3,
when the rule _ select is 3, sorting the chaos sequence Y1 in ascending order, and performing row scrambling on the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y1 to obtain a row-scrambled binary matrix B
Figure BDA0003011689360000212
The position change scrambling rule before and after the chaos sequence Y1 is sequenced can be expressed as {2,4,6,1,7,3,5,8}, then the chaos sequence Y2 is sequenced in ascending order, and the binary matrix after row scrambling is performed according to the position change scrambling rule before and after the chaos sequence Y2
Figure BDA0003011689360000213
Performing row-column scrambling to obtain a binary matrix after row-column scrambling
Figure BDA0003011689360000214
The chaotic sequence Y2 has a position change scrambling rule before and after the sequence, which can be expressed as {77,82,75,29,35,65,31,56,23,79,69,8,78,52,49,83,4,68,64,63,45,85,21,81,24,66,59,40,39,76,55,26,5,58,38,37,44,28,46,18,34,42,62,54,84,30,47,53,3,73,27,70,61,33,9,60,74,36,17,19,57,2,72,10,80,13,48,7,11,22,12,20,67,41,14,6,1,43,32,25},
Figure BDA0003011689360000215
Figure BDA0003011689360000221
finally, the binary matrix after the row and column scrambling is orderly carried out
Figure BDA0003011689360000222
Each column of elements of
Figure BDA0003011689360000223
Conversion into numerical data
Figure BDA0003011689360000224
Thereby obtaining a numerical sequence
Figure BDA0003011689360000225
Figure BDA0003011689360000226
(4) Two-dimensional code generation
First, the size of the grayscale picture is determined, and the number of rows H9 and the number of columns L10 are obtained
Then, the method comprises the following steps in sequence:
step I, numerical value sequence
Figure BDA0003011689360000227
Is supplemented with 5 elements, the value size is 0 and the last element size is 85, to obtain the supplemented value sequence
Figure BDA0003011689360000228
Figure BDA0003011689360000229
The supplemented numerical value sequence is sequentially arranged from the upper left corner of the matrix M representing the gray level picture according to the rows and from left to right of each row
Figure BDA00030116893600002210
The medium elements are filled into a matrix M, where the size of the matrix M is 9 x 10, as indicated below,
Figure BDA00030116893600002211
replacing each element in the matrix M with a small matrix block, wherein the matrix size of the small matrix block is 30 multiplied by 30, the element values are all consistent with the element values in the matrix M, and the element values are expressed as follows,
Figure BDA0003011689360000231
the matrix MC is then converted to a grayscale picture, thereby generating a grayscale picture C, as shown in fig. 2, where the grayscale picture C has a size of 270 × 300.
And finally, the generated gray picture C and the commodity identification code A are connected up and down in a combined mode, namely the commodity identification code A is placed under the generated gray picture C, and the combined commodity identification code and the gray picture are converted into a two-dimensional code by using a two-dimensional code generator, so that the commodity anti-counterfeiting two-dimensional code is obtained, as shown in fig. 3.
Example 2
According to the above method for generating the anti-counterfeiting two-dimensional code of the commodity based on different scrambling rules, the steps of generating the commodity identification code character string a of a certain commodity and the anti-counterfeiting two-dimensional code of the commodity are similar to those in embodiment 1, and only a certain external secret key slightly changes: 0.12345000000001; or beta is 0.54321000000001, and the generation result of the anti-counterfeiting two-dimensional code is shown in table 1. As can be seen from the following table: once the external key slightly changes, the generated two-dimensional anti-counterfeiting code for the commodity greatly changes, so that the method for generating the two-dimensional anti-counterfeiting code for the commodity based on different scrambling rules has key sensitivity.
TABLE 1 Generation result of two-dimensional anti-counterfeiting code for commodities when external secret key is slightly changed
Figure BDA0003011689360000232
Figure BDA0003011689360000241
Figure BDA0003011689360000251
Figure BDA0003011689360000261
Example 3
According to the above method for generating the anti-counterfeit two-dimensional code for merchandise based on different scrambling rules, the steps for generating the external key and the anti-counterfeit two-dimensional code for merchandise are similar to those in embodiment 1, and only the character string a of the identification code for merchandise is slightly changed, namely "Gang Suzhou # # group x company". four star company ". production date of merchandise 2021-01-01 production line II 01 production serial number 123456"; or "production date of # group x company of Jiangsu province" product production date 2021-11-01 production line II 01 production number 123456 "; or "jiangsu province # # group x company · commodity production date 2021-01-01 production line ii 02 production serial number 123465", and the generation results of the commodity forgery-proof two-dimensional code are shown in table 2. As can be seen from the following table: once the commodity identification code character string representing the unique identity information of a certain commodity slightly changes, the generated commodity anti-counterfeiting two-dimensional code can greatly change, so that the commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules disclosed by the patent has sensitivity to the commodity identity information (namely the commodity identification code).
TABLE 2 Generation result of two-dimensional anti-counterfeiting code for commodity when commodity identification code is slightly changed
Figure BDA0003011689360000262
Figure BDA0003011689360000271
Figure BDA0003011689360000281
Figure BDA0003011689360000291
As can be seen from the analysis of the above specific embodiments 2 and 3, the anti-counterfeit two-dimensional code generated by the method for generating an anti-counterfeit two-dimensional code for a commodity based on different scrambling rules provided by the present patent is not only closely related to an external secret key, but also depends on a commodity identification code representing unique identity information of a certain piece of commodity, so that the method for generating an anti-counterfeit two-dimensional code for a commodity based on different scrambling rules provided by the present patent has strong security, can better resist known/selected plaintext attacks, is not easy to crack, and ensures that the generated anti-counterfeit two-dimensional code for a commodity has "uniqueness" and "non-forgeability".
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (5)

1. A commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules is characterized by comprising the following steps:
(1) transcoding
Firstly, a commodity identification code A representing unique identity information of a certain commodity is converted into numerical data one by one to obtain a numerical sequence
Figure FDA0003011689350000011
Then, sequentially adding the elements P in the numerical sequence PiOne by one into a binary sequence of 8bits PBi1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8And will be
Figure FDA0003011689350000012
A binary sequence PBi1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8Fill it column by column from left to right in matrix B, where
Figure FDA0003011689350000013
A row of the matrix corresponds to a bit of each binary sequence, resulting in a combined binary matrix B,
Figure FDA0003011689350000014
wherein the commodity identification code A is a character of GBK code, and the length of the commodity identification code A is expressed as
Figure FDA0003011689350000015
The length of the numerical sequence P is
Figure FDA0003011689350000016
The size of the combined binary matrix B is
Figure FDA0003011689350000017
And is
Figure FDA0003011689350000018
(2) Generation of chaotic sequences
Firstly, an initial value x of Bernoulli chaotic mapping is respectively calculated and obtained by utilizing a numerical value sequence P and a combined binary matrix B converted by the numerical value sequence P and external keys alpha and beta according to the following formulas (1) to (3)1And a parameter lambda and a primary extraction position n,
order to
Figure FDA0003011689350000019
Then
x1=0.02+mod(α+kp,0.98), (1)
λ=0.01+mod(β+kp,0.99), (2)
Figure FDA00030116893500000110
Wherein the content of the first and second substances,<B>indicating the number of binary bits '0' contained in the combined binary matrix B, the external key satisfies α ∈ (0,1), β ∈ (0,1),
Figure FDA00030116893500000111
meaning that a number is rounded and the rounded value is not greater than the number,
then, the initial value x mapped by chaos1And a parameter lambda, iterating the Bernoulli chaotic mapping shown in the following formula (4), wherein k represents iteration times (k is 1, 2.), xk+1Represents the chaotic signal obtained by the k-th iteration,
Figure FDA0003011689350000021
obtaining a chaotic sequence X ═ X1,x2,...},
Finally, for the chaos sequence X ═ X1,x2,.. } the following operations are performed:
s10, making the chaotic sequence Y be a null sequence, and i is equal to 1,
s11, extracting the nth element from the chaotic sequence X and putting the nth element into the chaotic sequence Y, namely Y ═ Y, Xn],
S12, comparing i with
Figure FDA0003011689350000022
Size of (1), if
Figure FDA0003011689350000023
Then to the extracted bitN is adjusted as in the following formula (5) and i is made i +1, followed by the flow of control to step S11,
Figure FDA0003011689350000024
if it is
Figure FDA0003011689350000025
The operation is stopped to obtain a chaotic sequence
Figure FDA0003011689350000026
(3) Scrambling of combined binary matrix B
First, from a chaotic sequence
Figure FDA0003011689350000027
Continuously extracting 8 elements from the 1 st element to obtain a chaotic sequence Y1 ═ Y11,Y12,...,Y17,Y18}={Y1,Y2,...,Y7,Y8From chaotic sequences simultaneously
Figure FDA0003011689350000028
The 9 th element starts to be continuously extracted
Figure FDA0003011689350000029
Element by element to obtain chaotic sequence
Figure FDA00030116893500000210
Then, the parameter rule _ select is calculated according to the following formula (6), different scrambling rules are selected according to the rule _ select,
Figure FDA00030116893500000211
when rule _ selecWhen t is 0, sorting the chaotic sequence Y1 in a descending order, scrambling the combined binary matrix B according to rows according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted, and obtaining the binary matrix B after row scrambling
Figure FDA00030116893500000212
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18Sorting the chaotic sequence Y2 in a descending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure FDA00030116893500000213
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure FDA00030116893500000214
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure FDA00030116893500000215
Figure FDA0003011689350000031
When the rule _ select is 1, sorting the chaos sequence Y1 in descending order, scrambling the combined binary matrix B according to rows according to the position change scrambling rule before and after the chaos sequence Y1 sorting to obtain the binary matrix after row scrambling
Figure FDA0003011689350000032
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18And sorting the chaotic sequence Y2 in ascending order, and scrambling the two rows after the row scrambling according to the position change scrambling rule before and after the sorting of the chaotic sequence Y2Binary matrix
Figure FDA0003011689350000033
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure FDA0003011689350000034
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure FDA0003011689350000035
Figure FDA0003011689350000036
Figure FDA0003011689350000041
When the rule _ select is 2, sorting the chaos sequence Y1 in ascending order, scrambling the combined binary matrix B according to the row according to the position change scrambling rule before and after the chaos sequence Y1, and obtaining the binary matrix after row scrambling
Figure FDA0003011689350000042
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18Sorting the chaotic sequence Y2 in a descending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure FDA0003011689350000043
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure FDA0003011689350000044
Wherein the chaos sequence Y2 sequences the front and back bitsThe set change scrambling rule may be expressed as
Figure FDA0003011689350000045
Figure FDA0003011689350000046
When the rule _ select is 3, sorting the chaos sequence Y1 in ascending order, scrambling the combined binary matrix B according to the row according to the position change scrambling rule before and after the chaos sequence Y1 sorting to obtain the binary matrix after row scrambling
Figure FDA0003011689350000047
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18And sorting the chaotic sequence Y2 in ascending order, scrambling the binary matrix after row scrambling according to the position change scrambling rule before and after sorting the chaotic sequence Y2
Figure FDA0003011689350000051
Scrambling by columns to obtain binary matrix with scrambled rows and columns
Figure FDA0003011689350000052
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure FDA0003011689350000053
Figure FDA0003011689350000054
When the rule _ select is 4, sorting the chaos sequence Y2 in descending order, scrambling the combined binary matrix B in columns according to the position change scrambling rule before and after the chaos sequence Y2 to obtain a column scrambling ruleThe latter binary matrix
Figure FDA0003011689350000055
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure FDA0003011689350000056
Then the chaotic sequence Y1 is sorted in descending order, the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure FDA0003011689350000057
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure FDA0003011689350000058
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure FDA0003011689350000059
Figure FDA0003011689350000061
When the rule _ select is 5, sorting the chaos sequence Y2 in descending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after sorting the chaos sequence Y2 to obtain a binary matrix after column scrambling
Figure FDA0003011689350000062
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure FDA0003011689350000063
Then the chaotic sequence is processedY1 is sorted in ascending order, and the binary matrix after column scrambling is sorted according to the position change scrambling rule before and after the chaos sequence Y1
Figure FDA0003011689350000064
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure FDA0003011689350000065
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure FDA0003011689350000066
When the rule _ select is 6, sorting the chaos sequence Y2 in ascending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y2, and obtaining the binary matrix after the column scrambling
Figure FDA0003011689350000067
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure FDA0003011689350000068
Then the chaotic sequence Y1 is sorted in descending order, the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure FDA0003011689350000071
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure FDA0003011689350000072
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure FDA0003011689350000073
When the rule _ select is 7, sorting the chaos sequence Y2 in ascending order, scrambling the combined binary matrix B according to the position change scrambling rule before and after the chaos sequence Y2, and obtaining the binary matrix after the column scrambling
Figure FDA0003011689350000074
The position change scrambling rule of the chaos sequence Y2 before and after the sequence can be expressed as
Figure FDA0003011689350000075
Then the chaotic sequence Y1 is sorted in ascending order, and the binary matrix after column scrambling is carried out according to the position change scrambling rule before and after the chaotic sequence Y1 is sorted
Figure FDA0003011689350000076
Scrambling according to rows to obtain a binary matrix after row-column scrambling
Figure FDA0003011689350000077
The position change scrambling rule of the chaos sequence Y1 before and after the sequence can be expressed as { T1 }1,T12,...,T17,T18},
Figure FDA0003011689350000078
Figure FDA0003011689350000081
Finally, the binary matrix after the row and column scrambling is orderly carried out
Figure FDA0003011689350000082
Each column of elements of
Figure FDA0003011689350000083
Conversion into numerical data
Figure FDA0003011689350000084
Wherein
Figure FDA0003011689350000085
Is shown as
Figure FDA0003011689350000086
Thereby obtaining a numerical sequence
Figure FDA0003011689350000087
(4) Two-dimensional code generation
Firstly, determining the size of the gray picture, making the number of rows be H and the number of columns be L, wherein the number of columns
Figure FDA0003011689350000088
The number of rows H is such that,
Figure FDA0003011689350000089
wherein the content of the first and second substances,
Figure FDA00030116893500000810
meaning that a number is rounded and the rounded value is not less than the number,
then, according to the self-defined matrix data filling rule, the numerical value sequence is processed
Figure FDA00030116893500000811
The medium elements are sequentially filled into a matrix M representing the gray-scale picture, so as to generate a gray-scale picture C, wherein the size of the matrix M is H multiplied by L, the size of the gray-scale picture C is 30H multiplied by 30L,
and finally, combining the commodity identification code A with the generated gray picture C, and converting the combined commodity identification code and gray picture into a two-dimensional code by using a two-dimensional code generator, thereby obtaining the commodity anti-counterfeiting two-dimensional code.
2. The commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules according to claim 1, characterized in that: the step (1) of converting the commodity identification code A representing the unique identity information of a certain commodity into numerical data one by one means that the characters in the commodity identification code A are converted into the numerical data one by adopting a unicode2native () function, namely, the conversion of double-byte characters is expressed as
Figure FDA00030116893500000812
For a single byte character, the conversion is expressed as
Figure FDA00030116893500000813
Thereby obtaining a numerical sequence
Figure FDA00030116893500000814
3. The commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules according to claim 1, characterized in that: sequentially converting the elements P in the numerical value sequence P in the step (1)iOne by one into a binary sequence of 8bits PBi1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8Means that dec2bin (P) is usedi8) function, i.e. [ PB ]i1,PBi2,PBi3,PBi4,PBi5,PBi6,PBi7,PBi8]=dec2bin(Pi,8)。
4. The commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules according to claim 1, characterized in that: the above-mentioned in step (4) is pressedAccording to the self-defined matrix data filling rule, the numerical value sequence is set
Figure FDA0003011689350000091
The middle elements are sequentially filled in a matrix M representing the gray level picture, and the method comprises the following three steps:
step 1. judging numerical value sequence
Figure FDA0003011689350000092
Length of (2)
Figure FDA0003011689350000093
Whether or not it is less than the value H x L,
if so, then in the numerical sequence
Figure FDA0003011689350000094
On the tail end of
Figure FDA0003011689350000095
Element, value size 0 and last element size
Figure FDA0003011689350000096
Obtaining a supplemented numerical sequence
Figure FDA0003011689350000097
Namely, it is
Figure FDA0003011689350000098
If not, the appended sequence of values is ordered
Figure FDA0003011689350000099
Is equal to a sequence of values
Figure FDA00030116893500000910
Namely, it is
Figure FDA00030116893500000911
And 2, starting from the position of the upper left corner of the matrix M representing the gray level picture, sequentially sequencing the supplemented numerical value sequence from left to right according to rows and each row
Figure FDA00030116893500000912
The medium elements are filled in a matrix M, which is expressed as follows,
Figure FDA00030116893500000913
step 3, each element in the matrix M is respectively replaced by a small matrix block, the matrix size of the small matrix block is 30 multiplied by 30, the element value is consistent with the element value in M, the expression is as follows,
Figure FDA00030116893500000914
the matrix MC is converted into a grayscale picture, thereby generating a grayscale picture C, wherein the size of the grayscale picture C is 30 hx 30L.
5. The commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules according to claim 1, characterized in that: the step (4) of combining the commodity identification code A with the generated grayscale picture C refers to a combination mode of connecting the generated grayscale picture C and the commodity identification code A up and down, namely, the commodity identification code A is placed right below the generated grayscale picture C.
CN202110378301.8A 2021-04-08 2021-04-08 Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules Pending CN113159252A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110378301.8A CN113159252A (en) 2021-04-08 2021-04-08 Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110378301.8A CN113159252A (en) 2021-04-08 2021-04-08 Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules

Publications (1)

Publication Number Publication Date
CN113159252A true CN113159252A (en) 2021-07-23

Family

ID=76889099

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110378301.8A Pending CN113159252A (en) 2021-04-08 2021-04-08 Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules

Country Status (1)

Country Link
CN (1) CN113159252A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113935344A (en) * 2021-10-12 2022-01-14 南通大学 Commodity anti-counterfeiting code batch generation method based on trademark picture scrambling encryption
CN113947096A (en) * 2021-10-12 2022-01-18 南通大学 Commodity anti-counterfeiting code identification method based on picture-to-character string decryption

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5751811A (en) * 1995-08-30 1998-05-12 Magnotti; Joseph C. 32N +D bit key encryption-decryption system using chaos
CN109284803A (en) * 2018-11-19 2019-01-29 南通大学 A kind of commodity anti-counterfeit two-dimensional bar code generation method
CN110033066A (en) * 2019-03-21 2019-07-19 江苏工程职业技术学院 A kind of generation method of colour garbage classification two dimensional code
CN111382452A (en) * 2020-02-25 2020-07-07 南通大学 Encryption method for converting Chinese characters into pictures
CN112116046A (en) * 2020-09-28 2020-12-22 江苏工程职业技术学院 Garbage classification two-dimensional code generation method based on layered encryption
CN112149773A (en) * 2020-09-16 2020-12-29 南通大学 Commodity anti-counterfeiting code generation method based on Chinese character encryption

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5751811A (en) * 1995-08-30 1998-05-12 Magnotti; Joseph C. 32N +D bit key encryption-decryption system using chaos
CN109284803A (en) * 2018-11-19 2019-01-29 南通大学 A kind of commodity anti-counterfeit two-dimensional bar code generation method
CN110033066A (en) * 2019-03-21 2019-07-19 江苏工程职业技术学院 A kind of generation method of colour garbage classification two dimensional code
CN111382452A (en) * 2020-02-25 2020-07-07 南通大学 Encryption method for converting Chinese characters into pictures
CN112149773A (en) * 2020-09-16 2020-12-29 南通大学 Commodity anti-counterfeiting code generation method based on Chinese character encryption
CN112116046A (en) * 2020-09-28 2020-12-22 江苏工程职业技术学院 Garbage classification two-dimensional code generation method based on layered encryption

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
盛苏英等: "基于混沌的数码防伪系统研究与实现", 《微电子学与计算机》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113935344A (en) * 2021-10-12 2022-01-14 南通大学 Commodity anti-counterfeiting code batch generation method based on trademark picture scrambling encryption
CN113947096A (en) * 2021-10-12 2022-01-18 南通大学 Commodity anti-counterfeiting code identification method based on picture-to-character string decryption

Similar Documents

Publication Publication Date Title
CN112884104B (en) Commodity anti-counterfeiting two-dimensional code generation method based on chaotic encryption
CN112884105B (en) Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption
CN113255860B (en) Commodity anti-counterfeiting two-dimensional code generation method based on layered encryption
CN113052286A (en) Commodity anti-counterfeiting two-dimensional code generation method based on scrambling encryption
CN109472338B (en) Batch generation method of commodity anti-counterfeiting two-dimensional codes
CN113159252A (en) Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules
CN101847225B (en) A kind of method based on CN39 code managing commodity circulation
CN112001468B (en) Character type commodity anti-counterfeiting code generation and identification method
CN112001467B (en) Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption
CN112163230B (en) Commodity anti-counterfeiting code generation method based on Chinese character encryption
CN112149774B (en) Chinese character commodity anti-counterfeiting code generation method
CN112149773B (en) Commodity anti-counterfeiting code generation method based on Chinese character encryption
CN101237320A (en) Method for password protection for constructing unidirectional hash function based on infinite dimension ultra-chaos
CN111382820B (en) Four-lattice pure-color commodity anti-counterfeiting code generation method
CN112217627B (en) Layered encrypted commodity anti-counterfeiting code generation method
CN111062456A (en) Two-dimensional code encryption algorithm
CN104376236B (en) Scheme self-adaptive digital watermark embedding grammar and extracting method based on camouflage science
CN113935345B (en) Commodity anti-counterfeiting code batch generation method based on character string-to-picture encryption
Mohammed et al. DNA-based steganography using neural networks
CN112101962A (en) Data security anti-counterfeiting control method
CN1255757C (en) Multi-dimension antifraud code using positions and number of deformed characters to express characteristic value of code
CN113935343B (en) Commodity anti-counterfeiting code generation method based on character string-to-picture encryption
CN113947096A (en) Commodity anti-counterfeiting code identification method based on picture-to-character string decryption
CN113935347B (en) Commodity anti-counterfeiting code identification method based on anti-counterfeiting picture scrambling and decryption
CN113935346B (en) Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption

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: 20210723