CN112884105A - Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption - Google Patents

Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption Download PDF

Info

Publication number
CN112884105A
CN112884105A CN202110320555.4A CN202110320555A CN112884105A CN 112884105 A CN112884105 A CN 112884105A CN 202110320555 A CN202110320555 A CN 202110320555A CN 112884105 A CN112884105 A CN 112884105A
Authority
CN
China
Prior art keywords
sequence
commodity
counterfeiting
numerical
dimensional code
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
CN202110320555.4A
Other languages
Chinese (zh)
Other versions
CN112884105B (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.)
Hefei Minglong Electronic Technology Co ltd
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 CN202110320555.4A priority Critical patent/CN112884105B/en
Publication of CN112884105A publication Critical patent/CN112884105A/en
Application granted granted Critical
Publication of CN112884105B publication Critical patent/CN112884105B/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
    • 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
    • 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/06046Constructional details

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Credit Cards Or The Like (AREA)

Abstract

The invention discloses a commodity anti-counterfeiting two-dimensional code generation method based on shift encryption, which comprises the following steps: carrying out numerical data conversion on a commodity identification code A representing unique identity information of a certain commodity to obtain a numerical sequence P; calculating an initial value, parameters and an initial extraction position of the chaotic system by the sequence P and an external key, and generating a chaotic sequence X through chaotic mapping iteration; binary sequences obtained by binary conversion of elements in the sequence P one by one are subjected to cyclic shift in sequence by utilizing the chaotic signals obtained by extraction, and the extraction positions of the chaotic signals are along with the chaotic signals and the shifted data PPiAdjusting in real time; subsequently PP the shifted dataiAnd sequentially filling the gray level images into the matrixes representing the gray level images to generate a gray level image, and combining to generate the commodity anti-counterfeiting two-dimensional code. The commodity anti-counterfeiting two-dimensional code generation method based on the shift 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 two-dimensional code generation method based on shift encryption
Technical Field
The invention relates to the technical field of digital anti-counterfeiting, in particular to a commodity anti-counterfeiting two-dimensional code generation method based on shift encryption.
Background
The digital anti-counterfeiting technology is based on increasingly rampant counterfeit and inferior products, and the modern digital anti-counterfeiting technology is a novel high-tech anti-counterfeiting technology which comprehensively utilizes the technologies of digital coding technology, encryption technology, database technology, computer network, interactive voice processing (IRV) and the like. The digital anti-counterfeiting technology is developed comprehensively due to various defects of the traditional anti-counterfeiting technology, and the different digital anti-counterfeiting technologies according to anti-counterfeiting code generation modes mainly go through three stages of a random bar code anti-counterfeiting model, an encrypted ordered serial number anti-counterfeiting model and a comprehensive anti-counterfeiting model. Under the continuous efforts of all people, the digital anti-counterfeiting technology has become one of the most widely applied technologies in the anti-counterfeiting industry, and plays a very important role in the field of product anti-counterfeiting.
With the continuous progress of society, the market is increasingly developed. For enterprises, digital anti-counterfeiting can keep good brands. Meanwhile, the anti-counterfeiting mode of 'one object and one code' greatly increases the counterfeiting cost of counterfeiters, can record the positioning information of products, count the product inquiry times and the inquiry mode, and set the inquiry warning line according to the enterprise requirements. At present, an intelligent terminal becomes an important part in daily life of people, a digital anti-counterfeiting technology is gradually integrated into the Internet, a user scans a commodity anti-counterfeiting two-dimensional code through the intelligent terminal to perform one-key type authenticity query, and the development and popularization of the Internet lay a good foundation for landing of a digital anti-counterfeiting system.
The most fundamental part in digital anti-counterfeiting is to generate a commodity anti-counterfeiting code by using an encryption algorithm, wherein the selection of the encryption algorithm becomes more important. The chaotic system has high randomness and parameter sensitivity, and the generated chaotic signal has great influence on the diffusivity and the scrambling of the encrypted signal, so that the chaotic signal is used as a natural password and introduced into digital anti-counterfeiting encryption, and the encryption of commodity information by using the chaotic password technology is a good choice. Under the condition, a shifting encryption-based commodity anti-counterfeiting two-dimensional code generation method is provided by utilizing a chaotic cipher technology so as to generate a commodity anti-counterfeiting two-dimensional code with uniqueness and non-forgeability, and the method has good practical application and popularization values.
Disclosure of Invention
The purpose of the invention is as follows: the invention aims to solve the defects in the prior art and provides a displacement encryption-based commodity anti-counterfeiting two-dimensional code generation method, which comprises the steps of generating a chaotic sequence through chaotic mapping iteration, converting commodity identification codes into 8bits binary systems one by one binary system, sequentially performing cyclic shift by using chaotic signals obtained by extraction, simultaneously adjusting the extraction position of the chaotic signals in real time along with data after the shift to generate a gray image, and further combining to generate a commodity anti-counterfeiting two-dimensional code.
The technical scheme is as follows: a commodity anti-counterfeiting two-dimensional code generation method based on shift encryption comprises the following steps:
(1) transcoding
The commodity identification code A representing the unique identity information of a certain commodity is converted into numerical data one by one to obtain a numerical sequence
Figure BDA0002992719210000021
Wherein the commodity identification code A is a character of GBK code, and the length of the commodity identification code A is expressed as
Figure BDA0002992719210000022
The length of the numerical sequence P is
Figure BDA0002992719210000023
And is
Figure BDA0002992719210000024
(2) Generation of chaotic sequences
Firstly, an initial value x of Bernoulli chaotic mapping is respectively calculated and obtained by using a numerical value sequence P and external keys alpha and beta according to the following formulas (1) - (3)1And a parameter lambda and a primary extraction position n,
order to
Figure BDA0002992719210000025
Then
x1=0.01+mod(α+kp,0.99), (1)
λ=0.1+mod(β-kp,0.9), (2)
Figure BDA0002992719210000026
Wherein the external key satisfies α ∈ (0,1), β ∈ (0,1),
Figure BDA0002992719210000027
meaning that a number is rounded and the rounded value is not greater than the number,
then, the initial value x mapped by chaos1And a parameter lambda, iterating the Bernoulli chaotic mapping shown in the following formula (4), wherein k represents iteration times (k is 1, 2.), xk+1Represents the chaotic signal obtained by the k-th iteration,
Figure BDA0002992719210000028
obtaining a chaotic sequence X ═ X1,x2,...},
(3) Binary conversion, cyclic shift encryption of a sequence of values P
Using chaotic sequences X ═ X1,x2,.. }, log-value sequence
Figure BDA0002992719210000029
The following operations are sequentially carried out element by element:
s10, let the numerical sequence PP be a null sequence, and i ═ 1,
s11, extracting the nth element X from the chaotic sequence XnThe shift direction F _ direction and the shift number F _ number are calculated according to the following formulas (5) and (6),
Figure BDA00029927192100000210
Figure BDA00029927192100000211
s12, extracting the ith element P from the numerical sequence PiAnd combining the element PiConverting into 8-bit binary to obtain binary sequence PB ═ { PB ═ PB1,PB2,PB3,PB4,PB5,PB6,PB7,PB8Then, the value of the shift direction F _ direction is determined,
if F _ direction is equal to 0, circularly shifting the binary sequence PB to the left, shifting F _ number of binary sequences to obtain a shifted binary sequence
Figure BDA00029927192100000212
If F _ direction is equal to 1, the binary sequence PB is circularly right-shifted and F _ number of binary sequences are shifted to obtain a shifted binary sequence
Figure BDA0002992719210000031
The binary sequence is then transformed using the bin2dec (-) function
Figure BDA0002992719210000032
Conversion into numerical data PPiAnd stored in the numerical sequence PP,
s13, comparing i with
Figure BDA0002992719210000033
Size of (1), if
Figure BDA0002992719210000034
The extraction position n is adjusted as shown in the following equation (7) and i is made i +1, followed by the flow of steps S11,
Figure BDA0002992719210000035
if it is
Figure BDA0002992719210000036
The operation is stopped, resulting in a sequence of values
Figure BDA0002992719210000037
(4) Two-dimensional code generation
Firstly, determining the size of the gray picture, making the number of rows be H and the number of columns be L, wherein the number of columns
Figure BDA0002992719210000038
The number of rows H is such that,
Figure BDA0002992719210000039
wherein the content of the first and second substances,
Figure BDA00029927192100000310
meaning that a number is rounded and the rounded value is not less than the number,
then, according to a self-defined matrix data filling rule, elements in the numerical sequence PP are sequentially filled into a matrix M representing the gray-scale picture, so as to generate a gray-scale picture C, wherein the size of the matrix M is H multiplied by L, the size of the gray-scale picture C is 25H multiplied by 25L,
and finally, combining the commodity identification code A with the generated gray picture C, and converting the combined commodity identification code and gray picture into a two-dimensional code by using a two-dimensional code generator, thereby obtaining the commodity anti-counterfeiting two-dimensional code.
Further, in the shift encryption-based commodity anti-counterfeiting two-dimensional code generation method, the step (1) of converting the commodity identification code A representing the unique identity information of a certain commodity into numerical data one by adopting a unicode2native (·) function, namely converting double-byte characters into numerical data
Figure BDA00029927192100000311
For a single byte character, the conversion is expressed as
Figure BDA00029927192100000312
Thereby obtaining a numerical sequence
Figure BDA00029927192100000313
Further, in the shift encryption-based commodity anti-counterfeiting two-dimensional code generation method, the ith element P is extracted from the numerical value sequence P in the step (3)iAnd combining the element PiConversion to 8-bit binary means that dec2bin (P) is usedi8) function, i.e. [ PB ]1,PB2,PB3,PB4,PB5,PB6,PB7,PB8]=dec2bin(Pi8) to obtain a binary sequence PB ═ { PB)1,PB2,PB3,PB4,PB5,PB6,PB7,PB8}。
Further, in the shift encryption-based commodity anti-counterfeiting two-dimensional code generation method, the elements in the numerical value sequence PP are sequentially filled into the matrix M representing the gray level picture according to the customized matrix data filling rule in the step (4), and the method is carried out according to the following three steps:
step 1, judging the length of the numerical sequence PP
Figure BDA00029927192100000314
Whether or not it is less than the value H x L,
if so, in the numerical sequence PPAt the tail end supplement
Figure BDA00029927192100000315
Element, value size 0 and last element size
Figure BDA00029927192100000316
Obtaining a supplemented numerical sequence
Figure BDA0002992719210000041
Namely, it is
Figure BDA0002992719210000042
Figure BDA0002992719210000043
If not, the appended sequence of values is ordered
Figure BDA0002992719210000044
Equal to the numerical sequence PP, i.e.
Figure BDA0002992719210000045
And 2, starting from the position of the upper left corner of the matrix M representing the gray level picture, sequentially sequencing the supplemented numerical value sequence from left to right according to rows and each row
Figure BDA0002992719210000046
The medium elements are filled in a matrix M, which is expressed as follows,
Figure BDA0002992719210000047
step 3, each element in the matrix M is respectively replaced by a small matrix block, the matrix size of the small matrix block is 25 multiplied by 25, the element value is consistent with the element value in M, the expression is as follows,
Figure BDA0002992719210000048
the matrix MC is converted into a grayscale picture, thereby generating a grayscale picture C, wherein the size of the grayscale picture C is 25H × 25L.
Further, the commodity anti-counterfeiting two-dimensional code generation method based on shift encryption combines the commodity identification code A and the generated gray-scale picture C in the step (4), namely, the generated gray-scale picture C and the commodity identification code A are connected up and down, namely, the commodity identification code A is placed right below the generated gray-scale picture C.
Has the advantages that: the chaos sequence is generated through chaos mapping, the commodity identification codes are converted into 8-bit binary systems one by one, the chaos signals obtained through extraction are sequentially subjected to cyclic shift, meanwhile, the extraction positions of the chaos signals are adjusted in real time along with the shifted data, then, a gray image is generated by utilizing the matching property of the pixel values of the gray image and the numerical data range, and the two-dimensional code is combined to generate the commodity anti-counterfeiting code.
Drawings
Fig. 1 is a schematic diagram of a commodity anti-counterfeiting two-dimensional code generation process based on shift encryption.
Fig. 2 is a grayscale picture C in embodiment 1 of the present invention;
fig. 3 is a two-dimensional anti-counterfeit code for merchandise in embodiment 1 of the present invention.
Detailed Description
As shown in fig. 1, a method for generating a commodity anti-counterfeiting two-dimensional code based on shift encryption includes the following steps:
(1) transcoding
The method comprises the steps of converting a commodity identification code A representing the unique identity information of a certain commodity into numerical data one by adopting a unicode2native () function, namely converting double-byte characters into numerical data
Figure BDA0002992719210000051
For a single byte character, the conversion is expressed as
Figure BDA0002992719210000052
Thereby obtaining a numerical sequence
Figure BDA0002992719210000053
Figure BDA0002992719210000054
Wherein the commodity identification code A is a character of GBK code, and the length of the commodity identification code A is expressed as
Figure BDA0002992719210000055
The length of the numerical sequence P is
Figure BDA0002992719210000056
And is
Figure BDA0002992719210000057
(2) Generation of chaotic sequences
Firstly, respectively calculating an initial value x of Bernoulli chaotic mapping by using a numerical value sequence P and external keys alpha and beta according to the following formula1And a parameter lambda and a primary extraction position n,
order to
Figure BDA0002992719210000058
Then
x1=0.01+mod(α+kp,0.99),
λ=0.1+mod(β-kp,0.9),
Figure BDA0002992719210000059
Wherein the external key satisfies α ∈ (0,1), β ∈ (0,1),
then, the initial value x mapped by chaos1And a parameter lambda, iterating the Bernoulli chaotic mapping shown in the following formula, wherein k represents iteration times (k is 1, 2.), xk+1Represents the chaotic signal obtained by the k-th iteration,
Figure BDA00029927192100000510
obtaining a chaotic sequence X ═ X1,x2,...},
(3) Binary conversion, cyclic shift encryption of a sequence of values P
Using chaotic sequences X ═ X1,x2,.. }, log-value sequence
Figure BDA00029927192100000511
The following operations are sequentially carried out element by element:
s10, let the numerical sequence PP be a null sequence, and i ═ 1,
s11, extracting the nth element X from the chaotic sequence XnThe shift direction F _ direction and the shift number F _ number are respectively calculated according to the following formulas,
Figure BDA0002992719210000061
Figure BDA0002992719210000062
s12, extracting the ith element P from the numerical sequence PiAnd dec2bin (P) is usedi8) function of the element PiConversion to 8-bit binary, i.e. [ PB ]1,PB2,PB3,PB4,PB5,PB6,PB7,PB8]=dec2bin(Pi8), a binary sequence PB ═ { PB) is obtained1,PB2,PB3,PB4,PB5,PB6,PB7,PB8Then, the value of the shift direction F _ direction is determined,
if F _ direction is equal to 0, circularly shifting the binary sequence PB to the left, shifting F _ number of binary sequences to obtain a shifted binary sequence
Figure BDA0002992719210000063
If F _ direction is equal to 1, the binary sequence PB is circularly right-shifted and F _ number of binary sequences are shifted to obtain a shifted binary sequence
Figure BDA0002992719210000064
Then, the binary sequence is processed
Figure BDA0002992719210000065
Conversion into numerical data PPiAnd stored in the numerical sequence PP,
s13, comparing i with
Figure BDA0002992719210000066
Size of (1), if
Figure BDA0002992719210000067
The extraction position n is adjusted as shown below, and i is made i +1, followed by a shift to step S11,
Figure BDA0002992719210000068
if it is
Figure BDA0002992719210000069
The operation is stopped, resulting in a sequence of values
Figure BDA00029927192100000610
(4) Two-dimensional code generation
Firstly, determining the size of the gray picture, making the number of rows be H and the number of columns be L, wherein the number of columns
Figure BDA00029927192100000611
The number of rows H is such that,
Figure BDA00029927192100000612
then, the method comprises the following steps in sequence:
step I, judging the length of the numerical sequence PP
Figure BDA00029927192100000613
Whether or not it is less than the value H x L,
if so, adding at the tail end of the numerical sequence PP
Figure BDA00029927192100000614
Element, value size 0 and last element size
Figure BDA00029927192100000615
Obtaining a supplemented numerical sequence
Figure BDA00029927192100000616
Namely, it is
Figure BDA00029927192100000617
Figure BDA00029927192100000618
If not, the appended sequence of values is ordered
Figure BDA00029927192100000619
Equal to the numerical sequence PP, i.e.
Figure BDA00029927192100000620
The supplemented numerical value sequence is sequentially arranged from the upper left corner of the matrix M representing the gray level picture according to the rows and from left to right of each row
Figure BDA00029927192100000621
The medium elements are filled in a matrix M, which is expressed as follows,
Figure BDA0002992719210000071
replacing each element in the matrix M with a small matrix block, wherein the matrix size of the small matrix block is 25 multiplied by 25, the element values are all consistent with the element values in the matrix M, and the expression is as follows,
Figure BDA0002992719210000072
the matrix MC is converted into a grayscale picture, thereby generating a grayscale picture C, wherein the grayscale picture C has a size of 25 hx 25L,
and finally, the generated gray picture C and the commodity identification code A are connected vertically in a combined mode, namely the commodity identification code A is placed under the generated gray picture C, and the combined commodity identification code and the gray picture are converted into a two-dimensional code by using a two-dimensional code generator, so that the commodity anti-counterfeiting two-dimensional code is obtained.
The invention is further illustrated by the following specific examples:
example 1
According to the method for generating the commodity anti-counterfeiting two-dimensional code based on the shift encryption, the steps are as follows:
(1) firstly, a product identification code a representing unique identity information of a certain product is converted into numerical data one by "production serial number 123456" of 2021-01-01 production line ii 01 production line, which is a production date of a certain product, so as to obtain a numerical sequence P {189,173,203,213,202,161,163, 188,175,205,197,161,193, 185,171,203,190,161,238,42,42, 201,204,198,183,32,201,250,178,250,200,213,198,218,50,48,50,49,45,48,49,45, 49,32,201,250, 207,223,162,242,163,176,163,177,32,201,250,178,250, 186, 250, 163,182, 163,177, 178, 180, a code of a character, wherein the code length of the product is a code, a code of the product, 177,32,201, 178,163, 180, a code
Figure BDA0002992719210000073
The length of the numerical sequence P is
Figure BDA0002992719210000074
(2) Generation of chaotic sequences
First, using the numerical sequence P and the external keys α -0.12345 and β -0.54321, the initial value x of the Bernoulli chaotic map is calculated according to the following formula1And a parameter lambda and a primary extraction position n,
order to
Figure BDA0002992719210000081
Then
x1=0.01+mod(0.12345+0.321188158633497,0.99)=0.454638158633497,
λ=0.1+mod(0.54321-0.321188158633497,0.9)=0.322021841366502,
Figure BDA0002992719210000082
Then, the initial value x mapped by chaos10.454638158633497 and 0.322021841366502, iterating the Bernoulli chaotic mapping shown in the following formula to obtain a chaotic sequence X ═ X ═ 0.3220218413665021,x2,...};
Figure BDA0002992719210000083
(3) Binary conversion, cyclic shift encryption of a sequence of values P
Using chaotic sequences X ═ X1,x2,.. }, log-value sequence
Figure BDA00029927192100000811
The following operations are sequentially carried out element by element:
s10, let the numerical sequence PP be a null sequence, and i ═ 1,
s11, extracting the nth element X from the chaotic sequence XnAccording toThe shift direction F _ direction and the number of shifts F _ number are calculated respectively by the following formulas,
Figure BDA0002992719210000084
Figure BDA0002992719210000085
s12, extracting the ith element P from the numerical sequence PiAnd dec2bin (P) is usedi8) function of the element PiConversion to 8-bit binary, i.e. [ PB ]1,PB2,PB3,PB4,PB5,PB6,PB7,PB8]=dec2bin(Pi8), a binary sequence PB ═ { PB) is obtained1,PB2,PB3,PB4,PB5,PB6,PB7,PB8Then, the value of the shift direction F _ direction is determined,
if F _ direction is equal to 0, circularly shifting the binary sequence PB to the left, shifting F _ number of binary sequences to obtain a shifted binary sequence
Figure BDA0002992719210000086
If F _ direction is equal to 1, the binary sequence PB is circularly right-shifted and F _ number of binary sequences are shifted to obtain a shifted binary sequence
Figure BDA0002992719210000087
Then, the binary sequence is processed
Figure BDA0002992719210000088
Conversion into numerical data PPiAnd stored in the numerical sequence PP,
s13, comparing i with
Figure BDA0002992719210000089
If i is less than 85,the extraction position n is adjusted as shown below, and i is made i +1, followed by a shift to step S11,
Figure BDA00029927192100000810
if i is 85, the operation is stopped,
thereby obtaining the numerical sequence PP ═ 246,218,121,87,149,52,163, 71,232,121,245,55,197,13,28,104,193,230,93,47,215,161,119,69,42,162,81,39,102,27,183,128,201,245,43,250,50,213,108,214,145,3,200,49,45,129,137,75,6,98,32,228,175,43,190,207,254,69,242,29,176,29,27,2,201,245,178,245,104,203,117,226,71,216,163,172,142,59,209, 214,29,109 };
(4) two-dimensional code generation
First, the size of the grayscale picture is determined, and the number of rows H9 and the number of columns L10 are obtained
Then, the method comprises the following steps in sequence:
adding 5 elements at the tail end of the numerical sequence PP, wherein the numerical value is 0 and the last element is 85 to obtain a supplemented numerical sequence
Figure BDA0002992719210000091
Figure BDA0002992719210000092
The supplemented numerical value sequence is sequentially arranged from the upper left corner of the matrix M representing the gray level picture according to the rows and from left to right of each row
Figure BDA0002992719210000093
The medium elements are filled into a matrix M, where the size of the matrix M is 9 x 10, as indicated below,
Figure BDA0002992719210000094
replacing each element in the matrix M with a small matrix block, wherein the matrix size of the small matrix block is 25 multiplied by 25, the element values are all consistent with the element values in the matrix M, and the expression is as follows,
Figure BDA0002992719210000095
the matrix MC is then converted into a grayscale picture, thereby generating a grayscale picture C, as shown in fig. 2, wherein the grayscale picture C has a size of 225 x 250,
and finally, the generated gray picture C and the commodity identification code A are connected up and down in a combined mode, namely the commodity identification code A is placed under the generated gray picture C, and the combined commodity identification code and the gray picture are converted into a two-dimensional code by using a two-dimensional code generator, so that the commodity anti-counterfeiting two-dimensional code is obtained, as shown in fig. 3.
Example 2
According to the shift encryption-based commodity anti-counterfeiting two-dimensional code generation method, the commodity identification code character string A of a certain commodity and the commodity anti-counterfeiting two-dimensional code generation steps are similar to those of the specific embodiment 1, and only a certain external secret key slightly changes: 0.12345000000001; or beta is 0.54321000000001, and the generation result of the anti-counterfeiting two-dimensional code is shown in table 1. As can be seen from the following table: once the external key slightly changes, the generated two-dimensional anti-counterfeiting code for the commodity greatly changes, so that the method for generating the two-dimensional anti-counterfeiting code for the commodity based on the shift encryption has key sensitivity.
TABLE 1 Generation result of two-dimensional anti-counterfeiting code for commodities when external secret key is slightly changed
Figure BDA0002992719210000101
Figure BDA0002992719210000111
Example 3
According to the method for generating the anti-counterfeiting two-dimensional code of the commodity based on the shift encryption, the steps of generating the external key and the anti-counterfeiting two-dimensional code of the commodity are similar to those in the specific embodiment 1, and only the commodity identification code character string a of a certain commodity is slightly changed, namely 'Gang Suzhou # # group x company'; or "production date of # group x company of Jiangsu province" product production date 2021-11-01 production line II 01 production number 123456 "; or "jiangsu province # # group x company · commodity production date 2021-01-01 production line ii 02 production serial number 123465", and the generation results of the commodity forgery-proof two-dimensional code are shown in table 2. As can be seen from the following table: once the commodity identification code character string representing the unique identity information of a certain commodity slightly changes, the generated commodity anti-counterfeiting two-dimensional code can greatly change, so that the commodity anti-counterfeiting two-dimensional code generation method based on the shift encryption disclosed by the patent has sensitivity to the commodity identity information (namely the commodity identification code).
TABLE 2 Generation result of two-dimensional anti-counterfeiting code for commodity when commodity identification code is slightly changed
Figure BDA0002992719210000121
Figure BDA0002992719210000131
As can be seen from the analysis of the above specific embodiments 2 and 3, the two-dimensional code generated by the method for generating a two-dimensional code for merchandise anti-counterfeiting based on shift encryption provided by the present patent is not only closely related to an external secret key, but also depends on a merchandise identification code representing unique identity information of a certain piece of merchandise, so that the method for generating a two-dimensional code for merchandise anti-counterfeiting based on shift encryption provided by the present patent has strong security, can better resist known/selected plaintext attacks, is not easy to crack, and ensures that the generated two-dimensional code for merchandise anti-counterfeiting has "uniqueness" and "unforgeability".
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (5)

1. A commodity anti-counterfeiting two-dimensional code generation method based on shift encryption is characterized by comprising the following steps:
(1) transcoding
The commodity identification code A representing the unique identity information of a certain commodity is converted into numerical data one by one to obtain a numerical sequence
Figure FDA0002992719200000011
Wherein the commodity identification code A is a character of GBK code, and the length of the commodity identification code A is expressed as
Figure FDA0002992719200000012
The length of the numerical sequence P is
Figure FDA0002992719200000013
And is
Figure FDA0002992719200000014
(2) Generation of chaotic sequences
Firstly, an initial value x of Bernoulli chaotic mapping is respectively calculated and obtained by using a numerical value sequence P and external keys alpha and beta according to the following formulas (1) - (3)1And a parameter lambda and a primary extraction position n,
order to
Figure FDA0002992719200000015
Then
x1=0.01+mod(α+kp,0.99), (1)
λ=0.1+mod(β-kp,0.9), (2)
Figure FDA0002992719200000016
Wherein the external key satisfies α ∈ (0,1), β ∈ (0,1),
Figure FDA0002992719200000017
meaning that a number is rounded and the rounded value is not greater than the number,
then, the initial value x mapped by chaos1And a parameter lambda, iterating the Bernoulli chaotic mapping shown in the following formula (4), wherein k represents iteration times (k is 1, 2.), xk+1Represents the chaotic signal obtained by the k-th iteration,
Figure FDA0002992719200000018
obtaining a chaotic sequence X ═ X1,x2,...},
(3) Binary conversion, cyclic shift encryption of a sequence of values P
Using chaotic sequences X ═ X1,x2,.. }, log-value sequence
Figure FDA0002992719200000019
The following operations are sequentially carried out element by element:
s10, let the numerical sequence PP be a null sequence, and i ═ 1,
s11, extracting the nth element X from the chaotic sequence XnThe shift direction F _ direction and the shift number F _ number are calculated according to the following formulas (5) and (6),
Figure FDA00029927192000000110
Figure FDA00029927192000000111
s12, extracting the ith element P from the numerical sequence PiAnd combining the element PiConverting into 8-bit binary to obtain binary sequence PB ═ { PB ═ PB1,PB2,PB3,PB4,PB5,PB6,PB7,PB8Then, the value of the shift direction F _ direction is determined,
if F _ direction is equal to 0, circularly shifting the binary sequence PB to the left, shifting F _ number of binary sequences to obtain a shifted binary sequence
Figure FDA0002992719200000021
If F _ direction is equal to 1, the binary sequence PB is circularly right-shifted and F _ number of binary sequences are shifted to obtain a shifted binary sequence
Figure FDA0002992719200000022
The binary sequence is then transformed using the bin2dec (-) function
Figure FDA0002992719200000023
Conversion into numerical data PPiAnd stored in the numerical sequence PP,
s13, comparing i with
Figure FDA0002992719200000024
Size of (1), if
Figure FDA0002992719200000025
The extraction position n is adjusted as shown in the following equation (7) and i is made i +1, followed by the flow of steps S11,
Figure FDA0002992719200000026
if it is
Figure FDA0002992719200000027
The operation is stopped, resulting in a sequence of values
Figure FDA00029927192000000213
(4) Two-dimensional code generation
Figure FDA0002992719200000028
Wherein the content of the first and second substances,
Figure FDA0002992719200000029
meaning that a number is rounded and the rounded value is not less than the number,
then, according to a self-defined matrix data filling rule, elements in the numerical sequence PP are sequentially filled into a matrix M representing the gray-scale picture, so as to generate a gray-scale picture C, wherein the size of the matrix M is H multiplied by L, the size of the gray-scale picture C is 25H multiplied by 25L,
and finally, combining the commodity identification code A with the generated gray picture C, and converting the combined commodity identification code and gray picture into a two-dimensional code by using a two-dimensional code generator, thereby obtaining the commodity anti-counterfeiting two-dimensional code.
2. The method for generating the commodity anti-counterfeiting two-dimensional code based on the shift encryption as claimed in claim 1, wherein: the step (1) of converting the commodity identification code A representing the unique identity information of a certain commodity into numerical data one by one means that the characters in the commodity identification code A are converted into the numerical data one by adopting a unicode2native () function, namely, the conversion of double-byte characters is expressed as
Figure FDA00029927192000000210
For a single byte character, the conversion is expressed as
Figure FDA00029927192000000211
Thereby obtaining a numerical sequence
Figure FDA00029927192000000212
3. The method for generating the commodity anti-counterfeiting two-dimensional code based on the shift encryption as claimed in claim 1, wherein: extracting the ith element P from the numerical sequence P in the step (3)iAnd combining the element PiConversion to 8-bit binary means that dec2bin (P) is usedi8) function, i.e. [ PB ]1,PB2,PB3,PB4,PB5,PB6,PB7,PB8]=dec2bin(Pi8) to obtain a binary sequence PB ═ { PB)1,PB2,PB3,PB4,PB5,PB6,PB7,PB8}。
4. The method for generating the commodity anti-counterfeiting two-dimensional code based on the shift encryption as claimed in claim 1, wherein: and (4) sequentially filling elements in the numerical value sequence PP into the matrix M representing the gray level picture according to the customized matrix data filling rule, namely performing the following three steps:
step 1, judging the length of the numerical sequence PP
Figure FDA0002992719200000031
Whether or not it is less than the value H x L,
if so, adding at the tail end of the numerical sequence PP
Figure FDA0002992719200000032
Element, value size 0 and last element size
Figure FDA0002992719200000033
Obtaining a supplemented numerical sequence
Figure FDA0002992719200000034
Namely, it is
Figure FDA0002992719200000035
Figure FDA0002992719200000036
If not, the appended sequence of values is ordered
Figure FDA0002992719200000037
Equal to the numerical sequence PP, i.e.
Figure FDA0002992719200000038
And 2, starting from the position of the upper left corner of the matrix M representing the gray level picture, sequentially sequencing the supplemented numerical value sequence from left to right according to rows and each row
Figure FDA0002992719200000039
The medium elements are filled in a matrix M, which is expressed as follows,
Figure FDA00029927192000000310
step 3, each element in the matrix M is respectively replaced by a small matrix block, the matrix size of the small matrix block is 25 multiplied by 25, the element value is consistent with the element value in M, the expression is as follows,
Figure FDA00029927192000000311
the matrix MC is converted into a grayscale picture, thereby generating a grayscale picture C, wherein the size of the grayscale picture C is 25H × 25L.
5. The method for generating the commodity anti-counterfeiting two-dimensional code based on the shift encryption as claimed in claim 1, wherein: the step (4) of combining the commodity identification code A with the generated grayscale picture C refers to a combination mode of connecting the generated grayscale picture C and the commodity identification code A up and down, namely, the commodity identification code A is placed right below the generated grayscale picture C.
CN202110320555.4A 2021-03-25 2021-03-25 Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption Active CN112884105B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110320555.4A CN112884105B (en) 2021-03-25 2021-03-25 Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110320555.4A CN112884105B (en) 2021-03-25 2021-03-25 Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption

Publications (2)

Publication Number Publication Date
CN112884105A true CN112884105A (en) 2021-06-01
CN112884105B CN112884105B (en) 2022-07-05

Family

ID=76042322

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110320555.4A Active CN112884105B (en) 2021-03-25 2021-03-25 Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption

Country Status (1)

Country Link
CN (1) CN112884105B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113935344A (en) * 2021-10-12 2022-01-14 南通大学 Commodity anti-counterfeiting code batch generation method based on trademark picture scrambling encryption
CN113935343A (en) * 2021-10-12 2022-01-14 南通大学 Commodity anti-counterfeiting code generation method based on character string-to-picture encryption
CN113947096A (en) * 2021-10-12 2022-01-18 南通大学 Commodity anti-counterfeiting code identification method based on picture-to-character string decryption
CN116186743A (en) * 2023-04-24 2023-05-30 北京华阅嘉诚科技发展有限公司 Data authorization method, system, equipment and storage medium based on two-dimension code
CN117221013A (en) * 2023-11-08 2023-12-12 深圳市地铁集团有限公司 Multimode ticket processing system based on ARM technology system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110053639A1 (en) * 2006-11-03 2011-03-03 Alcoril Holdings Sa Methods and devices for authenticating a product and a two-dimensional code and novel application of a two-dimensional code
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
CN109284803A (en) * 2018-11-19 2019-01-29 南通大学 A kind of commodity anti-counterfeit two-dimensional bar code generation method
CN111985591A (en) * 2020-07-24 2020-11-24 南通大学 Commodity anti-counterfeiting code generation method based on character string encryption
CN112163230A (en) * 2020-09-16 2021-01-01 南通大学 Commodity anti-counterfeiting code generation method based on Chinese character encryption

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110053639A1 (en) * 2006-11-03 2011-03-03 Alcoril Holdings Sa Methods and devices for authenticating a product and a two-dimensional code and novel application of a two-dimensional code
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
CN109284803A (en) * 2018-11-19 2019-01-29 南通大学 A kind of commodity anti-counterfeit two-dimensional bar code generation method
CN111985591A (en) * 2020-07-24 2020-11-24 南通大学 Commodity anti-counterfeiting code generation method based on character string encryption
CN112163230A (en) * 2020-09-16 2021-01-01 南通大学 Commodity anti-counterfeiting code generation method based on Chinese character encryption

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘鹏等: "超混沌视频加密系统的FPGA设计与实现", 《电讯技术》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113935344A (en) * 2021-10-12 2022-01-14 南通大学 Commodity anti-counterfeiting code batch generation method based on trademark picture scrambling encryption
CN113935343A (en) * 2021-10-12 2022-01-14 南通大学 Commodity anti-counterfeiting code generation method based on character string-to-picture encryption
CN113947096A (en) * 2021-10-12 2022-01-18 南通大学 Commodity anti-counterfeiting code identification method based on picture-to-character string decryption
CN116186743A (en) * 2023-04-24 2023-05-30 北京华阅嘉诚科技发展有限公司 Data authorization method, system, equipment and storage medium based on two-dimension code
CN116186743B (en) * 2023-04-24 2023-07-28 北京华阅嘉诚科技发展有限公司 Data authorization method, system, equipment and storage medium based on two-dimension code
CN117221013A (en) * 2023-11-08 2023-12-12 深圳市地铁集团有限公司 Multimode ticket processing system based on ARM technology system
CN117221013B (en) * 2023-11-08 2024-02-06 深圳市地铁集团有限公司 Multimode ticket processing system based on ARM technology system

Also Published As

Publication number Publication date
CN112884105B (en) 2022-07-05

Similar Documents

Publication Publication Date Title
CN112884104B (en) Commodity anti-counterfeiting two-dimensional code generation method based on chaotic encryption
CN112884105B (en) Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption
CN113052286A (en) Commodity anti-counterfeiting two-dimensional code generation method based on scrambling encryption
CN109472338B (en) Batch generation method of commodity anti-counterfeiting two-dimensional codes
Zhang et al. Reference sharing mechanism for watermark self-embedding
Rani et al. Data security through qr code encryption and steganography
CN113255860B (en) Commodity anti-counterfeiting two-dimensional code generation method based on layered encryption
CN112001467B (en) Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption
CN103310344B (en) CCQR (Colorful Coded Quick Response) anti-counterfeiting method
CN112001468B (en) Character type commodity anti-counterfeiting code generation and identification method
CN113159252A (en) Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules
CN112163230B (en) Commodity anti-counterfeiting code generation method based on Chinese character encryption
CN110475038B (en) Character and picture generating type hiding and recovering method combined with minimum closure coding
CN112070636B (en) Image electronic contract signing and verifying method with multistage evidence chain
CN112149773B (en) Commodity anti-counterfeiting code generation method based on Chinese character encryption
CN111382820B (en) Four-lattice pure-color commodity anti-counterfeiting code generation method
Srilakshmi et al. Text embedding using image steganography in spatial domain
CN111368960B (en) Quantum anti-counterfeiting two-dimensional code generation method and scanning method
CN100550049C (en) The embedding grammar of printed matter anti-counterfeit digital water print and detection method thereof
Munir Application of the modified EzStego algorithm for hiding secret messages in the animated GIF images
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
Sultana et al. An Edge Detection Based Reversible Data Hiding Scheme
CN113935347B (en) Commodity anti-counterfeiting code identification method based on anti-counterfeiting picture scrambling and decryption
CN102013208A (en) Anti-counterfeit method and product of bar code and safety line

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
TR01 Transfer of patent right

Effective date of registration: 20240515

Address after: 230000 B-1015, wo Yuan Garden, 81 Ganquan Road, Shushan District, Hefei, Anhui.

Patentee after: HEFEI MINGLONG ELECTRONIC TECHNOLOGY Co.,Ltd.

Country or region after: China

Address before: 226000 Jiangsu city of Nantong province sik Road No. 9

Patentee before: NANTONG University

Country or region before: China