CN112149774A - Chinese character commodity anti-counterfeiting code generation method - Google Patents
Chinese character commodity anti-counterfeiting code generation method Download PDFInfo
- Publication number
- CN112149774A CN112149774A CN202010972003.7A CN202010972003A CN112149774A CN 112149774 A CN112149774 A CN 112149774A CN 202010972003 A CN202010972003 A CN 202010972003A CN 112149774 A CN112149774 A CN 112149774A
- Authority
- CN
- China
- Prior art keywords
- sequence
- binary
- chinese character
- counterfeiting
- commodity
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 28
- 230000000739 chaotic effect Effects 0.000 claims abstract description 51
- 230000008859 change Effects 0.000 claims abstract description 11
- 238000000605 extraction Methods 0.000 claims abstract description 9
- 238000006243 chemical reaction Methods 0.000 claims abstract 4
- 102100020871 Forkhead box protein G1 Human genes 0.000 claims description 41
- 108010076504 Protein Sorting Signals Proteins 0.000 claims description 29
- 101710087964 Forkhead box protein G1 Proteins 0.000 claims description 18
- 238000005215 recombination Methods 0.000 claims description 4
- 230000006798 recombination Effects 0.000 claims description 4
- 238000013507 mapping Methods 0.000 claims description 3
- 239000000047 product Substances 0.000 abstract 4
- 239000013589 supplement Substances 0.000 abstract 1
- 238000004519 manufacturing process Methods 0.000 description 13
- 239000003245 coal Substances 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 6
- 241000238557 Decapoda Species 0.000 description 4
- 239000003610 charcoal Substances 0.000 description 4
- 230000008521 reorganization Effects 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 241000196252 Ulva Species 0.000 description 2
- 238000005219 brazing Methods 0.000 description 2
- 239000006071 cream Substances 0.000 description 2
- 239000003814 drug Substances 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000009182 swimming Effects 0.000 description 2
- 210000002303 tibia Anatomy 0.000 description 2
- LFQSCWFLJHTTHZ-UHFFFAOYSA-N Ethanol Chemical compound CCO LFQSCWFLJHTTHZ-UHFFFAOYSA-N 0.000 description 1
- 108091092195 Intron Proteins 0.000 description 1
- 235000003283 Pachira macrocarpa Nutrition 0.000 description 1
- 241000237503 Pectinidae Species 0.000 description 1
- 241000235070 Saccharomyces Species 0.000 description 1
- 241000239226 Scorpiones Species 0.000 description 1
- 240000001085 Trapa natans Species 0.000 description 1
- 235000014364 Trapa natans Nutrition 0.000 description 1
- 230000001476 alcoholic effect Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000001816 cooling Methods 0.000 description 1
- 239000002537 cosmetic Substances 0.000 description 1
- 239000003962 counterfeit drug Substances 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000001934 delay Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 201000010099 disease Diseases 0.000 description 1
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 1
- 238000005553 drilling Methods 0.000 description 1
- 229940079593 drug Drugs 0.000 description 1
- 238000009432 framing Methods 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 239000002304 perfume Substances 0.000 description 1
- 238000005096 rolling process Methods 0.000 description 1
- CVHZOJJKTDOEJC-UHFFFAOYSA-N saccharin Chemical compound C1=CC=C2C(=O)NS(=O)(=O)C2=C1 CVHZOJJKTDOEJC-UHFFFAOYSA-N 0.000 description 1
- 229940081974 saccharin Drugs 0.000 description 1
- 235000019204 saccharin Nutrition 0.000 description 1
- 239000000901 saccharin and its Na,K and Ca salt Substances 0.000 description 1
- 235000009165 saligot Nutrition 0.000 description 1
- 235000020637 scallop Nutrition 0.000 description 1
- 238000003307 slaughter Methods 0.000 description 1
- 238000009491 slugging Methods 0.000 description 1
- 230000007306 turnover Effects 0.000 description 1
- 238000009941 weaving Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K19/00—Record carriers for use with machines and with at least a part designed to carry digital markings
- G06K19/06—Record 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/06009—Record 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K19/00—Record carriers for use with machines and with at least a part designed to carry digital markings
- G06K19/06—Record 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/06009—Record 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/06046—Constructional details
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Commerce
- G06Q30/018—Certifying business or products
- G06Q30/0185—Product, service or business identity fraud
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/001—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using chaotic signals
Landscapes
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Entrepreneurship & Innovation (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Computer Security & Cryptography (AREA)
- Accounting & Taxation (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Finance (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Complex Calculations (AREA)
Abstract
本发明公开了一种汉字商品防伪码生成方法,包括如下步骤:将表征某件商品唯一身份信息的汉字商品标识码A,进行数值型数据和8bits二进制转换,以及二进制增补操作得到二进制序列
和计算得到混沌系统的初值和参数、抽取开始位置、抽取间隔数,混沌迭代得到混沌序列X1和X2,利用序列X1和X2的降序排序前、后的位置变化规则,分别对二进制序列和进行置乱,得到置乱后的二进制序列和分别将二进制序列和中元素正向以5个元素为单位进行分组,再将奇偶分组序列分别进行重组,从而生成商品防伪号,进而组合生成汉字商品防伪码。本发明所提汉字商品防伪码生成方法简单可行,具有很强的安全性、不易破解,生成的汉字商品防伪码具有“唯一性和不可伪造性”。The invention discloses a method for generating an anti-counterfeiting code for Chinese characters, comprising the following steps: converting a Chinese character product identification code A, which represents the unique identity information of a certain product, to numerical data and 8-bit binary conversion, and performing a binary supplement operation to obtain a binary sequence
and The initial value and parameters of the chaotic system, the starting position of extraction, and the number of extraction intervals are calculated, and the chaotic sequences X1 and X2 are obtained by chaotic iteration. Using the position change rules before and after the descending order of the sequences X1 and X2, the binary sequence and Scramble to get the scrambled binary sequence and separate binary sequences and The middle elements are grouped in units of 5 elements in the forward direction, and then the parity grouping sequences are recombined respectively, so as to generate the product anti-counterfeiting number, and then combine to generate the Chinese character product anti-counterfeiting code. The method for generating Chinese character commodity anti-counterfeiting codes provided by the invention is simple and feasible, has strong security, and is not easy to be deciphered, and the generated Chinese character commodity anti-counterfeiting codes have "uniqueness and unforgeability".Description
技术领域technical field
本发明涉及数码防伪技术领域,特别涉及一种汉字商品防伪码生成方法。The invention relates to the technical field of digital anti-counterfeiting, in particular to a method for generating anti-counterfeiting codes for Chinese characters.
背景技术Background technique
假冒伪劣产品屡见不鲜,需要我们切实地采取行动去维护厂家及消费者的权益。假冒产品对各行各业构成严重威胁,尤其是药品、农产品、汽车零部件、计算机软件以及昂贵的香水、化妆品、珠宝、手表和名牌服装等奢侈品。日内瓦国际商会估计,全球每年假冒产品的销售额达6,500亿美元。假冒药品和酒类产品尤其成问题,这不单单是造假,造假者做出的行为,严重危害了消费者的权益:药品的假冒使得病情延误甚至加重病情;假酒害人的事情更是屡见不鲜,这也沉重打击了商家的信誉,消费者的信心,对于经济社会秩序的良好建立危害极大。因而诞生了众多的防伪手段,例如:特别的包装,设计复杂的图标,提供小样等等。但这些手段常常因为缺乏技术,导致防伪性能不够,容易让造假者钻了空子。随着时代的进步,防伪技术有了很大的突破。例如芯片技术,生物技术等等,但由于其高成本,查询端限制颇多等特点,应用于众多领域的实际可操作性不大。数码防伪技术自上世纪90年代中期推向市场以来,其自身得到了空前的发展。Counterfeit and shoddy products are common, and we need to take practical actions to protect the rights and interests of manufacturers and consumers. Counterfeit products pose a serious threat to all walks of life, especially pharmaceuticals, agricultural products, auto parts, computer software, and luxury goods such as expensive perfumes, cosmetics, jewelry, watches, and designer clothing. The International Chamber of Commerce in Geneva estimates that global sales of counterfeit products amount to $650 billion annually. Counterfeit medicines and alcoholic products are particularly problematic. This is not just counterfeiting. The actions of counterfeiters have seriously endangered the rights and interests of consumers: counterfeiting of medicines delays or even aggravates the disease; it is not uncommon for counterfeit alcohol to harm people. , which has also severely damaged the reputation of businesses and the confidence of consumers, and is extremely harmful to the establishment of a good economic and social order. As a result, many anti-counterfeiting measures have been born, such as: special packaging, designing complex icons, providing samples and so on. However, these methods are often insufficient in anti-counterfeiting performance due to lack of technology, and it is easy for counterfeiters to take advantage of the loopholes. With the progress of the times, anti-counterfeiting technology has made great breakthroughs. For example, chip technology, biotechnology, etc., but due to its high cost and many restrictions on the query side, it is not practical to apply in many fields. Since the digital anti-counterfeiting technology was introduced to the market in the mid-1990s, it has developed unprecedentedly.
数码防伪由于其结合了防伪印刷和数字加密技术、使用权限的一次性、生成密码的随机性以及不可揣测性等特点,使商品防伪得到了空前的保障,同时可以多种方式查询产品的真假性,能有效抑制假冒伪劣产品的猖獗。同时混沌信号作为一种天然的密码,被引入到商品防伪码生成过程中,具有更高的安全性。在此情况下,利用混沌密码技术,提出一种汉字商品防伪码生成方法,以生成具有“唯一性和不可伪造性”的汉字商品防伪码,具有很好的实际应用推广价值。Due to its combination of anti-counterfeiting printing and digital encryption technology, one-time use authority, randomness and unpredictability of generated passwords, digital anti-counterfeiting has made the anti-counterfeiting of goods unprecedentedly guaranteed, and can check the authenticity of products in various ways. It can effectively restrain the rampant of counterfeit and shoddy products. At the same time, chaotic signal, as a natural password, is introduced into the process of generating anti-counterfeiting codes of commodities, which has higher security. Under this circumstance, using the chaotic cryptography technology, a method for generating anti-counterfeiting codes of Chinese characters is proposed to generate anti-counterfeiting codes of Chinese characters with "uniqueness and unforgeability", which has good practical application and promotion value.
发明内容SUMMARY OF THE INVENTION
发明目的:本发明的目的是为了解决现有技术中的不足,提供一种汉字商品防伪码生成方法,利用混沌映射产生混沌信号序列,对汉字商品标识码转换而成的2个二进制序列分别进行置乱,并将置乱后的二进制序列中元素进行分组,以及根据分组序列的奇偶个数分别进行不同的重组操作,从而生成商品防伪号,进而组合生成汉字商品防伪码,以此保证所提汉字商品防伪码生成方法简单可行,具有很强的安全性、不易破解,生成的汉字商品防伪码具有“唯一性和不可伪造性”。Purpose of the invention: The purpose of the present invention is to solve the deficiencies in the prior art, and to provide a method for generating anti-counterfeiting codes for Chinese products, which utilizes chaotic mapping to generate chaotic signal sequences, and carries out 2 binary sequences converted from the Chinese character product identification codes. Scramble, group the elements in the scrambled binary sequence, and perform different recombination operations according to the odd and even numbers of the grouping sequence, so as to generate the product anti-counterfeiting number, and then combine to generate the Chinese character product anti-counterfeiting code, so as to ensure the proposed The method for generating Chinese character commodity anti-counterfeiting codes is simple and feasible, has strong security, and is not easy to crack, and the generated Chinese character commodity anti-counterfeiting codes have "uniqueness and unforgeability".
技术方案:一种汉字商品防伪码生成方法,其特征在于,包括如下几个步骤:Technical solution: a method for generating anti-counterfeiting codes for Chinese characters, characterized in that it includes the following steps:
(1)转码(1) Transcoding
首先,将表征某件商品唯一身份信息的汉字商品标识码A,逐个汉字转换为数值型数据[Pi1,Pi2],得到高位数值序列P1={P11,P21,...,Pi1,....,PL1}和低位数值序列P2={P12,P22,...,Pi2,....,PL2},First, convert the Chinese character product identification code A, which represents the unique identity information of a certain product, into numerical data [P i1 , P i2 ] one by one, and obtain a high-order numerical sequence P1={P 11 , P 21 ,...,P i1 ,....,P L1 } and low-order value sequence P2={P 12 ,P 22 ,...,P i2 ,....,P L2 },
然后,将高位数值序列P1逐个元素转换成8bits的二进制数据,得到高位二进制序列PB1={PB11,PB12,...,PB1i,....,PB18×L},同时将低位数值序列P2逐个元素转换成8bits的二进制数据,得到低位二进制序列PB2={PB21,PB22,...,PB2i,....,PB28×L},Then, convert the high-order numerical sequence P1 into 8-bit binary data element by element, and obtain the high-order binary sequence PB1={PB1 1 ,PB1 2 ,...,PB1 i ,....,PB1 8×L }, and at the same time convert the low-order The numerical sequence P2 is converted into binary data of 8bits element by element, and the low-order binary sequence PB2={PB2 1 ,PB2 2 ,...,PB2 i ,....,PB2 8×L } is obtained,
最后,令LB=mod(5-mod(8×L,5),5),将高位二进制序列PB1的末尾添加LB个‘0’二进制位,将低位二进制序列PB2的末尾添加LB个‘1’二进制位,得到二进制序列 和二进制序列 Finally, let LB=mod(5-mod(8×L,5),5), add LB '0' binary bits to the end of the high-order binary sequence PB1, and add LB '1' bits to the end of the low-order binary sequence PB2 binary bit, get binary sequence and binary sequence
其中汉字商品标识码A包括GB2312字符集中的中文标点符号、GB2312字符集中双字节编码的汉字,汉字商品标识码A的长度表示为L,数值序列P1和P2的长度均为L,二进制序列PB1和PB2的长度均为8×L,二进制序列和的长度均为 The Chinese character product identification code A includes Chinese punctuation marks in the GB2312 character set and Chinese characters encoded in double-byte characters in the GB2312 character set. The length of the Chinese character product identification code A is expressed as L, the lengths of the numerical sequences P1 and P2 are both L, and the binary sequence PB1 and PB2 are both 8×L in length, a binary sequence and length of
(2)二进制序列和的置乱(2) Binary sequence and scramble
首先,利用高位数值序列P1和低位数值序列P2,以及外部密钥α和β,按照如下(1)-(5)公式分别计算得到Logistic混沌映射的初值x1和参数μ、抽取开始位置m,以及抽取间隔数n1、n2,First, using the high-order numerical sequence P1 and the low-order numerical sequence P2, as well as the external keys α and β, according to the following formulas (1)-(5), the initial value x 1 and parameter μ of the Logistic chaotic map, and the extraction start position m are calculated respectively. , and the number of decimation intervals n 1 , n 2 ,
令则make but
x1=0.00001+mod(α-kp1,0.99999) (1)x 1 =0.00001+mod(α-kp1,0.99999) (1)
μ=β+mod(kp1,4-β) (2)μ=β+mod(kp1,4-β) (2)
其中,外部密钥满足α∈(0,1),β∈(3.57,4),Among them, the external key satisfies α∈(0,1), β∈(3.57,4),
然后,由混沌映射的初值x1和外部密钥μ,对如下公式(6)所示Logistic混沌映射进行迭代,式中k表示迭代次数(k=1,2,...)、xk+1表示第k次迭代得到的混沌信号,Then, based on the initial value x 1 of the chaotic map and the external key μ, the Logistic chaotic map shown in the following formula (6) is iterated, where k represents the number of iterations (k=1, 2,...), x k +1 represents the chaotic signal obtained at the kth iteration,
xk+1=μ×xk×(1-xk) (6)x k+1 = μ×x k ×(1-x k ) (6)
得到混沌信号序列X={x1,x2,...},从序列X中第m个元素开始依次间隔n1个元素取1个元素以形成长度为的混沌信号序列同时从序列X中第m个元素开始依次间隔n2个元素取1个元素以形成长度为的混沌信号序列 The chaotic signal sequence X={x 1 , x 2 ,...} is obtained, starting from the mth element in the sequence X and taking 1 element at intervals of n 1 elements to form a length of chaotic signal sequence of At the same time, starting from the mth element in the sequence X, take 1 element at an interval of n 2 elements to form a length of chaotic signal sequence of
最后,将混沌信号序列X1按降序排序,根据混沌信号序列X1排序前、后的位置变化置乱规则,对二进制序列进行置乱,得到置乱后的二进制序列同时将混沌信号序列X2按降序排序,根据混沌信号序列X2排序前、后的位置变化置乱规则,对二进制序列进行置乱,得到置乱后的二进制序列 Finally, sort the chaotic signal sequence X1 in descending order, and scrambling the rules according to the position change before and after the sorting of the chaotic signal sequence X1. Scramble to get the scrambled binary sequence At the same time, sort the chaotic signal sequence X2 in descending order, and scrambling the rules according to the position change before and after the sorting of the chaotic signal sequence X2, and then the binary sequence Scramble to get the scrambled binary sequence
(3)置乱后二进制序列和的分组、重组(3) Scrambled binary sequence and grouping, reorganization
首先,将置乱后的二进制序列中元素从头到尾依次正向以5个元素为单位进行分组,得到分组后的二进制序列,表示为同时将置乱后的二进制序列中元素从头到尾依次正向以5个元素为单位进行分组,得到分组后的二进制序列,表示为其中每一个二进制分组序列BF1{i}和BF2{i}均包含5个二进制位,且 First, the scrambled binary sequence The elements in the middle are grouped in units of 5 elements from the beginning to the end, and the binary sequence after the grouping is obtained, which is expressed as At the same time, the scrambled binary sequence will be The elements in the middle are grouped in units of 5 elements from the beginning to the end, and the binary sequence after the grouping is obtained, which is expressed as where each binary block sequence BF1{i} and BF2{i} contains 5 binary bits, and
然后,将每一个二进制分组序列BF1{i}和BF2{i},其中依次进行如下重组操作:Then, each binary grouping sequence BF1{i} and BF2{i}, where Perform the following reorganization operations in sequence:
如果mod(i,2)=1,则将二进制分组序列BF1{i}的最前面添上二进制‘110’,表示为同时将二进制分组序列BF2{i}的最前面添上二进制‘101’,表示为 If mod(i,2)=1, then add binary '110' to the front of the binary block sequence BF1{i}, which is expressed as At the same time, add binary '101' to the front of the binary grouping sequence BF2{i}, which is expressed as
如果mod(i,2)=0,则先将二进制分组序列BF1{i}中元素前后顺序翻转再在其最前面添上二进制‘110’,得到重组后的二进制分组序列表示为同时先将二进制分组序列BF2{i}中元素前后顺序翻转再在其最前面添上二进制‘101’,得到重组后的二进制分组序列表示为 If mod(i, 2)=0, firstly reverse the order of the elements in the binary grouping sequence BF1{i}, and then add binary '110' to the front of the binary grouping sequence to obtain the reorganized binary grouping sequence Expressed as At the same time, the order of the elements in the binary grouping sequence BF2{i} is reversed, and the binary '101' is added to the front to obtain the reorganized binary grouping sequence. Expressed as
最后,利用bin2dec(·)函数,依次将每一个重组后的二进制分组序列转换成数值型数据同时依次将每一个重组后的二进制分组序列转换成数值型数据其中从而得到数值序列和 Finally, use the bin2dec( ) function to sequentially divide each recombined binary grouping sequence Convert to numeric data At the same time, each recombined binary grouping sequence is sequentially Convert to numeric data in to get the sequence of numbers and
(4)转码:将数值序列和对应元素依次组合并进行数值与汉字的转换,得到汉字序列C,即为商品防伪号,其中汉字序列C的长度为并将汉字商品标识码A和商品防伪号进行组合,生成汉字商品防伪码。(4) Transcoding: convert the sequence of values and Corresponding elements are combined in turn, and the numerical value and Chinese characters are converted, and the Chinese character sequence C is obtained, which is the product anti-counterfeiting number, and the length of the Chinese character sequence C is Combining the Chinese character product identification code A and the product anti-counterfeiting number to generate the Chinese character product anti-counterfeiting code.
进一步地,一种汉字商品防伪码生成方法里步骤(1)中所述的将表征某件商品唯一身份信息的汉字商品标识码A,逐个汉字转换为数值型数据[Pi1,Pi2],是指将汉字商品标识码A中逐个汉字采用unicode2native(·)函数转换为数值型数据,即[Pi1,Pi2]=unicode2native(Ai),从而得到高位数值序列P1={P11,P21,...,Pi1,....,PL1}和低位数值序列P2={P12,P22,...,Pi2,....,PL2}。Further, described in step (1) in a kind of Chinese character commodity anti-counterfeiting code generation method, will characterize the Chinese character commodity identification code A of the unique identity information of a certain commodity, one by one Chinese character is converted into numerical data [P i1 , P i2 ], It refers to converting each Chinese character in the Chinese character product identification code A into numerical data using the unicode2native(·) function, that is, [P i1 , P i2 ]=unicode2native(A i ), thereby obtaining a high-order numerical sequence P1={P 11 ,P 21 ,...,P i1 ,....,P L1 } and the lower order numerical sequence P2={P 12 ,P 22 ,...,P i2 ,....,P L2 }.
进一步地,一种汉字商品防伪码生成方法里步骤(4)中所述的将数值序列和对应元素依次组合并进行数值与汉字的转换,是指将数值序列和中每个对应元素进行组合,即并采用native2unicode(·)函数将数值型数据转换汉字,其中 Further, the numerical sequence described in step (4) in a method for generating Chinese character commodity anti-counterfeiting codes and Corresponding elements are combined in turn and converted between numerical values and Chinese characters, which refers to the sequence of numerical values. and Combining each corresponding element in And use the native2unicode(·) function to convert the numerical data into Chinese characters, in
进一步地,一种汉字商品防伪码生成方法里步骤(4)中所述的将汉字商品标识码A和商品防伪号进行组合,生成商品防伪码,是指采用汉字商品标识码A和商品防伪号直接顺序连接,或者直接逆序连接,或者间隔插序连接的组合方式。Further, the combination of the Chinese character commodity identification code A and the commodity anti-counterfeiting number described in the step (4) in a method for generating a Chinese character commodity anti-counterfeiting code to generate a commodity anti-counterfeiting code refers to adopting the Chinese character commodity identification code A and the commodity anti-counterfeiting number. Direct sequential connection, or direct reverse sequence connection, or a combination of intervening and intervening sequence connections.
有益效果:本发明利用混沌映射产生混沌信号序列,对汉字商品标识码转换而成的2个二进制序列分别进行置乱,并将置乱后的二进制序列中元素进行分组,以及根据分组序列的奇偶个数分别进行不同的重组操作,从而生成商品防伪号,进而组合生成汉字商品防伪码,以此保证所提汉字商品防伪码生成方法简单可行,具有很强的安全性、不易破解,生成的汉字商品防伪码具有“唯一性和不可伪造性”。Beneficial effects: the present invention utilizes chaotic mapping to generate chaotic signal sequences, scrambles the two binary sequences converted from the Chinese character commodity identification codes respectively, groups the elements in the scrambled binary sequences, and groups the elements according to the parity of the grouping sequence. Perform different recombination operations on the number of items to generate the product anti-counterfeiting number, and then combine to generate the Chinese character product anti-counterfeiting code, so as to ensure that the proposed Chinese character product anti-counterfeiting code generation method is simple and feasible, has strong security, and is not easy to crack. The generated Chinese characters Commodity security codes are "unique and unforgeable".
附图说明Description of drawings
图1为本发明的一种汉字商品防伪码生成流程示意图。FIG. 1 is a schematic diagram of the generation process of a Chinese character commodity anti-counterfeiting code according to the present invention.
具体实施方式Detailed ways
如图1所示的一种汉字商品防伪码生成方法,包括如下几个步骤:A method for generating anti-counterfeiting codes for Chinese characters as shown in Figure 1 includes the following steps:
(1)转码(1) Transcoding
首先,将表征某件商品唯一身份信息的汉字商品标识码A,逐个汉字转换为数值型数据[Pi1,Pi2],是指将汉字商品标识码A中逐个汉字采用unicode2native(·)函数转换为数值型数据,即[Pi1,Pi2]=unicode2native(Ai),得到高位数值序列P1={P11,P21,...,Pi1,....,PL1}和低位数值序列P2={P12,P22,...,Pi2,....,PL2}。First, the Chinese character product identification code A representing the unique identity information of a certain product is converted into numerical data [P i1 , P i2 ] one by one, which means that the Chinese character product identification code A is converted one by one using the unicode2native( ) function It is numerical data, ie [P i1 ,P i2 ]=unicode2native(A i ), and the high-order numerical sequence P1={P 11 ,P 21 ,...,P i1 ,....,P L1 } and the low-order numerical sequence are obtained Numerical sequence P2={P 12 ,P 22 ,...,P i2 ,....,P L2 }.
然后,将高位数值序列P1逐个元素转换成8bits的二进制数据,得到高位二进制序列PB1={PB11,PB12,...,PB1i,....,PB18×L},同时将低位数值序列P2逐个元素转换成8bits的二进制数据,得到低位二进制序列PB2={PB21,PB22,...,PB2i,....,PB28×L},Then, convert the high-order numerical sequence P1 into 8-bit binary data element by element, and obtain the high-order binary sequence PB1={PB1 1 ,PB1 2 ,...,PB1 i ,....,PB1 8×L }, and at the same time convert the low-order The numerical sequence P2 is converted into binary data of 8bits element by element, and the low-order binary sequence PB2={PB2 1 ,PB2 2 ,...,PB2 i ,....,PB2 8×L } is obtained,
最后,令LB=mod(5-mod(8×L,5),5),将高位二进制序列PB1的末尾添加LB个‘0’二进制位,将低位二进制序列PB2的末尾添加LB个‘1’二进制位,得到二进制序列 和二进制序列 Finally, let LB=mod(5-mod(8×L,5),5), add LB '0' binary bits to the end of the high-order binary sequence PB1, and add LB '1' bits to the end of the low-order binary sequence PB2 binary bit, get binary sequence and binary sequence
其中汉字商品标识码A包括GB2312字符集中的中文标点符号、GB2312字符集中双字节编码的汉字,汉字商品标识码A的长度表示为L,数值序列P1和P2的长度均为L,二进制序列PB1和PB2的长度均为8×L,二进制序列和的长度均为 The Chinese character product identification code A includes Chinese punctuation marks in the GB2312 character set and Chinese characters encoded in double-byte characters in the GB2312 character set. The length of the Chinese character product identification code A is expressed as L, the lengths of the numerical sequences P1 and P2 are both L, and the binary sequence PB1 and PB2 are both 8×L in length, a binary sequence and length of
(2)二进制序列和的置乱(2) Binary sequence and scramble
首先,利用高位数值序列P1和低位数值序列P2,以及外部密钥α和β,按照如下所示公式分别计算得到Logistic混沌映射的初值x1和参数μ、抽取开始位置m,以及抽取间隔数n1、n2,First, using the high-order numerical sequence P1 and the low-order numerical sequence P2, as well as the external keys α and β, the initial value x 1 and parameter μ of the Logistic chaotic map, the extraction start position m, and the number of extraction intervals are calculated according to the following formulas respectively. n 1 , n 2 ,
令 make
x1=0.00001+mod(α-kp1,0.99999) (1)x 1 =0.00001+mod(α-kp1,0.99999) (1)
μ=β+mod(kp1,4-β) (2)μ=β+mod(kp1,4-β) (2)
其中,外部密钥满足α∈(0,1),β∈(3.57,4),Among them, the external key satisfies α∈(0,1), β∈(3.57,4),
然后,由混沌映射的初值x1和外部密钥μ,对如下公式所示Logistic混沌映射进行迭代,式中k表示迭代次数(k=1,2,...)、xk+1表示第k次迭代得到的混沌信号,Then, based on the initial value x 1 of the chaotic map and the external key μ, the Logistic chaotic map shown in the following formula is iterated, where k represents the number of iterations (k=1, 2,...), and x k+1 represents The chaotic signal obtained at the kth iteration,
xk+1=μ×xk×(1-xk) (6)x k+1 = μ×x k ×(1-x k ) (6)
得到混沌信号序列X={x1,x2,...},从序列X中第m个元素开始依次间隔n1个元素取1个元素以形成长度为的混沌信号序列同时从序列X中第m个元素开始依次间隔n2个元素取1个元素以形成长度为的混沌信号序列 The chaotic signal sequence X={x 1 , x 2 ,...} is obtained, starting from the mth element in the sequence X and taking 1 element at intervals of n 1 elements to form a length of chaotic signal sequence of At the same time, starting from the mth element in the sequence X, take 1 element at an interval of n 2 elements to form a length of chaotic signal sequence of
最后,将混沌信号序列X1按降序排序,根据混沌信号序列X1排序前、后的位置变化置乱规则,对二进制序列进行置乱,得到置乱后的二进制序列同时将混沌信号序列X2按降序排序,根据混沌信号序列X2排序前、后的位置变化置乱规则,对二进制序列进行置乱,得到置乱后的二进制序列 Finally, sort the chaotic signal sequence X1 in descending order, and scrambling the rules according to the position change before and after the sorting of the chaotic signal sequence X1. Scramble to get the scrambled binary sequence At the same time, sort the chaotic signal sequence X2 in descending order, and scrambling the rules according to the position change before and after the sorting of the chaotic signal sequence X2, and then the binary sequence Scramble to get the scrambled binary sequence
(3)置乱后二进制序列和的分组、重组(3) Scrambled binary sequence and grouping, reorganization
首先,将置乱后的二进制序列中元素从头到尾依次正向以5个元素为单位进行分组,得到分组后的二进制序列,表示为同时将置乱后的二进制序列中元素从头到尾依次正向以5个元素为单位进行分组,得到分组后的二进制序列,表示为其中每一个二进制分组序列BF1{i}和BF2{i}均包含5个二进制位,且 First, the scrambled binary sequence The elements in the middle are grouped in units of 5 elements from the beginning to the end, and the binary sequence after the grouping is obtained, which is expressed as At the same time, the scrambled binary sequence will be The elements in the middle are grouped in units of 5 elements from the beginning to the end, and the binary sequence after the grouping is obtained, which is expressed as where each binary block sequence BF1{i} and BF2{i} contains 5 binary bits, and
然后,将每一个二进制分组序列BF1{i}和BF2{i},其中依次进行如下重组操作:Then, each binary grouping sequence BF1{i} and BF2{i}, where Perform the following reorganization operations in sequence:
如果mod(i,2)=1,则将二进制分组序列BF1{i}的最前面添上二进制‘110’,表示为同时将二进制分组序列BF2{i}的最前面添上二进制‘101’,表示为 If mod(i,2)=1, then add binary '110' to the front of the binary block sequence BF1{i}, which is expressed as At the same time, add binary '101' to the front of the binary grouping sequence BF2{i}, which is expressed as
如果mod(i,2)=0,则先将二进制分组序列BF1{i}中元素前后顺序翻转再在其最前面添上二进制‘110’,得到重组后的二进制分组序列表示为同时先将二进制分组序列BF2{i}中元素前后顺序翻转再在其最前面添上二进制‘101’,得到重组后的二进制分组序列表示为 If mod(i, 2)=0, firstly reverse the order of the elements in the binary grouping sequence BF1{i}, and then add binary '110' to the front of the binary grouping sequence to obtain the reorganized binary grouping sequence Expressed as At the same time, the order of the elements in the binary grouping sequence BF2{i} is reversed, and the binary '101' is added to the front to obtain the reorganized binary grouping sequence. Expressed as
最后,利用bin2dec(·)函数,依次将每一个重组后的二进制分组序列转换成数值型数据同时依次将每一个重组后的二进制分组序列转换成数值型数据其中从而得到数值序列和 Finally, use the bin2dec( ) function to sequentially divide each recombined binary grouping sequence Convert to numeric data At the same time, each recombined binary grouping sequence is sequentially Convert to numeric data in to get the sequence of numbers and
(4)转码:将数值序列和对应元素依次组合并采用native2unicode(·)函数将数值型数据转换汉字,即其中从而得到汉字序列C,即为商品防伪号,并将汉字商品标识码A和商品防伪号采用直接顺序连接,或者直接逆序连接,或者间隔插序连接的组合方式进行组合,生成汉字商品防伪码。(4) Transcoding: convert the sequence of values and Corresponding elements are combined in sequence And use the native2unicode( ) function to convert the numeric data into Chinese characters, that is in Thereby, the Chinese character sequence C is obtained, which is the product anti-counterfeiting number, and the Chinese character product identification code A and the product anti-counterfeiting number are combined in a direct sequence, or a direct reverse sequence connection, or a combination of interleaved sequence connections to generate a Chinese character product anti-counterfeiting code.
下面结合具体的实施例对本发明作进一步说明:Below in conjunction with specific embodiment, the present invention will be further described:
实施例1Example 1
按照上述一种汉字商品防伪码生成方法,步骤如下:According to the above-mentioned method for generating an anti-counterfeiting code for Chinese characters, the steps are as follows:
(1)首先,将表征某件商品唯一身份信息的汉字商品标识码A=“江苏省##集团××子公司 @@商品 生产日期2020-02-01 生产线12序列号1 2 3 4 5 6”,逐个汉字转换为数值型数据,得到高位数值序列P1={189,203,202,163,163,188,205,161,161,215,185,203,161,163,163,201,198,161,201,178,200,198,163,163,163,163,163,163,163,163,163,163,161,201,178,207,163,163,208,193,186,163,163,163,163,163,163}和低位数值序列P2={173,213,161,163,163,175,197,193,193,211,171,190,161,192,192,204,183,161,250,250,213,218,178,176,178,176,173,176,178,173,176,177,161,250,250,223,177,178,242,208,197,177,178,179,180,181,182}。(1) First of all, the Chinese character product identification code A that characterizes the unique identity information of a certain product = "Jiangsu Province ##GroupXX Subsidiary@@@Commodity Production Date 2020-02-01 Production Line 12 Serial Number 1 2 3 4 5 6 ”,逐个汉字转换为数值型数据,得到高位数值序列P1={189,203,202,163,163,188,205,161,161,215,185,203,161,163,163,201,198,161,201,178,200,198,163,163,163,163,163,163,163,163,163,163,161,201,178,207,163,163,208,193,186,163,163,163,163,163,163}和低位数值序列P2={173,213,161,163,163,175,197,193,193,211,171,190,161,192,192,204,183,161,250,250,213,218,178,176,178,176,173,176,178,173,176,177,161,250,250,223,177,178,242,208,197,177,178,179,180,181,182}。
然后,将高位数值序列P1逐个元素转换成8bits的二进制数据,得到高位二进制序列PB1={1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,1,1,1,0,0,1,0,1,0,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,1,1,1,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,0,1,1,1,0,0,1,0,1,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,1,0,0,1,0,0,1,1,1,0,0,0,1,1,0,1,0,1,0,0,0,0,1,1,1,0,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,1,1,0,0,0,1,1,0,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,0,1,1,1,0,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,1,0,1,0,0,0,0,1,1,0,0,0,0,0,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1},同时将低位数值序列P2逐个元素转换成8bits的二进制数据,得到低位二进制序列PB2={1,0,1,0,1,1,0,1,1,1,0,1,0,1,0,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,1,1,1,1,1,0,0,0,1,0,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,1,0,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,0,1,1,0,1,1,1,1,0,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,1,0,1,0,1,0,1,1,1,0,1,1,0,1,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,0,1,0,1,0,1,1,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,0,0,0,1,1,0,0,0,1,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,0},Then, convert the high-order numerical sequence P1 into 8-bit binary data element by element, and obtain the high-order binary sequence PB1={1,0,1,1,1,1,0,1,1,1,0,0,1,0 ,1,1,1,1,0,0,1,0,1,0,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1 ,1,1,0,1,1,1,1,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,0,1 ,1,0,1,0,0,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,0,1,1 ,1,0,0,1,0,1,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,1,1,1,0 ,1,0,0,0,1,1,1,1,0,0,1,0,0,1,1,1,0,0,0,1,1,0,1,0,1 ,0,0,0,0,1,1,1,0,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0 ,1,0,0,0,1,1,0,0,0,1,1,0,1,0,1,0,0,0,1,1,1,0,1,0,0 ,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0 ,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1 ,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,0,1 ,1,1,0,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,1,1,1 ,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,1,0,1,0,0,0,0,1,1 ,0,0,0,0,0,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,1,1,0,1 ,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0 ,0,0,1,1,1,0,1,0,0,0,1,1}, at the same time convert the low-order numerical sequence P2 into 8-bit binary data element by element, and obtain the low-order binary sequence PB2={1, 0,1,0,1,1,0,1,1,1,0,1,0,1,0,1,1,0,1,0,0,0,0,1,1,0, 1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,1,1,1,1,1,0, 0,0,1,0,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,1, 0,0,1, 1,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,0,0,0,0,1, 1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1, 0,1,1,0,1,1,1,1,0,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1, 1,1,1,0,1,0,1,1,0,1,0,1,0,1,1,1,0,1,1,0,1,0,1,0,1, 1,0,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,1, 0,0,0,0,1,0,1,0,1,1,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0, 0,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0, 0,1,1,0,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1, 0,1,1,0,1,1,1,1,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0, 1,1,1,1,0,0,1,0,1,1,0,1,0,0,0,0,1,1,0,0,0,1,0,1,1, 0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,1,1,1,0, 1,1,0,1,0,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,0},
最后,令LB=mod(5-mod(8×47,5),5)=4,将高位二进制序列PB1的末尾添加4个‘0’二进制位,将低位二进制序列PB2的末尾添加4个‘1’二进制位,得到二进制序列 和二进制序列 Finally, let LB=mod(5-mod(8×47,5),5)=4, add 4 '0' binary bits to the end of the high-order binary sequence PB1, and add 4'' to the end of the low-order binary sequence PB2 1' binary bit, get binary sequence and binary sequence
其中汉字商品标识码A的长度为L=47,数值序列P1和P2的长度均为L=47,二进制序列PB1和PB2的长度均为8×L=376,二进制序列和的长度均为 The length of the Chinese character product identification code A is L=47, the lengths of the numerical sequences P1 and P2 are both L=47, the lengths of the binary sequences PB1 and PB2 are both 8×L=376, the binary sequence and length of
(2)首先,利用数值序列P1和P2,以及外部密钥α=0.12345和β=3.75,按照如下公式分别计算得到Logistic混沌映射的初值x1和参数μ、抽取开始位置m,以及抽取间隔数n1、n2,(2) First, using the numerical sequences P1 and P2, and the external keys α=0.12345 and β=3.75, the initial value x 1 and parameter μ of the Logistic chaotic map, the extraction start position m, and the extraction interval are calculated according to the following formulas respectively. Numbers n 1 , n 2 ,
令则make but
x1=0.00001+mod(0.12345-0.172389696730833,0.99999)=0.951060303269167x 1 =0.00001+mod(0.12345-0.172389696730833,0.99999)=0.951060303269167
μ=3.75+mod(0.172389696730833,4-3.75)=3.922389696730833μ=3.75+mod(0.172389696730833,4-3.75)=3.922389696730833
然后,由混沌映射的初值x1=0.951060303269167和外部密钥μ=3.922389696730833,对Logistic混沌映射进行迭代,得到混沌信号序列X={x1,x2,...},从序列X中第334个元素开始依次间隔22个元素取1个元素以形成长度为380的混沌信号序列X1={X11,X12,...,X1380},同时从序列X中第334个元素开始依次间隔24个元素取1个元素以形成长度为380的混沌信号序列X2={X21,X22,...,X2380},Then, based on the initial value of the chaotic map x 1 =0.951060303269167 and the external key μ = 3.922389696730833, the Logistic chaotic map is iterated to obtain the chaotic signal sequence X={x 1 ,x 2 ,...}, Starting from 334 elements, take 1 element at an interval of 22 elements to form a chaotic signal sequence X1={X1 1 , X1 2 ,..., X1 380 } with a length of 380, and start from the 334th element in the sequence X in sequence Take 1 element every 24 elements to form a chaotic signal sequence with length 380 X2={X2 1 , X2 2 ,...,X2 380 },
最后,将混沌信号序列X1按降序排序,根据混沌信号序列X1排序前、后的位置变化置乱规则,对二进制序列进行置乱,得到置乱后的二进制序列 同时将混沌信号序列X2按降序排序,根据混沌信号序列X2排序前、后的位置变化置乱规则,对二进制序列 得到置乱后的二进制序列 Finally, sort the chaotic signal sequence X1 in descending order, and scrambling the rules according to the position change before and after the sorting of the chaotic signal sequence X1. Scramble to get the scrambled binary sequence At the same time, sort the chaotic signal sequence X2 in descending order, and scrambling the rules according to the position change before and after the sorting of the chaotic signal sequence X2, and then the binary sequence get the scrambled binary sequence
(3)首先,对置乱后的二进制序列和分别进行分组,将二进制序列中元素从头到尾依次正向以5个元素为单位进行分组,得到分组后的二进制序列,表示为BF1{1}={0,0,0,1,1},BF1{2}={1,1,0,0,0},…,BF1{38}={0,0,1,0,0},…,BF1{75}={0,0,1,1,1},BF1{76}={0,0,1,1,0},同时将二进制序列中元素从头到尾依次正向以5个元素为单位进行分组,得到分组后的二进制序列,表示为BF2{1}={1,1,0,1,0},BF2{2}={0,0,0,0,1},…,BF2{38}={0,1,0,1,1},…,BF2{75}={0,0,1,0,1},BF2{76}={0,0,0,1,1},(3) First, for the scrambled binary sequence and grouped separately, the binary sequence The elements in the middle are grouped in units of 5 elements from the beginning to the end, and the binary sequence after the grouping is obtained, which is expressed as BF1{1}={0,0,0,1,1}, BF1{2}={1 ,1,0,0,0},…,BF1{38}={0,0,1,0,0},…,BF1{75}={0,0,1,1,1},BF1{ 76}={0,0,1,1,0}, while converting the binary sequence The elements in the middle are grouped in units of 5 elements from the beginning to the end, and the binary sequence after the grouping is obtained, which is expressed as BF2{1}={1,1,0,1,0}, BF2{2}={0 ,0,0,0,1},…,BF2{38}={0,1,0,1,1},…,BF2{75}={0,0,1,0,1},BF2{ 76} = {0,0,0,1,1},
然后,将每一个二进制分组序列BF1{i}和BF2{i},其中依次进行重组操作,得到重组后的二进制分组序列,表示为 以及BF2{1}={1,0,1,1,1,0,1,0},BF2{2}={1,0,1,1,0,0,0,0},…,BF2{38}={1,0,1,1,1,0,1,0},…,BF2{75}={1,0,1,0,0,1,0,1},BF2{76}={1,0,1,1,1,0,0,0},Then, each binary grouping sequence BF1{i} and BF2{i}, where Perform the recombination operation in turn to obtain the recombined binary grouping sequence, which is expressed as and BF2{1}={1,0,1,1,1,0,1,0}, BF2{2}={1,0,1,1,0,0,0,0},…,BF2 {38}={1,0,1,1,1,0,1,0},...,BF2{75}={1,0,1,0,0,1,0,1},BF2{76 }={1,0,1,1,1,0,0,0},
最后利用bin2dec(·)函数,依次将每一个重组后的二进制分组序列转换成数值型数据同时依次将每一个重组后的二进制分组序列转换成数值型数据其中i=1,2,3,...,76,从而得到数值序列 和 Finally, use the bin2dec(·) function to sequentially combine each recombined binary grouping sequence Convert to numeric data At the same time, each recombined binary grouping sequence is sequentially Convert to numeric data where i = 1, 2, 3,..., 76, thus obtaining a numerical sequence and
(4)将数值序列和每个元素组合并进行数值与汉字的转换,得到汉字商品防伪号为“煤冒蟹揽券纬司啸联嘶桶貭甙纱霉伪嘶毯缀尉思驶薪辗转蟹薁指莼贫鄱炭庸袪亩卸煤暮玫吒劢罓爽锥诏援滩媒荬帧学透之蔂坍薪踊埽诂尾嘶泳赢斯胎荸峡片莺逘纬芯喂霜钎谈”,并将汉字商品标识码A和商品防伪号采用直接顺序连接,或者直接逆序连接,或者间隔插序连接的组合方式进行组合,生成汉字商品防伪码分别如下,(4) put the numerical sequence and Combining each element and converting the numerical value and Chinese characters, the anti-counterfeiting number of the Chinese character product is obtained as "Coal, crab, coupon, Wei Si Xiao Lian, sizzling, saccharin, gauze mold, pseudo-hiss blanket, Wei Si sailing, rolling, crab, scorpion, and poor po charcoal." Unloading coal in yongwamu, twilight, Meizha, shuangshuangzhuan, aided beach, mediator, frame, learn-through, slump, slump, dance, tail, swirl, win, tibia, gorge, piece, ying, weft, core, cream, brazing talk, and put Chinese character goods The identification code A and the commodity anti-counterfeiting number are combined in a direct sequence, or a direct reverse sequence connection, or a combination of spaced and interpolated sequence connections, and the generated Chinese character commodity security codes are as follows:
直接顺序连接:“江苏省##集团××子公司 @@商品 生产日期2020-02-01 生产线12序列号1 2 3 4 5 6煤冒蟹揽券纬司啸联嘶桶貭甙纱霉伪嘶毯缀尉思驶薪辗转蟹薁指莼贫鄱炭庸袪亩卸煤暮玫吒劢罓爽锥诏援滩媒荬帧学透之蔂坍薪踊埽诂尾嘶泳赢斯胎荸峡片莺逘纬芯喂霜钎谈”,Direct sequence connection: "Jiangsu Province ##Group XX Subsidiary@@@Commodity Production Date 2020-02-01 Production Line 12 Serial Number 1 2 3 4 5 6 Coal Crab Tickets Weixiaolian Hiss Barrel Saccharomyces Hissing blanket, Weisi, driving salary, turning crabs, pointing to Ulva, poor, charcoal, and unloading coal, twilight, Meizha, shuangshuang, jiu, aid, beach, matchmaking, frame, learning, slump, slump, slugging, tail, swimming, and winning the tidal gorge Pian Yingli Weft Core Feeding Frost and Drilling",
直接逆序连接:“谈钎霜喂芯纬逘莺片峡荸胎斯赢泳嘶尾诂埽踊薪坍蔂之透学帧荬媒滩援诏锥爽罓劢吒玫暮煤卸亩袪庸炭鄱贫莼指薁蟹转辗薪驶思尉缀毯嘶伪霉纱甙貭桶嘶联啸司纬券揽蟹冒煤6 5 4 3 2 1号列序21线产生 10-20-0202期日产生 品商@@司公子××团集##省苏江”,Direct reverse order connection: "Talking about brazing cream, feeding core, weaving, warping, kataya, water chestnut, winning, swimming, slaughtering, slumping, learning frame, media beach, aid, cone, cooling, coal, coal unloading, and charcoal Po poor Ulva finger crabs turn over the salary, Siwei carpet, pseudomycoside, cask sizzle, joint Xiao Siwei coupons, crabs and coals Commodities@@Company's subsidiary XX Group ##Sujiang Province",
间隔插序连接:“江煤苏冒省蟹#揽#券集纬团司×啸×联子嘶公桶司貭 甙@纱@霉商伪品嘶 毯生缀产尉日思期驶2薪0辗2转0蟹-薁0指2莼-贫0鄱1炭 庸生袪产亩线卸1煤2暮序玫列吒号劢1罓2爽3锥4诏5援6滩媒荬帧学透之蔂坍薪踊埽诂尾嘶泳赢斯胎荸峡片莺逘纬芯喂霜钎谈”,Interleaved sequence connection: "Jiangsu Coal, Jiangsu Province, Crab#Lan#Coupon Group Weft Group Company×Xiao×Lianzixi Company Barrel Company Siposide @ Yarn @ Mold Merchant Counterfeit Hiss Blanket Production Wet Risiqi Drive 2 Salary 0 rolls, 2 turns, 0 crabs, 0 fingers, 2 scallops, poor 0, 1, charcoal, yield, mu line, unloading, 1 coal, 2 twilight sequence, Meilie Zha, 1, 2, 3 cones, 4 edicts, 5 aids, 6 beach matchmaking, framing Through the slump, the salary, the squat, the tail, the swirl, and the win, the tibia, the gorge, the Yingli, the weft, the core, the frost and the drill",
实施例2Example 2
按照上述汉字商品防伪码生成方法,某件商品的商品标识码字符串A及其商品防伪码生成步骤与具体实施例1相似,仅某个外部密钥发生细微变化:α=0.12345000000001;或β=3.74999999999999,汉字商品防伪码的生成结果如表1所示。由下表可见:一旦外部密钥即使发生细微变化,生成的商品防伪号以及汉字商品防伪码会发生极大的变化,由此可见本专利所提一种汉字商品防伪码生成方法具有密钥敏感性。According to the above-mentioned method for generating anti-counterfeiting codes for Chinese characters, the steps for generating a commodity identification code string A of a certain commodity and its commodity anti-counterfeiting codes are similar to those in the specific embodiment 1, except that only a slight change occurs in a certain external key: α=0.12345000000001; or β= 3.74999999999999, the generation results of anti-counterfeiting codes for Chinese characters are shown in Table 1. It can be seen from the following table: once the external key changes slightly, the generated product anti-counterfeiting number and Chinese character product anti-counterfeiting code will change greatly. It can be seen that the method for generating a Chinese character product anti-counterfeiting code proposed in this patent is key sensitive. sex.
表1外部密钥发生微变时,汉字商品防伪码的生成结果Table 1 The generation results of anti-counterfeiting codes for Chinese characters when the external key changes slightly
实施例3Example 3
按照上述汉字商品防伪码生成方法,外部密钥及其商品防伪码生成步骤与具体实施例1相似,仅某件商品的商品标识码字符串A(江苏省##集团××子公司 @@商品 生产日期2020-02-01 生产线12序列号1 2 3 4 5 6)发生细微变化:“冮苏省##集团××子公司 @@商品 生产日期2020-02-01 生产线12序列号1 2 3 4 5 6”;或者“江苏省##集团××子公司 @@商品 生产日期2020-12-01 生产线12序列号1 2 3 4 5 6”;或者“江苏省##集团××子公司 @@商品 生产日期2020-02-01 生产线12序列号1 2 3 4 5 9”,汉字商品防伪码的生成结果如表2所示。由下表可见:一旦表征某件商品唯一身份信息的商品标识码字符串即使发生细微变化,生成的商品防伪号以及汉字商品防伪码会发生极大的变化,由此可见本专利所提一种汉字商品防伪码生成方法对商品身份信息(即商品标识码字符串)具有敏感性。According to the above-mentioned method for generating Chinese character commodity anti-counterfeiting codes, the steps for generating an external key and its commodity anti-counterfeiting codes are similar to those in the specific embodiment 1. Production date 2020-02-01 Production line 12 serial number 1 2 3 4 5 6) Minor changes: "冮Su Province ##Group XX Subsidiary @ @ @ Commodity production date 2020-02-01 Production line 12 serial number 1 2 3 4 5 6"; or "Jiangsu Province ##Group XX Subsidiary@@@Commodity Production Date 2020-12-01 Production Line 12 Serial Number 1 2 3 4 5 6"; or "Jiangsu Province ##Group XX Subsidiary @ @Product production date 2020-02-01 Production line 12 serial number 1 2 3 4 5 9", the generation results of Chinese character product security codes are shown in Table 2. It can be seen from the following table: once the product identification code string representing the unique identity information of a certain product changes slightly, the generated product anti-counterfeiting number and Chinese character product anti-counterfeiting code will undergo great changes. The method for generating Chinese character commodity anti-counterfeiting codes is sensitive to commodity identity information (ie, commodity identification code strings).
表2商品标识码发生微变时,商品防伪码的生成结果Table 2 When the product identification code changes slightly, the generation results of the product anti-counterfeiting code
由上述具体实施例2和例3分析可知,本专利所提一种汉字商品防伪码生成方法所生成汉字商品防伪码不仅与外部密钥密切相关,而且依赖于表征某件商品唯一身份信息的商品标识码字符串,因此本专利所提的一种汉字商品防伪码生成方法具有很强的安全性,可以较好地抵抗已知/选择明文攻击,不易破解,以保证生成的汉字商品防伪码具有“唯一性和不可伪造性”。From the analysis of the above-mentioned specific embodiment 2 and example 3, it can be seen that the Chinese character commodity anti-counterfeiting code generated by the Chinese character commodity anti-counterfeiting code generation method proposed in this patent is not only closely related to the external key, but also depends on the commodity representing the unique identity information of a certain commodity. Therefore, the method for generating an anti-counterfeiting code for Chinese characters proposed in this patent has strong security, can better resist known/selected plaintext attacks, and is not easy to crack, so as to ensure that the generated anti-counterfeiting code for Chinese characters has "Uniqueness and Unforgeability".
以上所述,仅是本发明的较佳实施例而已,并非对本发明作任何形式上的限制,虽然本发明已以较佳实施例揭露如上,然而并非用以限定本发明,任何熟悉本专业的技术人员,在不脱离本发明技术方案范围内,当可利用上述揭示的技术内容作出些许更动或修饰为等同变化的等效实施例,但凡是未脱离本发明技术方案的内容,依据本发明的技术实质对以上实施例所作的任何简单修改、等同变化与修饰,均仍属于本发明技术方案的范围内。The above are only preferred embodiments of the present invention, and do not limit the present invention in any form. Although the present invention has been disclosed above with preferred embodiments, it is not intended to limit the present invention. Technical personnel, within the scope of the technical solution of the present invention, can make some changes or modifications to equivalent embodiments of equivalent changes by using the technical content disclosed above, but any content that does not depart from the technical solution of the present invention, according to the present invention Any simple modifications, equivalent changes and modifications made to the above embodiments still fall within the scope of the technical solutions of the present invention.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010972003.7A CN112149774B (en) | 2020-09-16 | 2020-09-16 | Chinese character commodity anti-counterfeiting code generation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010972003.7A CN112149774B (en) | 2020-09-16 | 2020-09-16 | Chinese character commodity anti-counterfeiting code generation method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112149774A true CN112149774A (en) | 2020-12-29 |
CN112149774B CN112149774B (en) | 2021-11-30 |
Family
ID=73892896
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010972003.7A Active CN112149774B (en) | 2020-09-16 | 2020-09-16 | Chinese character commodity anti-counterfeiting code generation method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112149774B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112884104A (en) * | 2021-03-24 | 2021-06-01 | 南通大学 | Commodity anti-counterfeiting two-dimensional code generation method based on chaotic encryption |
CN113255860A (en) * | 2021-03-26 | 2021-08-13 | 南通大学 | Commodity anti-counterfeiting two-dimensional code generation method based on layered encryption |
CN113343639A (en) * | 2021-05-19 | 2021-09-03 | 网易(杭州)网络有限公司 | Product identification code image generation and information query method based on product identification code image |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104680220A (en) * | 2015-03-24 | 2015-06-03 | 南通大学 | Commodity anti-counterfeiting code batch generation method |
CN105354717A (en) * | 2015-11-30 | 2016-02-24 | 南通大学 | Colorful commodity anti-counterfeiting code generating method |
CN107425956A (en) * | 2017-07-27 | 2017-12-01 | 南通大学 | A kind of character type commodity counterfeit prevention code generating method |
CN111382820A (en) * | 2020-02-25 | 2020-07-07 | 南通大学 | Four-lattice pure-color commodity anti-counterfeiting code generation method |
-
2020
- 2020-09-16 CN CN202010972003.7A patent/CN112149774B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104680220A (en) * | 2015-03-24 | 2015-06-03 | 南通大学 | Commodity anti-counterfeiting code batch generation method |
CN105354717A (en) * | 2015-11-30 | 2016-02-24 | 南通大学 | Colorful commodity anti-counterfeiting code generating method |
CN107425956A (en) * | 2017-07-27 | 2017-12-01 | 南通大学 | A kind of character type commodity counterfeit prevention code generating method |
CN111382820A (en) * | 2020-02-25 | 2020-07-07 | 南通大学 | Four-lattice pure-color commodity anti-counterfeiting code generation method |
Non-Patent Citations (3)
Title |
---|
吴新华: "基于混沌密码的数码防伪追溯系统设计", 《计算机与数字工程》 * |
盛苏英等: "基于混沌的数码防伪系统研究与实现", 《微电子学与计算机》 * |
盛苏英等: "混沌密码技术在数码防伪中的应用研究", 《信息技术》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112884104A (en) * | 2021-03-24 | 2021-06-01 | 南通大学 | Commodity anti-counterfeiting two-dimensional code generation method based on chaotic encryption |
CN112884104B (en) * | 2021-03-24 | 2022-07-05 | 南通大学 | A method for generating anti-counterfeiting two-dimensional code based on chaos encryption |
CN113255860A (en) * | 2021-03-26 | 2021-08-13 | 南通大学 | Commodity anti-counterfeiting two-dimensional code generation method based on layered encryption |
CN113255860B (en) * | 2021-03-26 | 2022-08-02 | 南通大学 | A product anti-counterfeiting two-dimensional code generation method based on layered encryption |
CN113343639A (en) * | 2021-05-19 | 2021-09-03 | 网易(杭州)网络有限公司 | Product identification code image generation and information query method based on product identification code image |
CN113343639B (en) * | 2021-05-19 | 2023-10-03 | 网易(杭州)网络有限公司 | Product identification code diagram generation and information query method based on product identification code diagram |
Also Published As
Publication number | Publication date |
---|---|
CN112149774B (en) | 2021-11-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109472338B (en) | Batch generation method of commodity anti-counterfeiting two-dimensional codes | |
CN112149774A (en) | Chinese character commodity anti-counterfeiting code generation method | |
CN109284803B (en) | Commodity anti-counterfeiting two-dimensional code generation method | |
CN112001468B (en) | A method for generating and recognizing anti-counterfeiting codes for character-type commodities | |
CN107425956B (en) | A method for generating anti-counterfeiting codes for character-type commodities | |
CN104486073B (en) | A kind of encryption and decryption method of character type data | |
CN111985591B (en) | A method for generating commodity anti-counterfeiting code based on string encryption | |
CN107609356B (en) | Text carrier-free information hiding method based on label model | |
CN112884104B (en) | A method for generating anti-counterfeiting two-dimensional code based on chaos encryption | |
CN112149773B (en) | Commodity anti-counterfeiting code generation method based on Chinese character encryption | |
CN104680220B (en) | A kind of commodity counterfeit prevention code Mass production method | |
CN104657871B (en) | A kind of commodity counterfeit prevention code generating method | |
CN112163230B (en) | A method for generating anti-counterfeiting code of goods with Chinese character encryption | |
CN105354717B (en) | A method for generating anti-counterfeiting codes for color commodities | |
CN113255860B (en) | A product anti-counterfeiting two-dimensional code generation method based on layered encryption | |
CN108009253A (en) | A kind of improved character string Similar contrasts method | |
CN102752108B (en) | Magic cube encryption and decryption method | |
CN112001467A (en) | Commodity anti-counterfeiting code generation and identification method based on picture encryption and decryption | |
CN112016061A (en) | A Data Protection Method for Excel Documents Based on Robust Watermarking Technology | |
CN111353166A (en) | An encryption method for converting pictures to Chinese characters | |
CN112217627B (en) | Layered encrypted commodity anti-counterfeiting code generation method | |
CN104376236B (en) | Scheme self-adaptive digital watermark embedding grammar and extracting method based on camouflage science | |
CN102509058B (en) | Point type GIS vector data disguise and recovery method based on redundant bit replacement | |
CN111447188A (en) | Carrier-free text steganography method based on language steganography feature space | |
CN116582314A (en) | Optimal hidden double-protection text 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 |