CN111985591B - Commodity anti-counterfeiting code generation method based on character string encryption - Google Patents

Commodity anti-counterfeiting code generation method based on character string encryption Download PDF

Info

Publication number
CN111985591B
CN111985591B CN202010723902.3A CN202010723902A CN111985591B CN 111985591 B CN111985591 B CN 111985591B CN 202010723902 A CN202010723902 A CN 202010723902A CN 111985591 B CN111985591 B CN 111985591B
Authority
CN
China
Prior art keywords
sequence
binary
commodity
counterfeiting
character string
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010723902.3A
Other languages
Chinese (zh)
Other versions
CN111985591A (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 CN202010723902.3A priority Critical patent/CN111985591B/en
Publication of CN111985591A publication Critical patent/CN111985591A/en
Application granted granted Critical
Publication of CN111985591B publication Critical patent/CN111985591B/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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/018Certifying business or products
    • G06Q30/0185Product, service or business identity fraud
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Credit Cards Or The Like (AREA)
  • Complex Calculations (AREA)

Abstract

The invention discloses a commodity anti-counterfeiting code generation method based on character string encryption, which comprises the following steps: carrying out numerical data and 8bits binary conversion on a commodity identification code character string A representing unique identity information of a certain commodity to obtain a binary sequence B; calculating to obtain an initial value, an extraction starting position and an extraction interval number of the chaotic system, performing chaotic iteration to obtain a chaotic signal sequence X1, scrambling a binary sequence B by using a position change scrambling rule before and after ascending sequencing of the sequence X1 to obtain a scrambled binary sequence
Figure DDA0002600986360000011
Will binary sequence
Figure DDA0002600986360000012
The medium elements are grouped by taking 5 elements as units from beginning to end, and the odd-even grouping sequences are recombined respectively, so that the commodity anti-counterfeiting number is generated, and further the commodity anti-counterfeiting (two-dimensional) code is generated by combination. The commodity anti-counterfeiting code generation method based on the character string encryption is simple and feasible, has strong safety and is not easy to crack, and the generated commodity anti-counterfeiting code has uniqueness and non-forgeability.

Description

Commodity anti-counterfeiting code generation method based on character string encryption
Technical Field
The invention relates to the technical field of digital anti-counterfeiting, in particular to a commodity anti-counterfeiting code generation method based on character string encryption.
Background
At present, the anti-counterfeiting technology for realizing commodity anti-counterfeiting and preventing counterfeiting is continuously developed and perfected, but a plurality of problems still exist, and the anti-counterfeiting technologies such as holographic image anti-counterfeiting, ink anti-counterfeiting, thermochromic anti-counterfeiting, special printing anti-counterfeiting and the like in the market have the advantages of high identification degree, convenience in manufacturing and low manufacturing cost, but do not meet the safety and uniqueness in the anti-counterfeiting technology. Once imitated, the interests of consumers and manufacturers are damaged, and the construction of a market integrity system is greatly threatened. Some high-end anti-counterfeiting technologies, such as biological anti-counterfeiting and laser anti-counterfeiting, have good anti-counterfeiting capability and almost do not have the situation of counterfeiting, but the technical requirements and equipment cost used by the anti-counterfeiting technologies are too high, so that the anti-counterfeiting technologies cannot be well popularized. Therefore, the digital anti-counterfeiting technology which is acceptable in cost and technology has wide application prospect. The present digital anti-counterfeiting technology can be simply expressed as processing a group of data, namely commodity anti-counterfeiting codes, by an encryption method, and making the group of data into anti-counterfeiting codes in various forms such as one-dimensional codes, two-dimensional codes, colored two-dimensional codes, RFID and the like. 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. When the consumer identifies the commodity anti-counterfeiting code, the consumer can inquire the authenticity of the commodity in a mode of surfing the internet, dialing a free telephone or sending a short message. The commodity anti-counterfeiting code has the characteristics of non-imitability and uniqueness, is easy to identify and can be used for anti-counterfeiting tracking.
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 character string encryption.
The invention provides a commodity anti-counterfeiting code generation method based on character string encryption, which comprises the following steps:
(1) transcoding: converting the commodity identification code character string A representing the unique identity information of a certain commodity into numerical data one by one to obtain a numerical sequence P ═ { P ═ P1,P2,...,Pi,....,PLConverting the numerical sequence P into binary data of 8bits element by element to obtain a binary sequence B ═ B1,B2,...,Bi,....,B8×LThe commodity identification code character string A comprises Chinese punctuation marks in a GB2312 character set, double-byte coded Chinese characters in the GB2312 character set and ASCLL code values E [32,126]]The length of the commodity identification code character string A is represented as LL, the length of the numerical sequence P is represented as L, the binary sequence B contains 8 xL bits, and the LL is not less than L and not more than 2 xLL;
(2) scrambling of binary sequence B:
firstly, an initial value x of Logistic chaotic mapping is respectively calculated by using a binary sequence B and external keys alpha and beta according to the following formulas (1) to (3)1And an extraction start position m1And the number of decimation intervals n1
Figure BDA0002600986340000021
Figure BDA0002600986340000022
Figure BDA0002600986340000023
Wherein, in the binary sequence B, when B isiWhen the value is '1', 37 × i × Bi37 × i and
Figure BDA0002600986340000024
when B is presentiWhen the molecular weight is equal to '0',
Figure BDA0002600986340000025
and 37 xixBiKB _1 denotes the sum of the number of '1' bits in the binary sequence B, KB _0 denotes the sum of the number of '0' bits in the binary sequence B, the external key satisfies α ∈ (0,1) and β ∈ (3.57,4),
then, the initial value x mapped by chaos1And an external key beta, iterating the Logistic 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 iteration,
xk+1=β×xk×(1-xk) (4)
obtaining a chaotic signal sequence X ═ X1,x2,.. }, m-th from sequence X1The elements start to be spaced by n1Taking 1 element as an element to form a chaotic signal sequence X1 with the length of 8 multiplied by L (X1)1,X12,...,X18×L},
Finally, the chaotic signal sequence X1 is sorted in ascending order, and the binary sequence B is set as { B ] according to the position change scrambling rule before and after the chaotic signal sequence X1 is sorted1,B2,...,Bi,....,B8×LScrambling to obtain a scrambled binary sequence
Figure BDA0002600986340000026
(3) Scrambled binary sequence
Figure BDA0002600986340000027
Grouping and recombining:
firstly, the scrambled binary sequence is aligned
Figure BDA0002600986340000028
Grouping the binary sequences
Figure BDA0002600986340000029
Sequentially and positively grouping the medium elements from head to tail by taking 5 elements as a unit, and if redundant elements are left, filling binary '0' at the tail until the group of 5 elements is filled to obtain a grouped binary sequence which is expressed as
Figure BDA00026009863400000210
Wherein each binary block sequence comprises 5 binary bits, an
Figure BDA00026009863400000211
Each binary packet sequence BF { i } is then formed, where
Figure BDA00026009863400000212
The following recombination operations were performed in sequence:
if mod (i,2) is 1, i.e. is an odd number of binary packet sequences BF { i }, the top of the binary packet sequences BF { i } is added with a binary '010', denoted as
Figure BDA00026009863400000213
If mod (i,2) ═ 0, that is, the even numbered binary packet sequence BF { i }, the first, between the 4 th bit and the 5 th bit, and the last of the binary packet sequence BF { i } are added with binary '0', '1', and '0' in sequence, and expressed as
Figure BDA00026009863400000214
And will reorganize the binary packet sequence
Figure BDA00026009863400000215
The order of the front element and the rear element is reversed,
finally, each recombined binary grouping sequence is sequentially divided into groups by utilizing a bin2dec (-) function
Figure BDA00026009863400000216
Conversion into numerical data
Figure BDA00026009863400000217
Wherein
Figure BDA0002600986340000031
Thereby obtaining a numerical sequence
Figure BDA0002600986340000032
(4) Transcoding: sequence of values
Figure BDA0002600986340000033
Each element in the above-mentioned character sequence is converted into numerical value and character to obtain character sequence C, i.e. it is a commodity anti-false number, in which the length of the character sequence C is
Figure BDA0002600986340000034
And combining the commodity identification code character string A with the commodity anti-counterfeiting number to generate a commodity anti-counterfeiting code, and finally generating a commodity anti-counterfeiting two-dimensional code.
Further, the commodity anti-counterfeiting code generation method based on string encryption converts the commodity identification code string A representing the unique identity information of a certain commodity into numerical data one by one in the step (1), namely converts visible characters of an ASCII code value of [32,126] into single numerical data one by one in the commodity identification code string A by adopting a unicode2native () function, or converts Chinese punctuation marks and double-byte coded Chinese characters in a GB2312 character set into two numerical data, so as to obtain a numerical sequence P.
Further, commodity based on character string encryptionThe numerical value sequence in the step (4) of the anti-counterfeiting code generation method
Figure BDA0002600986340000035
Each element in (1) performs value-to-character conversion, which means that char (-) function is used to convert numerical data into ASCLL code value e [32,126]]Is a visible character, i.e.
Figure BDA0002600986340000036
Thereby obtaining the character sequence C.
Further, in the method for generating the commodity anti-counterfeiting code based on the character string encryption, the commodity identification code character string A and the commodity anti-counterfeiting number are combined to generate the commodity anti-counterfeiting code in the step (4), and the method is a combination mode that the commodity identification code character string A and the commodity anti-counterfeiting number are directly connected in sequence, or directly connected in reverse order, or connected in spaced insertion order.
Has the beneficial effects that: the invention generates chaotic signal sequence by chaotic mapping, scrambles the binary sequence converted from commodity identification code character string, groups elements in the scrambled binary sequence, and carries out different recombination operations according to the parity of the grouped sequence, thereby generating commodity anti-counterfeiting number, and further generating commodity anti-counterfeiting (two-dimensional) code by combination.
Drawings
FIG. 1 is a schematic diagram of a process for generating a commodity anti-counterfeiting code based on string encryption according to the present invention;
fig. 2 is a two-dimensional anti-counterfeiting code of a commodity obtained in embodiment 1 by the method for generating an anti-counterfeiting code of a commodity based on string encryption provided by the invention.
Detailed Description
As shown in fig. 1, a method for generating a commodity anti-counterfeit code based on string encryption includes the following steps:
(1) transcoding: a commodity identification code character string A representing the unique identity information of a certain commodityThe character-by-character ASCII code value is assigned to [32,126] by using unicode2native () function]Converting the visible characters into single numerical data, or converting Chinese punctuation marks in GB2312 character set and double-byte coded Chinese characters into two numerical data to obtain numerical sequence P ═ { P ═ P { (P) }1,P2,...,Pi,....,PLConverting the numerical sequence P into binary data of 8bits element by element to obtain a binary sequence B ═ B1,B2,...,Bi,....,B8×LThe commodity identification code character string A comprises Chinese punctuation marks in a GB2312 character set, double-byte coded Chinese characters in the GB2312 character set and ASCLL code values E [32,126]]The length of the commodity identification code character string A is represented as LL, the length of the numerical sequence P is represented as L, the binary sequence B contains 8 xL bits, and the LL is not less than L and not more than 2 xLL;
(2) scrambling of binary sequence B:
firstly, an initial value x of Logistic chaotic mapping is respectively calculated by using a binary sequence B and external keys alpha and beta according to the following formulas (1) to (3)1And an extraction start position m1And the number of decimation intervals n1
Figure BDA0002600986340000041
Figure BDA0002600986340000042
Figure BDA0002600986340000043
Wherein, in the binary sequence B, when B isiWhen the value is '1', 37 × i × Bi37 × i and
Figure BDA0002600986340000044
when B is presentiWhen the molecular weight is equal to '0',
Figure BDA0002600986340000045
and 37 xixBiKB _1 denotes the sum of the number of '1' bits in the binary sequence B, KB _0 denotes the sum of the number of '0' bits in the binary sequence B, the external key satisfies α ∈ (0,1) and β ∈ (3.57,4),
then, the initial value x mapped by chaos1And an external key beta, iterating the Logistic 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,
xk+1=β×xk×(1-xk) (4)
obtaining a chaotic signal sequence X ═ X1,x2,.. }, m-th from sequence X1The elements start to be spaced by n1Taking 1 element as an element to form a chaotic signal sequence X1 with the length of 8 multiplied by L (X1)1,X12,...,X18×L},
Finally, the chaotic signal sequence X1 is sorted in ascending order, and the binary sequence B is set as { B ] according to the position change scrambling rule before and after the chaotic signal sequence X1 is sorted1,B2,...,Bi,....,B8×LScrambling to obtain a scrambled binary sequence
Figure BDA0002600986340000046
(3) Scrambled binary sequence
Figure BDA0002600986340000047
Grouping and recombining:
first, the scrambled binary sequence is aligned
Figure BDA0002600986340000048
Grouping the binary sequences
Figure BDA0002600986340000049
The middle elements are sequentially and positively grouped by taking 5 elements as a unit from beginning to end, and if redundant elements are left, the binary system '0' is complemented at the end until 5 elements are complemented in a groupSo far, a grouped binary sequence is obtained, which is expressed as
Figure BDA00026009863400000410
Wherein each binary block sequence comprises 5 binary bits, an
Figure BDA00026009863400000411
Each binary packet sequence BF { i } is then formed, where
Figure BDA00026009863400000412
The following recombination operations were performed in sequence:
if mod (i,2) is 1, i.e. is an odd number of binary packet sequences BF { i }, the top of the binary packet sequences BF { i } is added with a binary '010', denoted as
Figure BDA0002600986340000051
If mod (i,2) ═ 0, that is, the even numbered binary packet sequence BF { i }, the first, between the 4 th bit and the 5 th bit, and the last of the binary packet sequence BF { i } are added with binary '0', '1', and '0' in sequence, and expressed as
Figure BDA0002600986340000052
And will reorganize the binary packet sequence
Figure BDA0002600986340000053
The order of the front element and the rear element is reversed,
finally, each recombined binary grouping sequence is sequentially divided into groups by utilizing a bin2dec (-) function
Figure BDA0002600986340000054
Conversion into numerical data
Figure BDA0002600986340000055
Wherein
Figure BDA0002600986340000056
Thereby obtaining a numerical sequence
Figure BDA0002600986340000057
(4) Transcoding: sequence of values
Figure BDA0002600986340000058
Each element of (a) converts the numeric data into an ASCLL code value e [32,126] using a char (·) function]Is a visible character, i.e.
Figure BDA0002600986340000059
Obtaining a character sequence C, namely the commodity anti-counterfeiting number, wherein the length of the character sequence C is
Figure BDA00026009863400000510
And the commodity identification code character string A and the commodity anti-counterfeiting number are directly connected in sequence, or directly connected in reverse order, or connected in alternate insertion order to be combined to generate a commodity anti-counterfeiting code, and finally a commodity anti-counterfeiting two-dimensional code is generated.
The invention is further illustrated by the following specific examples:
example 1
According to the method for generating the commodity anti-counterfeiting code based on the character string encryption, the steps are as follows:
(1) the method comprises the steps of converting a commodity identification code character string A which represents unique identity information of a certain commodity into numerical data one by one according to a production line xyz production number 0123456789' of corporation ABC # product 2020-01-01 in Jiangsu province, to obtain a numerical sequence P which is {189,173,203,213,202,161,42, 198,243,210,181,65,66,67,32,35, 178,250,198,183,32,50,48,50,48,45,48,49,45,48,49,32,201,250,178,250,207,223,120,121,122,201,250, 177,224,186,197,48,49,50,51,52,53,54,55,56,57}, converting the numerical sequence P into binary data of 8bits one by one, to obtain a binary sequence B which is {1,0,1,1,1,1,0,1,1,0,1,0,1, 0,1,0,1,0,0,0,0,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,1,1,0,1,1,0,0,1,0,1,1,1,1,1,0,1,0,1,1,0,0,0,1,1,0,1,0,1,1,0,1,1,1,0,0,1,0,0,0,0,0,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,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,1,1,1,1,1,1,0,1,0,1,0,1,1,0,0,1,0,1,1,1,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,1,0,1,1,1,1,0,1,0,1,1,0,0,1,0,0,1,1,1,1,1,1,0,1,0,1,0,1,1,0,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,0,0,0,1,1,1,1,0,0,0,0,0,1,0,1,1,1,0,1,0,1,1,0,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,1,1,0,0,1, 1,0,0,1,1,0,0,1,1, 1,0,1,0,0,0,0,1,1,0,1,0,1,0, 1,1,0,0,1,1,0,1, 1,0,0,0,1,1,0,0, 1}, wherein the length of the commodity identification code character string a is represented by LL-47, the length of the numerical sequence P is represented by L-61, and the binary sequence B contains 8 × 61-488 bits;
(2) first, using the binary sequence B, and the external keys α -0.12345 and β -3.75, the initial value x of the Logistic chaotic map is calculated according to the following formula1And an extraction start position m1And the number of decimation intervals n1Wherein the total number of '1' bits KB _1 in binary sequence B is 235, the total number of '0' bits KB _0 in binary sequence B is 253,
Figure BDA0002600986340000061
Figure BDA0002600986340000062
Figure BDA0002600986340000063
then, the initial value x mapped by chaos10.153293359266463 and the external key beta is 3.75, mapping to Logistic chaosRay xk+1=β×xk×(1-xk) Iteration is carried out to obtain a chaotic signal sequence X ═ X1,x2,., taking 1 element at 6 elements in sequence from the 398 th element in the sequence X to form a chaotic signal sequence X1 with the length of 8 × L-8 × 61-488,
finally, the chaotic signal sequence X1 is sorted in ascending order, and the binary sequence B is scrambled according to the position change scrambling rule before and after the chaotic signal sequence X1 is sorted to obtain the scrambled binary sequence
Figure BDA0002600986340000064
Figure BDA0002600986340000065
(3) Firstly, the scrambled binary sequence is aligned
Figure BDA0002600986340000066
Grouping the binary sequences
Figure BDA0002600986340000067
The middle elements are sequentially grouped by 5 elements in the forward direction from head to tail, 2 binary '0's are complemented at the tail of the last 1 group of elements, and a grouped binary sequence is obtained, wherein the binary sequence is represented by BF {1} - {1,0,0,1,1}, BF {2} - {1,1,0,0,0}, …, BF 49} - {0,1,1,1,1}, …, BF 97} - {0,0,1,0,0}, BF 98} - {0,0,1,0,0},
then, each binary packet sequence BF { i }, where i ═ 1,2, 3.
If mod (i,2) is 1, i.e. is an odd number of binary packet sequences BF { i }, the top of the binary packet sequences BF { i } is added with a binary '010', denoted as
Figure BDA0002600986340000068
If mod (i,2) is 0, i.e. the even numbered binary packet sequence BF { i }, the first, between the 4 th and 5 th bits, and the last binary packet sequence BF { i } is divided into twoThe surfaces are respectively added with 1 binary '0' which is expressed as
Figure BDA0002600986340000071
And will reorganize the binary packet sequence
Figure BDA0002600986340000072
Sequentially turning over the front element and the rear element;
thereby obtaining a recombined binary packet sequence represented as
Figure BDA0002600986340000073
Figure BDA0002600986340000074
Finally, each recombined binary grouping sequence is sequentially divided into groups by utilizing a bin2dec (-) function
Figure BDA0002600986340000075
Conversion into numerical data
Figure BDA0002600986340000076
Wherein i is 1,2, 3.., 98, thereby obtaining a sequence of values
Figure BDA0002600986340000077
Figure BDA0002600986340000078
(4) Sequence of values
Figure BDA0002600986340000079
Each element in the commodity is converted into a numerical value and a character to obtain a character sequence C, namely the commodity anti-counterfeiting number is S&T([8O(]xT>D0C~K6Ld@pOjA`]tF*G0P$F*B,^8NdG~\4KzOx[bVpO&DtH,Y>AfZ8A$_.J4O(YtG`G8U@2E]4E-I N8YxD (", and adopts the combination mode of directly connecting commodity identification code character string A with commodity anti-fake number in sequence (first kind), directly connecting in reverse order (second kind) or connecting in interval insertion order (third kind), and can produce commodity anti-fake codeThe following are respectively given,
the first kind: "Jiangsu province company ABC # # products 2020-01-01 production line xyz production number 0123456789S & T ([8O (] xT > D0C-K6 Ld @ pOjA '] tF G0P $ B, [8 NdG- \4KzOx [ bVpO & DtH, Y > AfZ8A _. J4O (YtG'. G8U @2E ] 4E-I X N8YxD (",
the second one: "(DxY 8N I-E4 ] E2@ U8G' GtY (O4J. __ A8ZfA > Y, HtD & OpVb [ xOzK4 _ -GdN 8^ B F $ P0G × Ft ]" AjOp @ dL 6K-C0D > Tx ] (O8[ (T & S9876543210 No. production zyx line production 10-10-0202 product # # CBA business enterprise province Sujiang,
the third kind: "Jiangssu & province T ([ enterprise 8 OA (B ] Cx T # > # D product 0C-2K 062L0D- @0p1O-J0A1 '] T production F line x Gy0zP production F number B0,1^283N4D5G 6-7 \849KzOx [ bVpO & DtH, Y > AfZ8A _ $ J4O (YtG' G8U @2E ] 4E-I N8YxD (",
and finally, sequentially generating the commodity anti-counterfeiting two-dimensional code according to the three combination modes, wherein the commodity anti-counterfeiting two-dimensional code is respectively shown in fig. 2, wherein (a) the graph is the commodity anti-counterfeiting two-dimensional code obtained by directly and sequentially connecting the commodity identification code character string A and the commodity anti-counterfeiting number, (b) the graph is the commodity anti-counterfeiting two-dimensional code obtained by directly and reversely connecting the commodity identification code character string A and the commodity anti-counterfeiting number, and (c) the graph is the commodity anti-counterfeiting two-dimensional code obtained by alternately and sequentially connecting the commodity identification code character string A and the commodity anti-counterfeiting number.
Example 2
According to the method for generating the commodity anti-counterfeiting code based on the character string encryption, the commodity identification code character string A of a certain commodity and the commodity anti-counterfeiting code generation steps are similar to those of the specific embodiment 1, and only a certain external secret key slightly changes: 0.12345000000001; or β 3.74999999999999, the generation of the commercial anti-counterfeiting code is shown in table 1. As can be seen from the following table: even if the external key slightly changes, the generated commodity anti-counterfeiting number and the commodity anti-counterfeiting code greatly change, so that the commodity anti-counterfeiting code generation method based on the character string encryption has key sensitivity.
TABLE 1 Generation result of merchandise anti-counterfeit code when external secret key is slightly changed
Figure BDA0002600986340000081
Example 3
According to the method for generating the commodity anti-counterfeiting code based on the string encryption, the steps for generating the external secret key and the commodity anti-counterfeiting code are similar to those in the specific embodiment 1, and only the commodity identification code string A of a certain commodity is slightly changed, namely 'Gongsu province x corporation ABC # # product 2020-01-01 production line xyz production number 0123456789'; or "production line xyz production number 0123456789" of corporation ABC # # 2020-01-11 in Jiangsu province; or "Jiangsu province such as corporation ABC # # products 2020-01-01 production line xyz production number 0123456788", the generation result of the commodity anti-counterfeiting code is shown in Table 2. As can be seen from the following table: once the commodity identification code character string representing the unique identification information of a certain commodity slightly changes, the generated commodity anti-counterfeiting number and the commodity anti-counterfeiting code can greatly change, so that the commodity anti-counterfeiting code generation method based on the character string encryption has sensitivity to the commodity identification information (namely the commodity identification code character string).
TABLE 2 Generation result of commodity anti-counterfeit code when commodity identification code is slightly changed
Figure BDA0002600986340000091
Figure BDA0002600986340000101
It can be seen from the above specific embodiments 2 and 3 that the anti-counterfeit code for commodities generated by the method for generating anti-counterfeit codes for commodities based on string encryption provided by the present patent is not only closely related to an external secret key, but also depends on a commodity identification code string representing unique identity information of a certain commodity, so that the method for generating anti-counterfeit codes for commodities based on string 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 anti-counterfeit codes for commodities have "uniqueness" and "non-forgeability".
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (4)

1. A commodity anti-counterfeiting code generation method based on character string encryption is characterized by comprising the following steps:
(1) transcoding: converting a commodity identification code character string A representing unique identity information of a certain commodity into numerical data one by one to obtain a numerical sequence P ═ { P ═ P1,P2,...,Pi,....,PLAnd converting the numerical value sequence P into binary data of 8bits one by one element to obtain a binary sequence B ═ B1,B2,...,Bi,....,B8×LThe commodity identification code character string A comprises Chinese punctuation marks in a GB2312 character set, double-byte coded Chinese characters in the GB2312 character set and ASCLL code values E [32,126]]The length of the commodity identification code character string A is represented as LL, the length of the numerical sequence P is represented as L, the binary sequence B contains 8 xL bits, and the LL is not less than L and not more than 2 xLL;
(2) scrambling of binary sequence B:
firstly, an initial value x of Logistic chaotic mapping is respectively calculated by using a binary sequence B and external keys alpha and beta according to the following formulas (1) to (3)1And an extraction start position m1And the number of decimation intervals n1
Figure FDA0003595063230000011
Figure FDA0003595063230000012
Figure FDA0003595063230000013
Wherein, in the binary sequence B, when B isiWhen the value is '1', 37 × i × Bi37 × i and
Figure FDA0003595063230000014
when B is presentiWhen the carbon-carbon composite material is equal to '0',
Figure FDA0003595063230000015
and 37 xixBiKB _1 denotes the sum of the number of '1' bits in the binary sequence B, KB _0 denotes the sum of the number of '0' bits in the binary sequence B, the external key satisfies α ∈ (0,1) and β ∈ (3.57,4),
then, the initial value x mapped by chaos1And an external key beta, iterating the Logistic chaotic mapping shown in the following formula (4), wherein k represents iteration times and xk+1Represents the chaotic signal obtained in the k-th iteration, k being 1, 2.,
xk+1=β×xk×(1-xk) (4)
obtaining a chaotic signal sequence X ═ X1,x2,.., m-th from sequence X1The elements start to be spaced by n1Taking 1 element as an element to form a chaotic signal sequence X1 with the length of 8 multiplied by L (X1)1,X12,...,X18×L},
Finally, the chaotic signal sequence X1 is sorted in ascending order, and the binary sequence B is set as { B ] according to the position change scrambling rule before and after the chaotic signal sequence X1 is sorted1,B2,...,Bi,....,B8×LScrambling to obtain a scrambled binary sequence
Figure FDA0003595063230000016
(3) Scrambled binary sequence
Figure FDA0003595063230000017
Grouping and recombining:
first, the scrambled binary sequence is aligned
Figure FDA0003595063230000018
Grouping the binary sequences
Figure FDA0003595063230000019
Sequentially and positively grouping the medium elements from head to tail by taking 5 elements as a unit, and if redundant elements are left, filling binary '0' at the tail until the group of 5 elements is filled to obtain a grouped binary sequence which is expressed as
Figure FDA0003595063230000021
Wherein each binary block sequence comprises 5 binary bits, an
Figure FDA0003595063230000022
Each binary packet sequence BF { i } is then formed, where
Figure FDA0003595063230000023
The following recombination operations were performed in sequence:
if mod (i,2) is 1, i.e. is an odd number of binary packet sequences BF { i }, the top of the binary packet sequences BF { i } is added with a binary '010', denoted as
Figure FDA0003595063230000024
If mod (i,2) is 0, i.e. the even numbered binary packet sequence BF { i }, the first, between the 4 th and 5 th bits, and the last binary packet sequence BF { i } is divided into twoThe surfaces are added with binary '0', '1' and '0' in sequence, and are expressed as
Figure FDA0003595063230000025
And will reorganize the binary packet sequence
Figure FDA0003595063230000026
The order of the front element and the rear element is reversed,
finally, each recombined binary grouping sequence is sequentially divided into groups by utilizing a bin2dec (-) function
Figure FDA0003595063230000027
Conversion into numerical data
Figure FDA0003595063230000028
Wherein
Figure FDA0003595063230000029
Thereby obtaining a numerical sequence
Figure FDA00035950632300000210
(4) Transcoding: sequence of values
Figure FDA00035950632300000211
Each element in the above-mentioned character sequence is converted into numerical value and character to obtain character sequence C, i.e. it is a commodity anti-false number, in which the length of the character sequence C is
Figure FDA00035950632300000212
And combining the commodity identification code character string A with the commodity anti-counterfeiting number to generate a commodity anti-counterfeiting code, and finally generating a commodity anti-counterfeiting two-dimensional code.
2. The commodity anti-counterfeiting code generation method based on the character string encryption as claimed in claim 1, wherein: the step (1) of converting the commodity identification code string 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 string a are converted into single numerical data by adopting a unicode2native () function to convert visible characters of which the ASCII code value belongs to [32,126], or converting Chinese punctuation marks and double-byte coded Chinese characters in a GB2312 character set into two numerical data, so as to obtain a numerical sequence P.
3. The method for generating the commodity anti-counterfeiting code based on the character string encryption as claimed in claim 1, wherein: the numerical sequence in step (4)
Figure FDA00035950632300000213
Each element in (1) is converted into a value and a character, namely, the value type data is converted into an ASCLL code value e [32,126] by using a char (·) function]Is a visible character, i.e.
Figure FDA00035950632300000214
Thereby obtaining the character sequence C.
4. The commodity anti-counterfeiting code generation method based on the character string encryption as claimed in claim 1, wherein: and (4) combining the commodity identification code character string A and the commodity anti-counterfeiting number to generate the commodity anti-counterfeiting code, wherein the commodity anti-counterfeiting code is generated by adopting a combination mode that the commodity identification code character string A and the commodity anti-counterfeiting number are directly connected in sequence, or directly connected in reverse order, or connected in spaced insertion order.
CN202010723902.3A 2020-07-24 2020-07-24 Commodity anti-counterfeiting code generation method based on character string encryption Active CN111985591B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010723902.3A CN111985591B (en) 2020-07-24 2020-07-24 Commodity anti-counterfeiting code generation method based on character string encryption

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010723902.3A CN111985591B (en) 2020-07-24 2020-07-24 Commodity anti-counterfeiting code generation method based on character string encryption

Publications (2)

Publication Number Publication Date
CN111985591A CN111985591A (en) 2020-11-24
CN111985591B true CN111985591B (en) 2022-06-21

Family

ID=73438156

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010723902.3A Active CN111985591B (en) 2020-07-24 2020-07-24 Commodity anti-counterfeiting code generation method based on character string encryption

Country Status (1)

Country Link
CN (1) CN111985591B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112561654A (en) * 2020-12-21 2021-03-26 杭州贝嘟科技有限公司 Commodity adding method and device, computer equipment and readable storage medium
CN112884105B (en) * 2021-03-25 2022-07-05 南通大学 Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption
CN113255860B (en) * 2021-03-26 2022-08-02 南通大学 Commodity anti-counterfeiting two-dimensional code generation method based on layered encryption
CN113052286A (en) * 2021-04-02 2021-06-29 南通大学 Commodity anti-counterfeiting two-dimensional code generation method based on scrambling encryption
CN113935343B (en) * 2021-10-12 2022-06-21 南通大学 Commodity anti-counterfeiting code generation method based on character string-to-picture encryption
CN114884646B (en) * 2022-03-24 2022-12-02 慧之安信息技术股份有限公司 System password storage method based on improved MD5 encryption processing

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103532701A (en) * 2013-10-16 2014-01-22 南通纺织职业技术学院 Encryption and decryption method for numeric type data
CN104657871A (en) * 2015-03-24 2015-05-27 南通大学 Generation method of commodity anti-counterfeiting code
CN107425956A (en) * 2017-07-27 2017-12-01 南通大学 A kind of character type commodity counterfeit prevention code generating method
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
CN109472338A (en) * 2018-11-19 2019-03-15 南通大学 A kind of Mass production method of commodity anti-counterfeit two-dimensional bar code
CN109995504A (en) * 2019-03-21 2019-07-09 南通大学 A kind of encryption and decryption approaches of character string

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8437471B2 (en) * 2010-08-04 2013-05-07 Lawrence P. Huang System for scrambling and methods for use therewith
WO2018153317A1 (en) * 2017-02-24 2018-08-30 陈伟 Chaotic map-based digital chaotic encryption method
CN109981245B (en) * 2019-03-21 2022-01-28 江苏工程职业技术学院 Encryption and decryption method for character string

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103532701A (en) * 2013-10-16 2014-01-22 南通纺织职业技术学院 Encryption and decryption method for numeric type data
CN104657871A (en) * 2015-03-24 2015-05-27 南通大学 Generation method of commodity anti-counterfeiting code
CN107425956A (en) * 2017-07-27 2017-12-01 南通大学 A kind of character type commodity counterfeit prevention code generating method
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
CN109472338A (en) * 2018-11-19 2019-03-15 南通大学 A kind of Mass production method of commodity anti-counterfeit two-dimensional bar code
CN109995504A (en) * 2019-03-21 2019-07-09 南通大学 A kind of encryption and decryption approaches of character string

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
A novel bit-level image encryption scheme using hyper-chaotic systems;Suying Sheng;《2013 10th International Conference on Fuzzy Systems and Knowledge Discovery (FSKD)》;20140519;全文 *
A novel chaos-based image encryption scheme using coupled map lattices;Xinhua Wu等;《2013 10th International Conference on Fuzzy Systems and Knowledge Discovery (FSKD)》;20140519;全文 *
基于混沌的数码防伪系统研究与实现;盛苏英等;《微电子学与计算机》;20110531;全文 *
基于耦合映象格子的混沌图像加密算法研究;盛苏英等;《微电子学与计算机》;20140131;全文 *

Also Published As

Publication number Publication date
CN111985591A (en) 2020-11-24

Similar Documents

Publication Publication Date Title
CN111985591B (en) Commodity anti-counterfeiting code generation method based on character string encryption
CN109284803B (en) Commodity anti-counterfeiting two-dimensional code generation method
CN109472338B (en) Batch generation method of commodity anti-counterfeiting two-dimensional codes
CN112001468B (en) Character type commodity anti-counterfeiting code generation and identification method
CN112001467B (en) Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption
CN112149774B (en) Chinese character commodity anti-counterfeiting code generation method
CN110011783B (en) Encryption and decryption method for Chinese characters
CN104680220A (en) Commodity anti-counterfeiting code batch generation method
CN112163230B (en) Commodity anti-counterfeiting code generation method based on Chinese character encryption
CN105354717B (en) A kind of colour commodity counterfeit prevention code generating method
CN112149773B (en) Commodity anti-counterfeiting code generation method based on Chinese character encryption
CN112884105B (en) Commodity anti-counterfeiting two-dimensional code generation method based on shift encryption
CN111382452A (en) Encryption method for converting Chinese characters into pictures
CN108418683A (en) A kind of carrier-free text steganography method based on feature of Chinese characters structure
CN104036531A (en) Information hiding method based on vector quantization and bintree
CN113255860B (en) Commodity anti-counterfeiting two-dimensional code generation method based on layered encryption
CN111382820A (en) Four-lattice pure-color commodity anti-counterfeiting code generation method
CN112217627B (en) Layered encrypted commodity anti-counterfeiting code generation method
RU2656734C2 (en) Method of digital information in the form of ultra-compressed nano bar code encoding and decoding (options)
CN105205777B (en) A kind of coding method of latent image password
Mariño et al. Channel coding in communications using chaos
CN109033853A (en) Physical layer information hidden method, device and terminal based on convolutional code
CN108830366A (en) A kind of generation method and system of anti-fake spiral coloured silk code
US6427920B1 (en) High frequency masking of embedded digital data to improve appearance
CN104573782A (en) One-dimensional code encoding and decoding method

Legal Events

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