CN113935346A - 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
CN113935346A
CN113935346A CN202111185829.XA CN202111185829A CN113935346A CN 113935346 A CN113935346 A CN 113935346A CN 202111185829 A CN202111185829 A CN 202111185829A CN 113935346 A CN113935346 A CN 113935346A
Authority
CN
China
Prior art keywords
matrix
row
column
commodity
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.)
Granted
Application number
CN202111185829.XA
Other languages
Chinese (zh)
Other versions
CN113935346B (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 commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption, which 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 premise of the digital anti-counterfeiting technology is code making, and the common and widely applied code making technology is a two-dimensional code. 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 three-dimensional binary matrix
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
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+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 X1Element according to the following formula(7) Respectively calculating to obtain the direction H _ direction of matrix row shift and the reset extraction starting position delta1And a level parameter H _ CM of the row shift matrix,
Figure BDA0003299167860000032
from the chaos sequence X by the number delta1Starting 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 a 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 shown as
Figure BDA0003299167860000041
If H _ CM is 0, the scrambled combined three-dimensional binary matrix is used
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 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 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 1, the three-dimensional binary matrix after scrambling is carried out
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 0, the matrix after column shifting
Figure BDA0003299167860000059
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 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 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 BDA00032991678600000515
Figure BDA00032991678600000516
Figure BDA00032991678600000517
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 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 generating a color security image C in which 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
Adopt 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, in the commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption, the step (1) of converting the elements in the numerical sequence P into 8-bit binary system one by one means that the elements in the numerical sequence P adopt PB (8 i) one by one-7:8i)=dec2bin(PiAnd 8) operation to obtainBinary 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
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 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 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 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 one by one into numerical data 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 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 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 following formula1Parameter 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 is obtained by calculating the elements according to the formulaResetting the extraction start position delta1And 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 chaos 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 chaos sequence with the length of 8
Figure BDA0003299167860000104
Figure BDA0003299167860000105
(3) Row-shifted scrambling encryption
First, mix themChaos 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 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, it will be waited forRow shift 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 backfill 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 descending order, rootAccording to the position change scrambling rule before and after the sequence Y1, the chaotic sequence Y1 is sorted in descending order, according to the position change scrambling rule before and after the sequence Y1, the elements of the line-shift three-dimensional binary matrix BH are subjected to reverse scrambling according to layers, and the line-shift three-dimensional binary matrix BH after reverse scrambling is obtained
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 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 layersIn (1), a row-column shift three-dimensional binary matrix BHL is obtained and 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 rows and columns
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 numerical moment is then obtainedMatrix of
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
Wherein i is 1N, then a matrix of values is 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, the commodity identification code and the color anti-counterfeiting picture C up and down, and converting the combined color trademark picture, 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
The commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption comprises the following steps:
(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,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) 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 {3,6,8,7,2,1,4,5} before and after the sequence Y1
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 shiftedRGBIn which the matrix H to be row shiftedRGBIs 1824 x 76 in size,
then, the row to be shifted by matrix HRGBCircularly shifting the whole row down 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 rows and columns
Figure BDA0003299167860000164
Respectively obtain numerical value matrixes
Figure BDA0003299167860000165
Thereby generating a color security image C in which the matrix
Figure BDA0003299167860000166
The sizes of the commodity color trademark picture, the commodity identification code and the generated color anti-counterfeiting picture C are combined, the two-dimensional code generator is used for converting the combined commodity color trademark picture, the commodity identification code and the color anti-counterfeiting picture C into a two-dimensional code, and therefore the commodity anti-counterfeiting two-dimensional code is obtained, wherein the R, G, B three-primary-color picture of the color anti-counterfeiting picture C is 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 color trademark picture of a certain commodity and the commodity anti-counterfeiting code generation steps thereof are similar to those of the specific embodiment 1, and only a certain external encryption key slightly changes: 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 provided by the patent has key sensitivity.
TABLE 1 Generation result of merchandise anti-counterfeit code when the 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-counterfeit 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, 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 FDA0003299167850000011
And
Figure FDA0003299167850000012
and combining the three-dimensional binary matrix
Figure FDA0003299167850000013
And
Figure FDA0003299167850000014
sequentially splicing the two matrixes up and down to obtain a combined three-dimensional binary matrix
Figure FDA0003299167850000015
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 FDA0003299167850000016
Then, elements in the numerical sequence P are converted into 8-bit binary one by one to obtain a binary sequence
Figure FDA0003299167850000017
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 FDA0003299167850000018
Figure FDA0003299167850000019
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 FDA00032991678500000110
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 FDA00032991678500000111
The length of the binary sequence PB is
Figure FDA00032991678500000112
And is
Figure FDA00032991678500000113
(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 FDA00032991678500000114
Then it is possible to obtain,
x1=mod(Key_inner-α,0.999)+0.001, (1)
λ=2+mod(-Key_inner+β,29), (2)
Figure FDA00032991678500000115
Figure FDA00032991678500000116
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 FDA0003299167850000021
and
Figure FDA0003299167850000022
respectively representing statistical three-dimensional binary matrices
Figure FDA0003299167850000023
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+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 FDA0003299167850000024
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 FDA0003299167850000025
from the chaos sequence X by the number delta1Starting to continuously extract 8 +2 elements to obtain a chaos sequence with the length of 8
Figure FDA0003299167850000029
Figure FDA0003299167850000026
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 FDA0003299167850000027
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 FDA0003299167850000028
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 FDA00032991678500000315
Figure FDA0003299167850000031
(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 FDA0003299167850000032
The elements are scrambled according to layers to obtain a scrambled combined three-dimensional binary matrix
Figure FDA0003299167850000033
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 FDA0003299167850000034
Splicing layer by layer to obtain a matrix H to be shiftedRGBIs shown as
Figure FDA0003299167850000035
If H _ CM is 0, the scrambled combined three-dimensional binary matrix is used
Figure FDA0003299167850000036
Splicing line by line up and down to obtain a matrix H to be shiftedRGBIs shown as
Figure FDA0003299167850000037
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 FDA0003299167850000038
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 FDA0003299167850000039
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 FDA00032991678500000310
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 FDA00032991678500000311
Figure FDA00032991678500000312
Figure FDA00032991678500000313
Figure FDA00032991678500000314
If H _ CM is 1, the matrix after row shifting
Figure FDA0003299167850000041
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 FDA0003299167850000042
Figure FDA0003299167850000043
Figure FDA00032991678500000416
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 FDA0003299167850000045
(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 FDA0003299167850000046
Scrambling the elements according to layers to obtain a scrambled three-dimensional binary matrix
Figure FDA0003299167850000047
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 FDA0003299167850000048
Splicing layer by layer to obtain a to-be-listed shift matrix LRGBIs shown as
Figure FDA0003299167850000049
If L _ CM is 0, the three-dimensional binary matrix after scrambling is carried out
Figure FDA00032991678500000410
Splicing the rows one by one to obtain a to-be-row shift matrix LRGBIs shown as
Figure FDA00032991678500000411
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 FDA00032991678500000412
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 FDA00032991678500000413
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 FDA00032991678500000414
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-column shift three-dimensional binary matrix BHL (Business Link library), a tableShown as
Figure FDA00032991678500000415
Figure FDA0003299167850000051
Figure FDA0003299167850000052
Figure FDA0003299167850000053
If L _ CM is 1, the matrix after column shifting
Figure FDA0003299167850000054
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 FDA0003299167850000055
Figure FDA00032991678500000521
Figure FDA0003299167850000057
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 FDA0003299167850000058
(5) Generation of commodity anti-counterfeiting two-dimensional code
Shifting three-dimensional binary matrix by inverse scrambled rows and columns
Figure FDA0003299167850000059
Respectively obtain numerical value matrixes
Figure FDA00032991678500000510
Thereby generating a color security image C in which the matrix
Figure FDA00032991678500000511
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 the merchandise anti-counterfeiting code based on the trademark picture scrambling encryption as claimed in claim 1, wherein the step (1) of converting the elements in the matrixes R, G and B into 8-bit binary system one by one respectively means that the elements in the matrix R adopt the 8-bit binary system one by one
Figure FDA00032991678500000512
Operating to obtain a three-dimensional binary matrix
Figure FDA00032991678500000513
Adopt the elements in the matrix G one by one
Figure FDA00032991678500000514
Operating to obtain a three-dimensional binary matrix
Figure FDA00032991678500000515
Adopting the elements in the matrix B one by one
Figure FDA00032991678500000516
Operating to obtain a three-dimensional binary matrix
Figure FDA00032991678500000517
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 FDA00032991678500000518
For a single byte character, the conversion is expressed as
Figure FDA00032991678500000519
Thereby obtaining a numerical sequence
Figure FDA00032991678500000520
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 FDA0003299167850000061
Figure FDA0003299167850000062
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 FDA0003299167850000063
Respectively obtain numerical value matrixes
Figure FDA0003299167850000064
Thereby generating a color security image C, representing the steps of:
step one, three-dimensional binary matrix
Figure FDA0003299167850000065
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 FDA0003299167850000066
Converting into some numerical data and filling in matrix
Figure FDA0003299167850000067
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure FDA0003299167850000068
As shown below, the following description is given,
Figure FDA0003299167850000069
step two, three-dimensional binary matrix
Figure FDA00032991678500000610
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 FDA00032991678500000611
Converting into some numerical data and filling in matrix
Figure FDA00032991678500000612
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure FDA00032991678500000613
As shown below, the following description is given,
Figure FDA00032991678500000614
step three, three-dimensional binary matrix
Figure FDA00032991678500000615
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 FDA00032991678500000616
Converting into some numerical data and filling in matrix
Figure FDA00032991678500000617
Where i 1,2, M, j 1,2, N, a matrix of values is then obtained
Figure FDA00032991678500000618
As shown below, the following description is given,
Figure FDA00032991678500000619
(ii) a Step four, the numerical value matrix
Figure FDA0003299167850000071
Respectively representing the three primary colors of red, green and blue of a color picture by using
Figure FDA0003299167850000072
Function of matrix
Figure FDA0003299167850000073
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 true CN113935346A (en) 2022-01-14
CN113935346B 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)

Citations (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
US20170109858A1 (en) * 2015-10-15 2017-04-20 Ningbo University Zero-watermarking registration and detection method for HEVC video streaming against requantization transcoding
CN107609621A (en) * 2017-08-21 2018-01-19 哈尔滨工业大学深圳研究生院 A kind of dot matrix security code design method and its application system based on chaos encryption
CN110417539A (en) * 2019-08-02 2019-11-05 齐齐哈尔大学 A kind of color image encrypting method of dynamic chaos and matrix convolution operation
CN111800251A (en) * 2020-05-21 2020-10-20 北京邮电大学 Image compressed sensing encryption and decryption method, device and system based on chaotic source
CN112001467A (en) * 2020-07-24 2020-11-27 南通大学 Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption
CN112422268A (en) * 2020-11-10 2021-02-26 郑州轻工业大学 Image encryption method based on block scrambling and state conversion

Patent Citations (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
US20170109858A1 (en) * 2015-10-15 2017-04-20 Ningbo University Zero-watermarking registration and detection method for HEVC video streaming against requantization transcoding
CN107609621A (en) * 2017-08-21 2018-01-19 哈尔滨工业大学深圳研究生院 A kind of dot matrix security code design method and its application system based on chaos encryption
CN110417539A (en) * 2019-08-02 2019-11-05 齐齐哈尔大学 A kind of color image encrypting method of dynamic chaos and matrix convolution operation
CN111800251A (en) * 2020-05-21 2020-10-20 北京邮电大学 Image compressed sensing encryption and decryption method, device and system based on chaotic source
CN112001467A (en) * 2020-07-24 2020-11-27 南通大学 Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption
CN112422268A (en) * 2020-11-10 2021-02-26 郑州轻工业大学 Image encryption method based on block scrambling and state conversion

Also Published As

Publication number Publication date
CN113935346B (en) 2022-06-21

Similar Documents

Publication Publication Date Title
CN112001467B (en) Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption
CN109472338B (en) Batch generation method of commodity anti-counterfeiting two-dimensional codes
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
FR2586122A1 (en) POSTING MACHINE WITH INFORMATION CODE IN THE INDEX
CN111382452A (en) Encryption method for converting Chinese characters into pictures
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
Ali et al. Image steganography technique by using Braille method of blind people (LSBraille)
CN112217627B (en) Layered encrypted commodity anti-counterfeiting code generation method
CN113255860B (en) Commodity anti-counterfeiting two-dimensional code generation method based on layered encryption
CN113935346B (en) Commodity anti-counterfeiting code generation method based on trademark picture scrambling encryption
CN113935345B (en) Commodity anti-counterfeiting code batch generation method based on character string-to-picture encryption
CN111382820B (en) Four-lattice pure-color commodity anti-counterfeiting code generation method
CN113159252A (en) Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules
CN113935347B (en) Commodity anti-counterfeiting code identification method based on anti-counterfeiting picture scrambling and decryption
CN105205777B (en) A kind of coding method of latent image password
CN113947096A (en) Commodity anti-counterfeiting code identification method based on picture-to-character string decryption
WO2022131965A1 (en) Method for encoding and decoding digital information in the form of a multidimensional nano-barcode
CN113935343B (en) Commodity anti-counterfeiting code generation method based on character string-to-picture encryption
CN113935344A (en) Commodity anti-counterfeiting code batch generation method based on trademark picture scrambling encryption
Tan et al. Visual secret sharing scheme for color qr code
CN113962839A (en) Multi-color mode quantum image blind watermarking method based on TMQIR
Chavan et al. Data embedding technique using secret fragment visible mosaic image for covered communication

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