CN113935346B - Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption - Google Patents

Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption Download PDF

Info

Publication number
CN113935346B
CN113935346B CN202111185829.XA CN202111185829A CN113935346B CN 113935346 B CN113935346 B CN 113935346B CN 202111185829 A CN202111185829 A CN 202111185829A CN 113935346 B CN113935346 B CN 113935346B
Authority
CN
China
Prior art keywords
matrix
column
commodity
row
sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111185829.XA
Other languages
Chinese (zh)
Other versions
CN113935346A (en
Inventor
盛苏英
吴新华
张小美
陆国平
刘焰森
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 CN202111185829.XA priority Critical patent/CN113935346B/en
Publication of CN113935346A publication Critical patent/CN113935346A/en
Application granted granted Critical
Publication of CN113935346B publication Critical patent/CN113935346B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/10009Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation sensing by radiation using wavelengths larger than 0.1 mm, e.g. radio-waves or microwaves
    • G06K7/10257Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation sensing by radiation using wavelengths larger than 0.1 mm, e.g. radio-waves or microwaves arrangements for protecting the interrogation against piracy attacks
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/001Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using chaotic signals

Abstract

The invention discloses a trademark-based picture scrambling encryption methodThe commodity anti-counterfeiting code generation method comprises the following steps: respectively carrying out binary conversion and splicing on the matrixes R, G and B decomposed by the commodity color trademark picture to obtain a combined three-dimensional binary matrix
Figure DDA0003299167880000011
Carrying out numerical value and binary conversion on the commodity identification code to obtain a binary sequence; the chaotic system iterates to obtain chaotic sequences Y1 and Y2 and parameters of matrix row shift and column shift; according to the sequence scrambling rule of the chaotic sequences Y1 and Y2 and the parameters of matrix row shift and matrix column shift, the matrix is subjected to
Figure DDA0003299167880000012
And sequentially carrying out scrambling splicing, line shifting, backfilling reverse scrambling, re-scrambling splicing, column shifting and backfilling reverse scrambling operations to generate a color anti-counterfeiting picture, and combining to generate the commodity anti-counterfeiting two-dimensional code. The commodity anti-counterfeiting code generation method based on the trademark picture scrambling encryption 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 code generation method based on trademark picture scrambling encryption
Technical Field
The invention belongs to the technical field of digital anti-counterfeiting, and particularly relates to a commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption.
Background
The anti-counterfeiting technologies commonly used in the market at present mainly include a paper-grain anti-counterfeiting technology, a laser holographic anti-counterfeiting technology, a chemical ink anti-counterfeiting technology, a nuclear track anti-counterfeiting technology, a code anti-counterfeiting technology, a digital anti-counterfeiting technology and the like. The traditional anti-counterfeiting technology is difficult to be widely applied to the authenticity identification of all commodities due to the limitations of complex manufacturing process, inconvenient identification of anti-counterfeiting labels and the like, and is only limited to the authenticity identification of high-end products. Because of various defects of the traditional anti-counterfeiting technology, the digital anti-counterfeiting technology comes with the move, and the development process is divided into the following steps according to different code making modes: the method comprises three stages of a random bar code anti-counterfeiting model, an encrypted sequential serial number anti-counterfeiting model and a comprehensive anti-counterfeiting model. At present, the digital anti-counterfeiting technology has become one of the most widely applied technologies in the anti-counterfeiting industry, and plays a significant role in the anti-counterfeiting field.
The digital anti-counterfeiting technology is premised on code making, and a two-dimensional code is commonly and widely applied in the code making technology. The two-dimensional code relates to the social life aspect, and from a personal business card in chat software to a transaction medium for mobile payment, the two-dimensional code becomes popular in a code making technology. Meanwhile, the chaotic signal is used as a natural password and is introduced into the generation process of the commodity anti-counterfeiting code, so that the safety is higher.
Disclosure of Invention
The invention aims to solve the defects in the prior art and provides a commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption.
The invention provides a commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption, which comprises the following steps:
(1) transcoding
The unique identity information of a certain commodity is represented by the combination of a commodity color trademark picture and commodity basic information, firstly, the commodity color trademark picture is divided into three primary colors of red, green and blue, which are respectively represented as matrixes R, G and B, elements in the matrixes R, G and B are respectively converted into 8-bit binary systems one by one, and a three-dimensional binary matrix is obtained
Figure BDA0003299167860000011
And
Figure BDA0003299167860000012
and combining the three-dimensional binary matrix
Figure BDA0003299167860000013
And
Figure BDA0003299167860000014
sequentially splicing the two matrixes up and down to obtain a combined three-dimensional binary matrix
Figure BDA0003299167860000015
Then the identification code of the commodity, namely the character string A, representing the basic information of a certain commodity1A2,...,AL-1ALConverting the characters into numerical data one by one to obtain a numerical sequence
Figure BDA0003299167860000016
Then, elements in the numerical sequence P are converted into 8-bit binary one by one to obtain a binary sequence
Figure BDA0003299167860000017
Wherein the size of the color trademark picture is MxN, the size of the matrix R, G, B is MxN, and the size of the three-dimensional binary matrix is M x N
Figure BDA0003299167860000021
Figure BDA0003299167860000022
The number of rows is M, the number of columns is N, the number of layers is 8, and a three-dimensional binary matrix is combined
Figure BDA0003299167860000023
The number of rows is 3M, the number of columns is N, the number of layers is 8, the commodity identification code representing the basic information of the commodity comes from characters of GBK codes, the length of the commodity identification code is L, and the length of the numerical sequence P is L
Figure BDA0003299167860000024
The length of the binary sequence PB is
Figure BDA0003299167860000025
And is
Figure BDA0003299167860000026
(2) Generating chaotic sequences
Firstly, an initial value x of the chaotic system is respectively calculated by using external encryption keys (alpha, beta) according to the following formulas (1) to (4)1Parameter lambda, extraction start position delta1And delta2Let us order
Figure BDA0003299167860000027
Then it is possible to obtain,
x1=mod(Key_inner-α,0.999)+0.001, (1)
λ=2+mod(-Key_inner+β,29), (2)
Figure BDA0003299167860000028
Figure BDA0003299167860000029
wherein α ∈ (0,1), β ∈ (0,100), [ { PB ∈ (PB) ]8i-7,PB8i-6,...,PB8i-1,PB8i}]0Representing a statistical binary sequence PB8i-7,PB8i-6,...,PB8i-1,PB8iThe number of binary '0's present in the tremble,
Figure BDA00032991678600000210
and
Figure BDA00032991678600000211
respectively representing statistical three-dimensional binary matrices
Figure BDA00032991678600000212
To (1) aThe number of binary '1' in the i row, the j column and the 1 st to 8 th layers,
then, the initial value x is calculated1And a parameter lambda, iterating the Chebyshev chaotic system shown in the following formula (5), wherein k represents iteration times, and xk+1Representing the chaotic signal obtained in the k-th iteration, wherein k is 1,2, …, so as to obtain a chaotic sequence X,
xk+1=cos(λ·arccos(xk)) (5)
then extracting the delta-th from the chaotic sequence X1Elements, the number of rows H _ number of the matrix row shift and the reset extraction start position δ are calculated according to the following formula (6)1
Figure BDA0003299167860000031
Extracting the delta-th from the chaotic sequence X1The direction H _ direction of matrix row shift and the reset extraction start position delta are calculated according to the following formula (7)1And a level parameter H _ CM of the row shift matrix,
Figure BDA0003299167860000032
from the chaos sequence X by the δ1Starting to continuously extract 8 +2 elements to obtain a chaos sequence with the length of 8
Figure BDA0003299167860000033
Figure BDA0003299167860000034
Finally, the delta is extracted from the chaos sequence X2Each element is calculated by the following equation (8) to obtain the column number L _ number of matrix column shift and the reset extraction start position δ2
Figure BDA0003299167860000035
Extracting the delta-th from the chaotic sequence X2The direction L _ direction of matrix column shift and the reset extraction start position delta are calculated according to the following formula (9)2And the level parameter L CM of the column shift matrix,
Figure BDA0003299167860000036
from the chaos sequence X by the number delta2Starting to continuously extract 8 +2 elements to obtain a chaos sequence with the length of 8
Figure BDA0003299167860000037
Figure BDA0003299167860000038
(3) Row-shifted scrambling encryption
Firstly, the chaos sequence Y1 is sorted in ascending order, and the combined three-dimensional binary matrix is scrambled according to the position change scrambling rule before and after the sequence Y1
Figure BDA0003299167860000039
The elements are scrambled according to layers to obtain a scrambled combined three-dimensional binary matrix
Figure BDA00032991678600000310
And according to the level parameter H _ CM of the row shift matrix, the following splicing operation is carried out,
if H _ CM is 1, the scrambled combined three-dimensional binary matrix is used
Figure BDA00032991678600000311
Splicing layer by layer to obtain a matrix H to be shiftedRGBIs represented as
Figure BDA0003299167860000041
If H _ CM is 0, then it will beScrambled combined three-dimensional binary matrix
Figure BDA0003299167860000042
Splicing line by line up and down to obtain a matrix H to be shiftedRGBIs shown as
Figure BDA0003299167860000043
Wherein the matrix H to be row shiftedRGBIs 24M x N, and is,
then, according to the number of rows H _ number and direction H _ direction of the matrix row shift, the following whole row shift operation is performed,
if H _ direction is 0, the row to be shifted is shifted by matrix HRGBCircularly shifting the H _ number row in the whole row to obtain a matrix after row shifting
Figure BDA0003299167860000044
If H _ direction is 1, the row to be shifted is shifted by matrix HRGBCircularly shifting down H _ number rows in the whole row to obtain a matrix after row shifting
Figure BDA0003299167860000045
Finally, according to the level parameter H _ CM of the row shift matrix, the following backfill operation is carried out,
if H _ CM is 0, the matrix after row shifting
Figure BDA0003299167860000046
Backfilling the medium elements layer by layer into a three-dimensional binary matrix with 3M row number, N column number and 8 layer number to obtain a row shift three-dimensional binary matrix BH expressed as
Figure BDA0003299167860000047
Figure BDA0003299167860000048
Figure BDA0003299167860000049
Figure BDA00032991678600000410
If H _ CM is 1, the matrix after row shifting
Figure BDA00032991678600000411
Backfilling the medium elements line by line into a three-dimensional binary matrix with 3M row number, N column number and 8 layer number to obtain a line shift three-dimensional binary matrix BH expressed as
Figure BDA00032991678600000412
Figure BDA00032991678600000413
Figure BDA00032991678600000414
Sorting the chaotic sequence Y1 in a descending order, and performing reverse scrambling on the elements of the row-shift three-dimensional binary matrix BH in layers according to the position change scrambling rule before and after sorting the sequence Y1 to obtain a reverse-scrambled row-shift three-dimensional binary matrix
Figure BDA00032991678600000415
(4) Column shifted scrambling encryption
Firstly, the chaos sequence Y2 is sorted in ascending order, and the three-dimensional binary matrix is shifted for the rows after the reverse scrambling according to the position change scrambling rule before and after the sequence Y2
Figure BDA0003299167860000051
Scrambling the elements according to layers to obtain a scrambled three-dimensional binary matrix
Figure BDA0003299167860000052
And according to the level parameter L _ CM of the column shift matrix, the following splicing operation is carried out,
if L _ CM is equal to 1,the scrambled three-dimensional binary matrix is applied
Figure BDA0003299167860000053
Splicing layer by layer to obtain a to-be-listed shift matrix LRGBIs shown as
Figure BDA0003299167860000054
If L _ CM is 0, the three-dimensional binary matrix after scrambling is carried out
Figure BDA0003299167860000055
Splicing the rows one by one to obtain a to-be-row shift matrix LRGBIs shown as
Figure BDA0003299167860000056
Wherein a matrix L is to be column shiftedRGBIs 3M x 8N in size,
then, according to the column number L _ number and the direction L _ direction of the matrix column shift, the following column shift operation is performed,
if L _ direction is 0, the column is shifted by the matrix LRGBCircularly left-shifting the whole column by L _ number row to obtain a matrix after column shifting
Figure BDA0003299167860000057
If L _ direction is 1, the column is shifted by the matrix LRGBCircularly right shifting the whole column by L _ number row to obtain a matrix after column shifting
Figure BDA0003299167860000058
Finally, according to the level parameter L _ CM of the column shift matrix, the following backfill operation is carried out,
if L _ CM is equal to 0, the matrix after column shift
Figure BDA0003299167860000059
Backfilling the medium elements layer by layer into a three-dimensional binary matrix with 3M rows, N columns and 8 layers to obtain the final productShift to the column and column three-dimensional binary matrix BHL, represented as
Figure BDA00032991678600000510
Figure BDA00032991678600000511
Figure BDA00032991678600000512
Figure BDA00032991678600000513
If L _ CM is 1, the matrix after column shifting
Figure BDA00032991678600000514
Backfilling the medium elements column by column into a three-dimensional binary matrix with 3M of row number, N of column number and 8 of layer number to obtain a row-column shift three-dimensional binary matrix BHL (baby hamster Link), which is expressed as
Figure BDA00032991678600000515
Figure BDA00032991678600000516
Figure BDA00032991678600000517
Sequencing chaotic sequence Y2 in descending order, and according to the position change scrambling rule before and after sequencing of sequence Y2, performing reverse scrambling on the elements of the line-column shift three-dimensional binary matrix BHL in layers to obtain a line-column shift three-dimensional binary matrix after reverse scrambling
Figure BDA0003299167860000061
(5) Generation of commodity anti-counterfeiting two-dimensional code
Shifting three-dimensional binary matrix by inverse scrambled rows and columns
Figure BDA0003299167860000062
Respectively obtain numerical value matrixes
Figure BDA0003299167860000063
Thereby producing a color security image C, wherein the matrix
Figure BDA0003299167860000064
The size of the anti-counterfeiting code is M multiplied by N, the size of the color anti-counterfeiting picture C is M multiplied by N, the commodity color trademark picture, the commodity identification code and the generated color anti-counterfeiting picture C are combined, and the combined commodity color trademark picture, the commodity identification code and the color anti-counterfeiting picture C 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.
Further, in the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption, the elements in the matrixes R, G and B are respectively converted into 8-bit binary system one by one in the step (1), namely the elements in the matrix R are adopted one by one
Figure BDA0003299167860000065
Operating to obtain a three-dimensional binary matrix
Figure BDA0003299167860000066
Adopting the elements in the matrix G one by one
Figure BDA0003299167860000067
Operating to obtain a three-dimensional binary matrix
Figure BDA0003299167860000068
Adopting the elements in the matrix B one by one
Figure BDA0003299167860000069
Operating to obtain a three-dimensional binary matrix
Figure BDA00032991678600000610
Further, the commodity identification code, namely the character string A, representing the basic information of a certain commodity in the step (1) of the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption1A2,...,AL-1ALThe conversion of characters into numerical data one by one means that characters in the commodity identification code are converted into numerical data one by adopting a unicode2native (·) function, namely the conversion of double-byte characters is expressed as
Figure BDA00032991678600000611
For a single byte character, the conversion is expressed as
Figure BDA00032991678600000612
Thereby obtaining a numerical sequence
Figure BDA00032991678600000613
Further, the step (1) of converting the elements in the numerical sequence P into an 8-bit binary system one by one in the method for generating the commodity anti-counterfeiting code based on trademark picture scrambling encryption means that the elements in the numerical sequence P adopt PB (8 i) one by one-7:8i)=dec2bin(Pi8) operation to obtain binary sequence
Figure BDA00032991678600000614
Figure BDA00032991678600000615
Further, the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption is characterized in that the anti-scrambled row-column shifted three-dimensional binary matrix in the step (5)
Figure BDA00032991678600000616
Respectively obtain numerical value matrixes
Figure BDA00032991678600000617
Thereby generating a color security image C, representing the steps of:
step one, three-dimensional binary matrix
Figure BDA00032991678600000618
Middle 1-M rows, 1-N columns, 1-8 layersThe binary elements are calculated by taking binary elements of 1-8 layers in a certain row and a certain column as units
Figure BDA00032991678600000619
Converting into some numerical data and filling in matrix
Figure BDA00032991678600000620
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure BDA00032991678600000621
As shown below, the following description is given,
Figure BDA0003299167860000071
step two, three-dimensional binary matrix
Figure BDA0003299167860000072
The M + 1-2M row, 1-N column, 1-8 layer binary elements, and the operations are performed by using the binary elements of 1-8 layers in a certain row and a certain column as the unit
Figure BDA0003299167860000073
Converting into some numerical data and filling in matrix
Figure BDA0003299167860000074
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure BDA0003299167860000075
As shown below, the following description is given,
Figure BDA0003299167860000076
step three, three-dimensional binary matrix
Figure BDA0003299167860000077
The binary elements of the 2M + 1-3M rows, the 1 st-N columns and the 1 st-8 th layers are respectively operated by taking the binary elements of the 1-8 th layers of a certain row and a certain column as units
Figure BDA0003299167860000078
Converting into some numerical data and filling in matrix
Figure BDA0003299167860000079
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure BDA00032991678600000710
As shown below, the following description is given,
Figure BDA00032991678600000711
step four, the numerical value matrix
Figure BDA00032991678600000712
Respectively representing the three primary colors of red, green and blue of a color picture by using
Figure BDA00032991678600000713
Function of matrix
Figure BDA00032991678600000714
And converting the color image into a color image to generate a color anti-counterfeiting image C, wherein the size of the color anti-counterfeiting image C is M multiplied by N.
Further, the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption combines the commodity color trademark picture, the commodity identification code and the generated color anti-counterfeiting picture C in the step (5), and means that the commodity color trademark picture is placed at the top, the commodity identification code is placed in the middle, and the color anti-counterfeiting picture C is placed at the bottom in a vertical connection combination mode.
Has the advantages that: according to the method, the unique identity information of a certain commodity is represented by combining a colorful trademark picture of the commodity and basic information of the commodity, and a combined three-dimensional binary matrix obtained by converting and splicing the colorful trademark picture of the commodity is sequentially subjected to scrambling splicing, line shifting, backfilling reverse scrambling, re-scrambling splicing, column shifting, backfilling and re-scrambling according to a sequencing scrambling rule of a chaotic sequence and parameters of matrix line shifting and column shifting, so that a colorful anti-counterfeiting picture is generated, and then a commodity anti-counterfeiting two-dimensional code is generated by combination.
Drawings
FIG. 1 is a schematic diagram of a commodity anti-counterfeiting code generation flow based on trademark picture scrambling encryption according to the present invention;
FIG. 2 is a red, green and blue three primary color picture of a commercial color trademark picture in embodiment 1 of the present invention;
FIG. 3 is a red, green and blue three-primary-color picture of a color anti-counterfeiting picture C of a commodity obtained in embodiment 1 by the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption provided by the invention
Fig. 4 shows the anti-counterfeit two-dimensional code of the commodity obtained in embodiment 1 by the method for generating the anti-counterfeit code of the commodity based on the scrambling and encryption of the trademark picture.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a method for generating a commodity anti-counterfeit code based on trademark image scrambling encryption, including the following steps:
(1) transcoding
The unique identity information of a certain commodity is characterized by the combination of a colorful trademark picture of the commodity and basic information of the commodity, firstlyThe commodity color trademark picture is divided into three primary colors of red, green and blue, which are respectively represented as matrixes R, G and B, and elements in the matrixes R, G and B are respectively adopted one by one
Figure BDA0003299167860000081
And
Figure BDA0003299167860000082
the operation is converted into 8-bit binary system to obtain a three-dimensional binary system matrix
Figure BDA0003299167860000083
And
Figure BDA0003299167860000084
and combining the three-dimensional binary matrix
Figure BDA0003299167860000085
And
Figure BDA0003299167860000086
sequentially splicing the two matrixes up and down to obtain a combined three-dimensional binary matrix
Figure BDA0003299167860000087
Then, the identification code of the commodity, namely the character string A, representing the basic information of a certain commodity1A2,...,AL-1ALConverting characters into numerical data one by adopting unicode2native (-) function to obtain numerical sequence
Figure BDA0003299167860000088
Then, the elements in the numerical value sequence P adopt PB (8 i) one by one-7:8i)=dec2bin(Pi8) converting the operation into an 8-bit binary system to obtain a binary sequence
Figure BDA0003299167860000089
Wherein the size of the color trademark picture is MxN, the size of the matrix R, G, B is MxN, and the three-dimensional binary matrix
Figure BDA00032991678600000810
Figure BDA00032991678600000811
The number of rows is M, the number of columns is N, the number of layers is 8, and a three-dimensional binary matrix is combined
Figure BDA00032991678600000812
The number of rows is 3M, the number of columns is N, the number of layers is 8, the commodity identification code representing the basic information of the commodity is from characters of GBK codes, the length of the commodity identification code is L, and the length of the numerical sequence P is L
Figure BDA00032991678600000813
The length of the binary sequence PB is
Figure BDA00032991678600000814
And is
Figure BDA00032991678600000815
(2) Generating chaotic sequences
Firstly, an initial value x of the chaotic system is respectively calculated by using external encryption keys (alpha, beta) according to the formula shown in the specification1Parameter lambda, extraction start position delta1And delta2Let us order
Figure BDA0003299167860000091
Then it is possible to obtain,
x1=mod(Key_inner-α,0.999)+0.001,
λ=2+mod(-Key_inner+β,29),
Figure BDA0003299167860000092
Figure BDA0003299167860000093
then, the initial value x is calculated1And a parameter lambda is used for iterating the Chebyshev chaotic system shown in the following formula, wherein k represents iteration times, and x represents the iteration timesk+1Representing the chaotic signal obtained in the k-th iteration, wherein k is 1,2, …, so as to obtain a chaotic sequence X,
xk+1=cos(λ·arccos(xk))
then extracting the delta-th from the chaotic sequence X1The number of rows H _ number of the matrix row shift and the reset extraction start position delta are calculated according to the formula1
Figure BDA0003299167860000094
Extracting the delta-th from the chaotic sequence X1The direction H _ direction of matrix row shift and the reset extraction starting position delta are respectively calculated according to the following formulas1And a level parameter H _ CM of the row shift matrix,
Figure BDA0003299167860000095
from the chaos sequence X by the number delta1Starting to continuously extract 8 +2 elements to obtain a chaotic sequence with the length of 8
Figure BDA0003299167860000096
Figure BDA0003299167860000101
Finally, the delta is extracted from the chaos sequence X2Each element is calculated by the following formula to obtain the column number L _ number of matrix column shift and the reset extraction start position delta2
Figure BDA0003299167860000102
Extracting the delta-th from the chaotic sequence X2The direction L _ direction of matrix column shift and the reset extraction starting position delta are respectively calculated according to the following formulas2And a level parameter L _ CM of the column shift matrix,
Figure BDA0003299167860000103
from the chaos sequence X by the number delta2Starting to continuously extract 8 +2 elements to obtain a chaotic sequence with the length of 8
Figure BDA0003299167860000104
Figure BDA0003299167860000105
(3) Row-shifted scrambling encryption
Firstly, the chaos sequence Y1 is sorted in ascending order, and the three-dimensional binary matrix is combined according to the position change scrambling rule before and after the sequence Y1 is sorted
Figure BDA0003299167860000106
The elements are scrambled according to layers to obtain a scrambled combined three-dimensional binary matrix
Figure BDA0003299167860000107
And according to the level parameter H _ CM of the row shift matrix, the following splicing operation is carried out,
if H _ CM is 1, the scrambled combined three-dimensional binary matrix is used
Figure BDA0003299167860000108
Splicing layer by layer to obtain a matrix H to be shiftedRGBIs shown as
Figure BDA0003299167860000109
If H _ CM is 0, the scrambled combined three-dimensional binary matrix is used
Figure BDA00032991678600001011
Splicing line by line up and down to obtain a matrix H to be shiftedRGBIs shown as
Figure BDA00032991678600001010
Wherein the matrix H to be row shiftedRGBIs 24M x N in size,
then, according to the number of rows H _ number and direction H _ direction of the matrix row shift, the following whole row shift operation is performed,
if H _ direction is 0, the row to be shifted is shifted by matrix HRGBCircularly shifting the H _ number row in the whole row to obtain a matrix after row shifting
Figure BDA0003299167860000111
If H _ direction is 1, the row to be shifted is shifted by matrix HRGBCircularly shifting down H _ number rows in the whole row to obtain a matrix after row shifting
Figure BDA0003299167860000112
Finally, according to the level parameter H _ CM of the row shift matrix, the following backfilling operation is carried out,
if H _ CM is 0, the matrix after row shifting
Figure BDA0003299167860000113
Backfilling the medium elements layer by layer into a three-dimensional binary matrix with 3M row number, N column number and 8 layer number to obtain a row shift three-dimensional binary matrix BH expressed as
Figure BDA0003299167860000114
Figure BDA0003299167860000115
Figure BDA0003299167860000116
Figure BDA0003299167860000117
If H _ CM is 1, the matrix after row shifting
Figure BDA0003299167860000118
Backfilling the medium elements line by line into a three-dimensional binary matrix with 3M row number, N column number and 8 layer number to obtain a line shift three-dimensional binary matrix BH expressed as
Figure BDA0003299167860000119
Figure BDA00032991678600001110
Figure BDA00032991678600001111
Sorting the chaotic sequence Y1 in a descending order, sorting the chaotic sequence Y1 in a descending order according to the position change scrambling rule before and after the sequence Y1 is sorted, and performing reverse scrambling on the elements BH of the row-shift three-dimensional binary matrix in layers according to the position change scrambling rule before and after the sequence Y1 is sorted to obtain the row-shift three-dimensional binary matrix after the reverse scrambling
Figure BDA00032991678600001112
(4) Column shifted scrambling encryption
Firstly, the chaos sequence Y2 is sorted in ascending order, and the three-dimensional binary matrix is shifted for the rows after the reverse scrambling according to the position change scrambling rule before and after the sequence Y2
Figure BDA00032991678600001113
Scrambling the elements according to layers to obtain a scrambled three-dimensional binary matrix
Figure BDA00032991678600001114
And according to the level parameter L _ CM of the column shift matrix, the following splicing operation is carried out,
if L _ CM is equal to 1, the three-dimensional binary matrix after scrambling is carried out
Figure BDA00032991678600001115
Splicing layer by layer to obtain a to-be-listed shift matrix LRGBIs shown as
Figure BDA00032991678600001116
If L _ CM is 0, the three-dimensional binary matrix after scrambling is carried out
Figure BDA00032991678600001117
Splicing the rows one by one to obtain a to-be-row shift matrix LRGBIs shown as
Figure BDA0003299167860000121
Wherein a matrix L is to be column shiftedRGBIs 3M x 8N in size,
then, according to the column number L _ number and the direction L _ direction of the matrix column shift, the following column shift operation is performed,
if L _ direction is 0, the column is shifted by the matrix LRGBCircularly left-shifting the whole column by L _ number row to obtain a matrix after column shifting
Figure BDA0003299167860000122
If L _ direction is 1, the column is shifted by the matrix LRGBCircularly right shifting the whole column by L _ number row to obtain a matrix after column shifting
Figure BDA0003299167860000123
Finally, according to the level parameter L _ CM of the column shift matrix, the following backfill operation is carried out,
if L _ CM is 0, the matrix after column shifting
Figure BDA0003299167860000124
Backfilling the medium elements layer by layer into a three-dimensional binary matrix with 3M row number, N column number and 8 layer number to obtain a line-column shift three-dimensional binary matrix BHL (binary pattern library), which is expressed as
Figure BDA0003299167860000125
Figure BDA0003299167860000126
Figure BDA0003299167860000127
Figure BDA0003299167860000128
If L _ CM is 1, the matrix after column shifting
Figure BDA0003299167860000129
Backfilling the medium elements column by column to a three-dimensional binary matrix with 3M rows, N columns and 8 layers to obtain a column-row shift three-dimensional binary matrix BHL (binary pattern library), which is expressed as
Figure BDA00032991678600001210
Figure BDA00032991678600001211
Figure BDA00032991678600001212
Sequencing the chaotic sequence Y2 in a descending order, and performing reverse scrambling on the elements of the column-row shift three-dimensional binary matrix BHL in layers according to the position change scrambling rule before and after sequencing of the sequence Y2 to obtain a column-row shift three-dimensional binary matrix after reverse scrambling
Figure BDA00032991678600001213
(5) Generation of commodity anti-counterfeiting two-dimensional code
Shifting three-dimensional binary matrix by inverse scrambled row and column
Figure BDA00032991678600001214
Respectively obtain numerical value matrixes
Figure BDA00032991678600001215
Thereby producing a color security image C, representing the steps of,
step one, three-dimensional binary matrix
Figure BDA00032991678600001216
The 1 st to M th rows, 1 st to N th columns and 1 st to 8 th layers of binary elements are respectively operated by taking the binary elements of the 1 st to 8 th layers of a certain row and a certain column as units
Figure BDA0003299167860000131
Converting into some numerical data and filling in matrix
Figure BDA0003299167860000132
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure BDA0003299167860000133
As shown below, the following description is given,
Figure BDA0003299167860000134
step two, three-dimensional binary matrix
Figure BDA0003299167860000135
The M + 1-2M row, 1-N column, 1-8 layer binary elements, and the operations are performed by using the binary elements of 1-8 layers in a certain row and a certain column as the unit
Figure BDA0003299167860000136
Converting into some numerical data and filling in matrix
Figure BDA0003299167860000137
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure BDA0003299167860000138
As shown below, the following description is given,
Figure BDA0003299167860000139
step three, three-dimensional binary matrix
Figure BDA00032991678600001310
The binary elements of the 2M + 1-3M rows, the 1 st-N columns and the 1 st-8 th layers are respectively operated by taking the binary elements of the 1-8 th layers of a certain row and a certain column as units
Figure BDA00032991678600001311
Converting into some numerical data and filling in matrix
Figure BDA00032991678600001312
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure BDA00032991678600001313
As shown below, the following description is given,
Figure BDA00032991678600001314
step four, the numerical value matrix
Figure BDA00032991678600001315
Respectively representing the three primary colors of red, green and blue of a color picture by using
Figure BDA00032991678600001316
Function of matrix
Figure BDA00032991678600001317
Converting into color picture to generate color anti-counterfeiting picture C, wherein the size of the color anti-counterfeiting picture C is MxN,
and finally, placing the color trademark picture of the commodity on the top, placing the commodity identification code in the middle, placing the color anti-counterfeiting picture C on the bottom, connecting and combining the color trademark picture of the commodity, the commodity identification code and the color anti-counterfeiting picture C up and down, and converting the combined color trademark picture of the commodity, the commodity identification code and the color anti-counterfeiting picture C into a two-dimensional code by using a two-dimensional code generator, thereby obtaining the anti-counterfeiting two-dimensional code of the commodity.
The invention is further illustrated by the following specific examples:
example 1
According to the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption, the steps are as follows:
(1) the unique identity information of a certain commodity is represented by the combination of a commodity color trademark picture and commodity basic information, the red, green and blue three primary colors are decomposed from the commodity color trademark picture (the R, G, B three primary color picture is shown in figure 2) and are respectively represented as matrixes R, G and B, elements in the matrixes R, G and B are respectively converted into 8-bit binary matrixes one by one, and a three-dimensional binary matrix is obtained
Figure BDA0003299167860000141
And
Figure BDA0003299167860000142
and combining the three-dimensional binary matrix
Figure BDA0003299167860000143
And
Figure BDA0003299167860000144
sequentially splicing the two matrixes up and down to obtain a combined three-dimensional binary matrix
Figure BDA0003299167860000145
Then, the commodity identification code representing the basic information of a certain commodity, namely the character string '123 and 123456 and 2021 year 08 month 11 day-12345678', is converted into numerical data character by character to obtain a numerical sequence P ═ 49,50,51,52,53,54,45,50,48,50,49,196,234,48,56,212,194,49, 200,213,45,49,50,51,52,53,54,55,56}, and then the elements in the numerical sequence P are converted into an 8-bit binary system to obtain a binary sequence PB ═ 0,0,1,1,0,0,1,0,1,1,0,1,0, 1,0,0,1,1,0,0,0,1,0,0, 0,1,0,0,1,1,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,1,0,0,1,1,0,1,1,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,1,0,1,0,0,1,1,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,1,1, 0,0,0,1,1,1,0,0,1,0,0,0,1,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,1,0,0,1,1,1,0,0,0},
wherein the size of the color trademark picture is 76 × 76, the size of the matrix R, G, B is 76 × 76, and the size of the three-dimensional binary matrix is 76 × 76
Figure BDA0003299167860000146
Figure BDA0003299167860000147
With 76 rows, 76 columns and 8 layers, a three-dimensional binary matrix is assembled
Figure BDA0003299167860000148
Has row number 228, column number 76, layer number 8, commodity identification code character string length L-31, and numerical value sequence P length P
Figure BDA0003299167860000149
The length of the binary sequence PB is 8 × 34 ═ 272;
(2) firstly, using an external encryption key (α -0.12345, β -6.54321), calculating an initial value x of the chaotic system according to the following formula1Parameter lambda, extraction start position delta1And delta2Let us order
Figure BDA00032991678600001410
Then it is possible to obtain,
x1=mod(0.060894100521666-0.12345,0.999)+0.001=0.937444100521666,
λ=2+mod(-0.060894100521666+6.54321,29)=8.482315899478333,
δ1=mod(5410052166,89)+1=89,
δ2=mod(55410052166,109)+1=49,
then, the initial value x is calculated1And the parameter lambda iterates the Chebyshev chaotic system to obtain a chaotic sequence X,
then, the 89 th element is extracted from the chaotic sequence X, the number of rows H _ number mod (92893772299309,24 × 76) of matrix row shift is calculated as 1509, and the extraction start position δ is reset1=89+mod(1509,123)=122,
Extracting the 122 th element from the chaos sequence X, calculating to obtain the direction H _ direction ═ 1 of matrix row shift, resetting the extraction starting position delta1122+59 181, and the level parameter H _ CM of the row shift matrix 0,
continuously extracting 8 chaotic sequences from the 183 th element in the chaotic sequence X to obtain a chaotic sequence Y1 with the length of 8, namely {0.640718053979319,0.415847546804130, -0.966038615644033,0.763729419664320,0.945741379717408, -0.944554589219226,0.245645345982807 and 0.221380205639024},
finally, the 49 th element is extracted from the chaotic sequence X, the column number L _ number which obtains the matrix column shift is calculated to be mod (37849618864901,8 × 76) to be 414, and the extraction starting position is reset to be delta2=49+mod(414,123)=94,
Extracting 94 th element from chaos sequence X, calculating to obtain direction L _ direction of matrix column shift as 0, resetting extraction start position delta294+ 53-147, and the level parameter L _ CM of the column shift matrix is 1,
continuously extracting 8 chaotic sequences from 149 th elements in the chaotic sequence X to obtain a chaotic sequence Y2 with the length of 8 { -0.726970140964423,0.191422875691690,0.640096385770775,0.409593790562923, -0.949360784579567,0.366344995675700, -0.753331087148370, -0.139552787306207 };
(3) first, the chaotic sequence is divided into twoY1 is sorted in ascending order, and the position change scrambling rule {3,6,8,7,2,1,4,5} before and after sorting is sorted according to the sequence Y1, and the three-dimensional binary matrix is combined
Figure BDA0003299167860000151
The elements are scrambled according to layers to obtain a scrambled combined three-dimensional binary matrix
Figure BDA0003299167860000152
And according to the level parameter H _ CM of the row shift matrix, the scrambled combined three-dimensional binary matrix is
Figure BDA0003299167860000153
Splicing line by line up and down to obtain a matrix H to be shiftedRGBWherein the matrix H is to be row shiftedRGBIs 1824 x 76, and the size of the lens is 1824 x 76,
then, the row to be shifted by matrix HRGBCircularly shifting the whole row down by 1509 rows to obtain a matrix after row shifting
Figure BDA0003299167860000154
Finally, the matrix after row shifting
Figure BDA0003299167860000155
Backfilling the middle elements layer by layer into a three-dimensional binary matrix with 228 rows, 76 columns and 8 layers to obtain a row-shift three-dimensional binary matrix BH, sequencing the chaotic sequence Y1 in a descending order, performing inverse scrambling on the row-shift three-dimensional binary matrix BH elements in layers according to a position change scrambling rule {5,4,1,2,7,8,6,3} before and after sequencing the sequence Y1 to obtain an inverse-scrambled row-shift three-dimensional binary matrix BH element
Figure BDA0003299167860000156
(4) Firstly, the chaos sequence Y2 is sorted in ascending order, and the three-dimensional binary matrix is shifted for the rows after the derangement according to the position change scrambling rule {5,7,1,8,2,6,4,3} before and after the sequence Y2
Figure BDA0003299167860000157
Scrambling the elements according to layers to obtain a scrambled three-dimensional binary matrix
Figure BDA0003299167860000158
And according to the level parameter L _ CM of the column shift matrix, the scrambled combined three-dimensional binary matrix is
Figure BDA0003299167860000159
Splicing layer by layer to obtain a to-be-listed shift matrix LRGBIn which a column is to be shifted by a matrix LRGBIs 228 x 608, and has a size of,
then, the columns are shifted by matrix LRGBCircularly left-shifting 414 rows in the whole column to obtain a matrix after column shifting
Figure BDA0003299167860000161
Finally, the matrix after column shifting
Figure BDA0003299167860000162
Filling the medium elements into a three-dimensional binary matrix with 228 rows, 76 columns and 8 layers one by one to obtain a row-column shift three-dimensional binary matrix BHL, sequencing the chaotic sequence Y2 in a descending order, and performing reverse scrambling on the elements of the row-column shift three-dimensional binary matrix BHL according to a position change scrambling rule {3,4,6,2,8,1,7,5} before and after sequencing of the sequence Y2 to obtain a reverse scrambled row-column shift three-dimensional binary matrix BHL
Figure BDA0003299167860000163
(5) Shifting three-dimensional binary matrix by inverse scrambled row and column
Figure BDA0003299167860000164
Respectively obtain numerical value matrixes
Figure BDA0003299167860000165
Thereby generating a color security image C in which the matrix
Figure BDA0003299167860000166
The size of the commodity anti-counterfeiting picture C is 76 multiplied by 76, the commodity color trademark picture, the commodity identification code and the generated color anti-counterfeiting picture C are combined, the combined commodity color trademark picture, the commodity identification code and the color anti-counterfeiting picture C are converted into a two-dimensional code by using a two-dimensional code generator, and therefore the commodity anti-counterfeiting two-dimensional code is obtained, wherein R, G, B three-primary-color pictures of the color anti-counterfeiting picture C are shown in figure 3, and the commodity anti-counterfeiting two-dimensional code is shown in figure 4.
Example 2
According to the above commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption, the steps of generating the color trademark picture of a certain commodity and the commodity anti-counterfeiting code thereof are similar to those of the specific embodiment 1, and only a certain external encryption key is slightly changed: α -0.12345000000001; or β 6.54321000000001, the generation of the commercial anti-counterfeiting code is shown in table 1. As can be seen from the following table: once the external encryption key slightly changes, the generated commodity anti-counterfeiting two-dimensional code greatly changes, so that the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption has key sensitivity.
TABLE 1 Generation result of commodity anti-counterfeiting code when external encryption key is slightly changed
Figure BDA0003299167860000167
Figure BDA0003299167860000171
Example 3
According to the method for generating the commodity anti-counterfeiting code based on the brand picture scrambling encryption, the steps of generating the color brand picture, the external encryption key and the commodity anti-counterfeiting code of a certain commodity are similar to those of the specific embodiment 1, and only the commodity identification code is changed slightly: '124, 123456, 2021, 08, 11, d-12345678'; or '123 + 123459 + 2021, 08.11.11-12345678'; or '123 + 123456 + 2021 year 08 month 11 mesh-12345678'; or 123, 123456, 2021, 08, 11, 12345670', and the generation result of the merchandise anti-counterfeiting two-dimensional code is shown in table 2. As can be seen from the following table: once the commodity identification code slightly changes, the generated commodity anti-counterfeiting two-dimensional code can greatly change, so that the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption provided by the patent has sensitivity to commodity identity information (namely the commodity identification code).
TABLE 2 generation result of commodity anti-fake code when commodity identification code is slightly changed
Figure BDA0003299167860000172
Figure BDA0003299167860000181
Example 4
According to the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption, the commodity identification code, the external encryption key and the commodity anti-counterfeiting code generation steps of a certain commodity are similar to those of the specific embodiment 1, and only the color trademark picture is changed slightly: a certain point of red primary color in the commercial color trademark picture is slightly changed, such as R (M, N) mod (R (M, N) +1, 256); or the pixel of a certain point of the green primary color in the commercial color trademark picture is slightly changed, such as G (1,1) ═ mod (G (1,1) +1, 256); or the pixel of a certain point of the blue primary color in the commodity color trademark picture is slightly changed, for example, B (M,1) ═ mod (B (M,1) +1,256), and the generation result of the commodity anti-counterfeiting two-dimensional code is shown in table 3. As can be seen from the following table: once the color trademark picture of the commodity slightly changes, the generated anti-counterfeiting two-dimensional code of the commodity greatly changes, so that the commodity anti-counterfeiting code generation method based on the trademark picture scrambling encryption has sensitivity to the color trademark picture of the commodity.
TABLE 3 Generation result of anti-counterfeit code of commodity when the color trademark picture of commodity is slightly changed
Figure BDA0003299167860000182
Figure BDA0003299167860000191
As can be seen from the above specific embodiments 2, 3 and 4, the anti-counterfeit code generated by the method for generating an anti-counterfeit code for a commodity based on scrambling encryption of a trademark picture provided by the present patent is not only closely related to an external encryption key and basic information of the commodity (i.e. a commodity identification code), but also depends on a color trademark picture of the commodity.
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 (6)

1. A commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption is characterized by comprising the following steps:
(1) transcoding
The unique identity information of a certain commodity is represented by the combination of a commodity color trademark picture and commodity basic information, the commodity color trademark picture is firstly decomposed into three primary colors of red, green and blue which are respectively represented as matrixes R, G and B, and elements in the matrixes R, G and B are respectively converted into 8-bit binary systems one by one to obtain the unique identity information of the certain commodityTo three-dimensional binary matrices
Figure FDA0003595063340000011
And
Figure FDA0003595063340000012
and combining the three-dimensional binary matrix
Figure FDA0003595063340000013
And
Figure FDA0003595063340000014
sequentially splicing the two matrixes up and down to obtain a combined three-dimensional binary matrix
Figure FDA0003595063340000015
Then, the identification code of the commodity, namely the character string A, representing the basic information of a certain commodity1A2,...,AL-1ALConverting the characters into numerical data one by one to obtain numerical sequence
Figure FDA0003595063340000016
Then, elements in the numerical sequence P are converted into 8-bit binary one by one to obtain a binary sequence
Figure FDA0003595063340000017
Wherein the size of the color trademark picture is MxN, the size of the matrix R, G, B is MxN, and the three-dimensional binary matrix
Figure FDA0003595063340000018
Figure FDA0003595063340000019
The number of rows is M, the number of columns is N, the number of layers is 8, and a three-dimensional binary matrix is combined
Figure FDA00035950633400000110
The number of rows is 3M, the number of columns is N, the number of layers is 8, the commodity identification code representing the basic information of the commodity comes from characters of GBK codes, the length of the commodity identification code is L, and the length of the numerical sequence P is L
Figure FDA00035950633400000111
The length of the binary sequence PB is
Figure FDA00035950633400000112
And is
Figure FDA00035950633400000113
(2) Generating chaotic sequences
Firstly, an initial value x of the chaotic system is respectively calculated by using external encryption keys (alpha, beta) according to the following formulas (1) to (4)1Parameter lambda, extraction start position delta1And delta2Let us order
Figure FDA00035950633400000114
Then it is possible to obtain,
x1=mod(Key_inner-α,0.999)+0.001, (1)
λ=2+mod(-Key_inner+β,29), (2)
Figure FDA00035950633400000115
Figure FDA00035950633400000116
wherein α ∈ (0,1), β ∈ (0,100), [ { PB ∈ (PB) ]8i-7,PB8i-6,...,PB8i-1,PB8i}]0Representing a statistical binary sequence PB8i-7,PB8i-6,...,PB8i-1,PB8iThe number of binary '0's present in the tremble,
Figure FDA0003595063340000021
and
Figure FDA0003595063340000022
respectively representing statistical three-dimensional binary matrices
Figure FDA0003595063340000023
The number of binary '1' exists in the ith row, the jth column and the 1 st to 8 th layers,
then, the initial value x is calculated1And a parameter lambda, iterating the Chebyshev chaotic system shown in the following formula (5), wherein k represents iteration times, and xk+1Denotes the chaotic signal obtained from the kth iteration, where k is 1,2, …, resulting in chaotic sequence X,
xk+1=cos(λ·arccos(xk)) (5)
then extracting the delta-th from the chaotic sequence X1Elements, the number of rows H _ number of the matrix row shift and the reset extraction start position δ are calculated according to the following formula (6)1
Figure FDA0003595063340000024
Extracting the delta-th from the chaotic sequence X1The direction H _ direction of matrix row shift and the reset extraction start position delta are calculated according to the following formula (7)1And a level parameter H _ CM of the row shift matrix,
Figure FDA0003595063340000025
from the chaos sequence X by the number delta1Starting with 8 elements, 8 elements were continuously extracted to obtain a blend of length 8Chaos sequence
Figure FDA0003595063340000026
Figure FDA0003595063340000027
Finally, the delta-th bit is extracted from the chaotic sequence X2Each element is calculated by the following equation (8) to obtain the column number L _ number of matrix column shift and the reset extraction start position δ2
Figure FDA0003595063340000028
Extracting the delta-th from the chaotic sequence X2The direction L _ direction of matrix column shift and the reset extraction start position delta are calculated according to the following formula (9)2And a level parameter L _ CM of the column shift matrix,
Figure FDA0003595063340000029
from the chaos sequence X by the number delta2Starting to continuously extract 8 +2 elements to obtain a chaos sequence with the length of 8
Figure FDA0003595063340000031
Figure FDA0003595063340000032
(3) Row-shifted scrambling encryption
Firstly, the chaos sequence Y1 is sorted in ascending order, and the combined three-dimensional binary matrix is scrambled according to the position change scrambling rule before and after the sequence Y1
Figure FDA0003595063340000033
The elements are scrambled according to layers to obtain a scrambled combined three-dimensional binary matrix
Figure FDA0003595063340000034
And according to the level parameter H _ CM of the row shift matrix, the following splicing operation is carried out,
if H _ CM is 1, the scrambled combined three-dimensional binary matrix is used
Figure FDA0003595063340000035
Splicing layer by layer to obtain a matrix H to be shiftedRGBIs shown as
Figure FDA0003595063340000036
If H _ CM is 0, the scrambled combined three-dimensional binary matrix is used
Figure FDA00035950633400000315
Splicing line by line up and down to obtain a matrix H to be shiftedRGBIs represented as
Figure FDA0003595063340000037
Wherein the matrix H to be row shiftedRGBIs 24M x N in size,
then, according to the number of rows H _ number and direction H _ direction of the matrix row shift, the following whole row shift operation is performed,
if H _ direction is 0, the row to be shifted is shifted by matrix HRGBCircularly shifting the H _ number row in the whole row to obtain a matrix after row shifting
Figure FDA0003595063340000038
If H _ direction is 1, the row to be shifted is shifted by matrix HRGBCircularly shifting down H _ number rows in the whole row to obtain a matrix after row shifting
Figure FDA0003595063340000039
Finally, according to the level parameter H _ CM of the row shift matrix, the following backfill operation is carried out,
if H _ CM is 0, the matrix after row shifting
Figure FDA00035950633400000310
Backfilling the medium elements layer by layer into a three-dimensional binary matrix with 3M row number, N column number and 8 layer number to obtain a row shift three-dimensional binary matrix BH expressed as
Figure FDA00035950633400000311
Figure FDA00035950633400000312
Figure FDA00035950633400000313
Figure FDA00035950633400000314
If H _ CM is 1, the matrix after row shifting
Figure FDA0003595063340000041
Backfilling the medium elements line by line into a three-dimensional binary matrix with 3M row number, N column number and 8 layer number to obtain a line shift three-dimensional binary matrix BH expressed as
Figure FDA0003595063340000042
Figure FDA0003595063340000043
Figure FDA0003595063340000044
Sorting the chaotic sequence Y1 in a descending order, and performing reverse scrambling on the elements BH of the line-shift three-dimensional binary matrix according to the position change scrambling rule before and after sorting the sequence Y1 in layers to obtain the three-dimensional binary matrixTo the inverse scrambled row-shifted three-dimensional binary matrix
Figure FDA0003595063340000045
(4) Column shifted scrambling encryption
Firstly, the chaos sequence Y2 is sorted in ascending order, and the three-dimensional binary matrix is shifted for the rows after the reverse scrambling according to the position change scrambling rule before and after the sequence Y2
Figure FDA0003595063340000046
Scrambling the elements according to layers to obtain a scrambled three-dimensional binary matrix
Figure FDA0003595063340000047
And according to the level parameter L _ CM of the column shift matrix, the following splicing operation is carried out,
if L _ CM is 1, the three-dimensional binary matrix after scrambling is carried out
Figure FDA0003595063340000048
Splicing layer by layer to obtain a to-be-listed shift matrix LRGBIs shown as
Figure FDA0003595063340000049
If L _ CM is 0, the three-dimensional binary matrix after scrambling is carried out
Figure FDA00035950633400000410
Splicing the rows one by one to obtain a to-be-row shift matrix LRGBIs shown as
Figure FDA00035950633400000411
Wherein the matrix L is to be column-shiftedRGBIs 3M x 8N in size,
then, according to the column number L _ number and the direction L _ direction of the matrix column shift, the following column shift operation is performed,
if it is usedIf L _ direction is equal to 0, the column is shifted by LRGBCircularly left-shifting the whole column by L _ number row to obtain a matrix after column shifting
Figure FDA00035950633400000412
If L _ direction is equal to 1, the column to be shifted by matrix LRGBCircularly right shifting the whole column by L _ number rows to obtain a matrix after column shifting
Figure FDA00035950633400000413
Finally, according to the level parameter L _ CM of the column shift matrix, the following backfill operation is carried out,
if L _ CM is 0, the matrix after column shifting
Figure FDA00035950633400000414
Backfilling the intermediate elements layer by layer into a three-dimensional binary matrix with 3M of line number, N of column number and 8 of layer number to obtain a line-column shift three-dimensional binary matrix BHL (hierarchical bit-rate hierarchical language), which is expressed as
Figure FDA00035950633400000415
Figure FDA0003595063340000051
Figure FDA0003595063340000052
Figure FDA0003595063340000053
If L _ CM equals 1, the matrix after column shifting
Figure FDA0003595063340000054
Backfilling the medium elements column by column to a three-dimensional binary matrix with 3M rows, N columns and 8 layers to obtain a column-row shift three-dimensional binary matrix BHL (binary pattern library), which is expressed as
Figure FDA0003595063340000055
Figure FDA0003595063340000056
Figure FDA0003595063340000057
Sequencing the chaotic sequence Y2 in a descending order, and performing reverse scrambling on the elements of the column-row shift three-dimensional binary matrix BHL in layers according to the position change scrambling rule before and after sequencing of the sequence Y2 to obtain a column-row shift three-dimensional binary matrix after reverse scrambling
Figure FDA0003595063340000058
(5) Generation of commodity anti-counterfeiting two-dimensional code
Shifting three-dimensional binary matrix by inverse scrambled rows and columns
Figure FDA0003595063340000059
Respectively obtain numerical value matrix
Figure FDA00035950633400000510
Thereby generating a color security image C in which the matrix
Figure FDA00035950633400000511
The size of the anti-counterfeiting code is M multiplied by N, the size of the color anti-counterfeiting picture C is M multiplied by N, the commodity color trademark picture, the commodity identification code and the generated color anti-counterfeiting picture C are combined, and the combined commodity color trademark picture, the commodity identification code and the color anti-counterfeiting picture C 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.
2. The method for generating anti-counterfeit code for commodities scrambled and encrypted based on trademark picture according to claim 1, wherein in step (1), the elements in the matrixes R, G and B are respectively converted into 8-bit binary codes one by oneThe system means that elements in the matrix R are adopted one by one
Figure FDA00035950633400000512
Operating to obtain a three-dimensional binary matrix
Figure FDA00035950633400000513
Adopt the elements in the matrix G one by one
Figure FDA00035950633400000514
Operating to obtain a three-dimensional binary matrix
Figure FDA00035950633400000515
Adopting the elements in the matrix B one by one
Figure FDA00035950633400000516
Operating to obtain a three-dimensional binary matrix
Figure FDA00035950633400000517
3. The method for generating the commodity anti-counterfeiting code based on the trademark picture scrambling encryption as claimed in claim 1, wherein the commodity identification code (character string A) representing the basic information of a certain commodity in the step (1)1A2,...,AL-1ALThe conversion of characters into numerical data one by one means that characters in the commodity identification code are converted into numerical data one by adopting a unicode2native (·) function, namely the conversion of double-byte characters is expressed as
Figure FDA00035950633400000518
For a single byte character, the conversion is expressed as
Figure FDA00035950633400000519
Thereby obtaining a numerical sequence
Figure FDA00035950633400000520
4. The method according to claim 1, wherein the step (1) of converting the elements in the numerical sequence P into 8-bit binary one by one means that the elements in the numerical sequence P adopt PB (8 i) one by one-7:8i)=dec2bin(Pi8) operation to obtain binary sequence
Figure FDA0003595063340000061
Figure FDA0003595063340000062
5. The method for generating anti-counterfeit code for commodities scrambled and encrypted based on trademark picture according to claim 1, wherein the three-dimensional binary matrix shifted by the reversed rows and columns in the step (5)
Figure FDA0003595063340000063
Respectively obtain numerical value matrixes
Figure FDA0003595063340000064
Thereby generating a color security image C, representing the steps of:
step one, three-dimensional binary matrix
Figure FDA0003595063340000065
The 1 st to M th rows, 1 st to N th columns and 1 st to 8 th layers of binary elements are respectively operated by taking the binary elements of the 1 st to 8 th layers of a certain row and a certain column as units
Figure FDA0003595063340000066
Converting into some numerical data and filling in matrix
Figure FDA0003595063340000067
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure FDA0003595063340000068
As shown below, the following description is given,
Figure FDA0003595063340000069
step two, three-dimensional binary matrix
Figure FDA00035950633400000610
The M + 1-2M row, 1-N column, 1-8 layer binary elements, and the operations are performed by using the binary elements of 1-8 layers in a certain row and a certain column as the unit
Figure FDA00035950633400000611
Converting into some numerical data and filling in matrix
Figure FDA00035950633400000612
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure FDA00035950633400000613
As shown below, the following description is given,
Figure FDA00035950633400000614
step three, three-dimensional binary matrix
Figure FDA00035950633400000615
The binary elements of the 2M + 1-3M rows, the 1 st-N columns and the 1 st-8 th layers are respectively operated by taking the binary elements of the 1-8 th layers of a certain row and a certain column as units
Figure FDA00035950633400000616
Converting into some numerical data and filling in matrix
Figure FDA00035950633400000617
Where i is 1,2, …, M, j is 1,2
Figure FDA00035950633400000618
As shown below, the following description is given,
Figure FDA00035950633400000619
step four, the numerical value matrix
Figure FDA0003595063340000071
Respectively representing the three primary colors of red, green and blue of a color picture by using
Figure FDA0003595063340000072
Function will matrix
Figure FDA0003595063340000073
And converting the color image into a color image to generate a color anti-counterfeiting image C, wherein the size of the color anti-counterfeiting image C is M multiplied by N.
6. The method for generating the anti-counterfeiting code of the commodity based on the scrambling and encryption of the trademark picture as claimed in claim 1, wherein the combination of the colored trademark picture of the commodity, the identification code of the commodity and the generated colored anti-counterfeiting picture C in the step (5) is a combination of the colored trademark picture of the commodity placed at the top, the identification code of the commodity placed in the middle and the colored anti-counterfeiting picture C placed at the bottom.
CN202111185829.XA 2021-10-12 2021-10-12 Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption Active CN113935346B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111185829.XA CN113935346B (en) 2021-10-12 2021-10-12 Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111185829.XA CN113935346B (en) 2021-10-12 2021-10-12 Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption

Publications (2)

Publication Number Publication Date
CN113935346A CN113935346A (en) 2022-01-14
CN113935346B true CN113935346B (en) 2022-06-21

Family

ID=79278314

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111185829.XA Active CN113935346B (en) 2021-10-12 2021-10-12 Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption

Country Status (1)

Country Link
CN (1) CN113935346B (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016077934A1 (en) * 2014-11-21 2016-05-26 Le Henaff Guy System and method for detecting the authenticity of products
CN105263024B (en) * 2015-10-15 2018-06-29 宁波大学 A kind of registration of HEVC video flowing zero watermarkings of anti-quantization transcoding and detection method
CN107609621B (en) * 2017-08-21 2020-04-10 哈尔滨工业大学深圳研究生院 Dot matrix anti-counterfeiting code design method based on chaotic encryption and application system thereof
CN110417539B (en) * 2019-08-02 2023-04-28 齐齐哈尔大学 Color image encryption method for dynamic chaos and matrix convolution operation
CN111800251B (en) * 2020-05-21 2021-11-12 北京邮电大学 Image compressed sensing encryption and decryption method, device and system based on chaotic source
CN112001467B (en) * 2020-07-24 2021-11-19 南通大学 Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption
CN112422268B (en) * 2020-11-10 2021-08-20 郑州轻工业大学 Image encryption method based on block scrambling and state conversion

Also Published As

Publication number Publication date
CN113935346A (en) 2022-01-14

Similar Documents

Publication Publication Date Title
CN109472338B (en) Batch generation method of commodity anti-counterfeiting two-dimensional codes
CN112001467B (en) Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption
CN112884104B (en) Commodity anti-counterfeiting two-dimensional code generation method based on chaotic encryption
CN112001468B (en) Character type commodity anti-counterfeiting code generation and identification method
CN112884105B (en) Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption
CN111382452A (en) Encryption method for converting Chinese characters into pictures
CN104182764A (en) Pattern recognition system
FR2586122A1 (en) POSTING MACHINE WITH INFORMATION CODE IN THE INDEX
CN102968654A (en) Method and system for producing information recognizable by naked eyes in plane of two-dimensional (2D) code and 2D code
CN111353166B (en) Encryption method for converting picture into Chinese character
CN109815653A (en) A kind of extraction of pdf Text Watermarking and comparison method based on deep learning
CN112217627B (en) Layered encrypted commodity anti-counterfeiting code generation method
CN113935346B (en) Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption
CN113255860B (en) Commodity anti-counterfeiting two-dimensional code generation method based on layered encryption
CN113935345B (en) Commodity anti-counterfeiting code batch generation method based on character string-to-picture encryption
CN113159252A (en) Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules
CN111382820B (en) Four-lattice pure-color commodity anti-counterfeiting code generation method
CN105205777B (en) A kind of coding method of latent image password
Rathi et al. Aesthetic QR: Approaches for Beautified, Fast Decoding, and Secured QR Codes.
CN113935347B (en) Commodity anti-counterfeiting code identification method based on anti-counterfeiting picture scrambling and decryption
CN113947096A (en) Commodity anti-counterfeiting code identification method based on picture-to-character string decryption
CN113935343B (en) Commodity anti-counterfeiting code generation method based on character string-to-picture encryption
WO2022131965A1 (en) Method for encoding and decoding digital information in the form of a multidimensional nano-barcode
Tan et al. Visual secret sharing scheme for color qr code
CN112418374B (en) Information code generation method

Legal Events

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