CN112183697B - A method for batch generation of two-dimensional codes for garbage classification - Google Patents
A method for batch generation of two-dimensional codes for garbage classification Download PDFInfo
- Publication number
- CN112183697B CN112183697B CN202011038759.0A CN202011038759A CN112183697B CN 112183697 B CN112183697 B CN 112183697B CN 202011038759 A CN202011038759 A CN 202011038759A CN 112183697 B CN112183697 B CN 112183697B
- Authority
- CN
- China
- Prior art keywords
- sequence
- garbage
- code
- binary
- batch
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 230000000739 chaotic effect Effects 0.000 claims abstract description 147
- 108010076504 Protein Sorting Signals Proteins 0.000 claims abstract description 116
- 239000011159 matrix material Substances 0.000 claims abstract description 15
- 238000006243 chemical reaction Methods 0.000 claims abstract description 4
- 102100020871 Forkhead box protein G1 Human genes 0.000 claims description 41
- 101710087964 Forkhead box protein G1 Proteins 0.000 claims description 20
- 230000001174 ascending effect Effects 0.000 claims description 14
- 238000005215 recombination Methods 0.000 claims description 9
- 230000006798 recombination Effects 0.000 claims description 9
- 238000009792 diffusion process Methods 0.000 claims description 7
- 239000000284 extract Substances 0.000 claims description 7
- 238000000605 extraction Methods 0.000 claims description 6
- 238000004519 manufacturing process Methods 0.000 claims description 6
- 238000013507 mapping Methods 0.000 abstract description 7
- 239000002699 waste material Substances 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 239000010791 domestic waste Substances 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000004064 recycling Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 206010017577 Gait disturbance Diseases 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000009472 formulation Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000011160 research 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
- G06K19/06037—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 multi-dimensional coding
-
- 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)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本发明涉及垃圾分类技术领域,特别涉及一种垃圾分类二维码批量生成方法。The invention relates to the technical field of garbage classification, in particular to a method for batch generation of two-dimensional codes for garbage classification.
背景技术Background technique
随着科技和经济社会的高速发展、城市化进程的进一步推进,目前我国城市生活垃圾年产量过亿吨,许多城市正面临“垃圾围城”的严峻形势。“垃圾围城”已成为中国城市发展的绊脚石。破解“垃圾围城”的难题,首先是从源头上减少城市生活垃圾的产生,其次,将垃圾资源化处理也是一个必不可少的关键环节,因此推行垃圾分类迫在眉睫。早在1992年,我国宜昌市首次提出了推行“垃圾装袋分类”,并首次提出了制定专项立法来管理城市生活垃圾分类。随后垃圾分类逐渐在全国范围内开展开来,自上世纪九十年代垃圾分类推行以来,我国城市垃圾分类的理论研究已取得了明显的成效,由于目前城市居民缺乏垃圾分类知识、环境保护意识不足、活动参与热情不高。此外,垃圾回收站的基础设施过于简陋、垃圾回收运输过程太过粗放、居民对于垃圾袋个人隐私信息暴露的担忧而消极甚至不愿参与等种种问题逐渐显露,显然,我国城市垃圾分类的实施正面临着许多困难和挑战。针对上述问题,当务之急是研发一种安全可靠的垃圾分类码生成方法,从源头上保障生成具有“唯一性、安全性和垃圾分类引导性”垃圾分类码,促进垃圾分类工作的有效开展。With the rapid development of science and technology, economy and society, and the further advancement of the urbanization process, the current annual output of urban domestic waste in my country exceeds 100 million tons, and many cities are facing the severe situation of "garbage siege". The "garbage besieged city" has become a stumbling block for China's urban development. To solve the problem of "garbage siege", the first is to reduce the generation of urban domestic waste from the source, and secondly, the recycling of waste is also an indispensable key link, so the implementation of waste classification is imminent. As early as 1992, Yichang City in my country first proposed the implementation of "garbage bag classification", and for the first time proposed the formulation of special legislation to manage the classification of urban domestic waste. Subsequently, garbage classification was gradually carried out nationwide. Since the implementation of garbage classification in the 1990s, the theoretical research on urban garbage classification in my country has achieved obvious results. Due to the lack of knowledge of garbage classification and insufficient awareness of environmental protection among urban residents. , The enthusiasm for participating in activities is not high. In addition, the infrastructure of the garbage recycling station is too simple, the garbage recycling and transportation process is too extensive, and the residents are worried about the exposure of personal privacy information of garbage bags and are passive or even unwilling to participate. Obviously, the implementation of urban garbage classification in my country is positive. Faced with many difficulties and challenges. In view of the above problems, the most urgent task is to develop a safe and reliable method for generating garbage classification codes, which can ensure the generation of garbage classification codes with "uniqueness, security and guidance of garbage classification" from the source, and promote the effective development of garbage classification work.
发明内容SUMMARY OF THE INVENTION
发明目的:本发明的目的是为了解决现有技术中的不足,提供一种垃圾分类二维码批量生成方法,从某批垃圾袋的统一身份码中抽取出身份标识码和身份隐藏码,依赖身份标识码和隐藏码并利用混沌映射产生混沌信号序列,对身份隐藏码转换并组合而成的高、低位二进制序列分别进行置乱、分组及扩散,完成某批垃圾袋的身份隐藏码统一加密,依赖单件垃圾袋的批量身份码并利用混沌映射产生混沌信号序列,并根据垃圾类别对身份隐藏码统一加密结果分别进行不同规则的置乱,进而批量生成垃圾分类二维码。本发明所提垃圾分类二维码批量生成方法简单可行,具有很强的安全性,生成的垃圾分类码具有“唯一性、安全性和垃圾分类引导性”。Purpose of the invention: The purpose of the present invention is to solve the deficiencies in the prior art, and provide a method for batch generation of two-dimensional codes for garbage classification, which extracts the identity identification code and the identity hidden code from the unified identity code of a certain batch of garbage bags, and relies on The identity identification code and hidden code are used to generate chaotic signal sequence by chaotic mapping, and the high and low binary sequences converted and combined by the identity hidden code are scrambled, grouped and diffused respectively, and the unified encryption of the identity hidden code of a certain batch of garbage bags is completed. , relying on the batch identity code of a single garbage bag and using chaotic mapping to generate a chaotic signal sequence, and scrambling the unified encryption result of the identity hidden code according to the garbage category with different rules, and then generating garbage classification QR codes in batches. The method for batch generation of garbage classification two-dimensional codes provided by the present invention is simple and feasible, and has strong security, and the generated garbage classification codes have "uniqueness, security and guidance of garbage classification".
技术方案:一种垃圾分类二维码批量生成方法,其特征在于,包括如下几个步骤:Technical solution: a method for batch generation of two-dimensional codes for garbage classification, characterized in that it includes the following steps:
(1)编码、转码(1) Encoding and transcoding
首先,将某批垃圾袋的身份信息进行编码,包括某批垃圾袋的统一身份码、单件垃圾袋的批量身份码两部分,从而生成某批单件垃圾袋唯一的中英文字符型垃圾袋身份码,表示为M1M2...MkMk+1Mk+2...Mk+LMk+L+1Mk+L+2...Mk+L+pMk+L+p+1Mk+L+p+2...Mk+L+p+nMk+L+p+n+1Mk+L+p+n+ 2Mk+L+p+n+3Mk+L+p+n+4,其中M1M2...Mk为省市区,Mk+1Mk+2...Mk+L为具体居住地址,Mk+L+1Mk+L+ 2...Mk+L+p为联系人和联系电话,Mk+L+p+1Mk+L+p+2...Mk+L+p+n为制码时间(格式为年-月-日,其中最后两位Mk+L+p+n-1Mk+L+p+n为日期),Mk+L+p+n+1Mk+L+p+n+2为垃圾分类颜色信息(表征垃圾类别),Mk+L+p+n+3Mk+L+p+n+4为垃圾分类序号信息(表征某天某种类别垃圾袋的序号),相互用英文空格间隔,相应某批垃圾袋的统一身份码为M1M2...MkMk+1Mk+2...Mk+LMk+L+1Mk+L+2...Mk+L+pMk+L+p+ 1Mk+L+p+2...Mk+L+p+n-3Mk+L+p+n-2,相应单件垃圾袋的批量身份码为Mk+L+p+n-1Mk+L+p+nMk+L+p+n+ 1Mk+L+p+n+2Mk+L+p+n+3Mk+L+p+n+4,First, encode the identity information of a batch of garbage bags, including the unified identity code of a batch of garbage bags and the batch identity code of a single garbage bag, so as to generate a garbage bag with Chinese and English characters that is unique to a single garbage bag. Identity code, expressed as M 1 M 2 ... M k M k+1 M k+2 ... M k+L M k+L+1 M k+L+2 ... M k+L+p M k+L+p+1 M k+L+p+2 ...M k+L+p+n M k+L+p+n+1 M k+L+p+n+ 2 M k+L +p+n+3 M k+L+p+n+4 , where M 1 M 2 ... M k are provinces and municipalities, and M k+1 M k+2 ... M k+L are specific residences Address, M k+L+1 M k+L+ 2 ... M k+L+p is the contact person and contact number, M k+L+p+1 M k+L+p+2 ... M k +L+p+n is the code time (the format is year-month-day, where the last two digits M k+L+p+n-1 M k+L+p+n is the date), M k+L+ p+n+1 M k+L+p+n+2 is the garbage classification color information (representing the garbage category), M k+L+p+n+3 M k+L+p+n+4 is the garbage classification serial number Information (representing the serial number of a certain type of garbage bags on a certain day), separated by English spaces, and the unified identity code of a corresponding batch of garbage bags is M 1 M 2 ... M k M k+1 M k+2 ... M k+L M k+L+1 M k+L+2 ...M k+L+p M k+L+p+ 1 M k+L+p+2 ...M k+L+p+ n-3 M k+L+p+n-2 , the batch ID code of the corresponding single garbage bag is M k+L+p+n-1 M k+L+p+n M k+L+p+n+ 1 M k+L+p+n+2 M k+L+p+n+3 M k+L+p+n+4 ,
然后,从某批垃圾袋的统一身份码中抽取出身份标识码(M1M2...MkMk+L+p+ 1Mk+L+p+2...Mk+L+p+n-2)和身份隐藏码(Mk+1Mk+2...Mk+LMk+L+1Mk+L+2...Mk+L+p),并将身份标识码逐个字符转换成数值型数据,得到对应的数值序列同时将身份隐藏码逐个字符转换成数值型数据[Pi1,Pi2],得到高位数值序列P1={P11,P12,…,P1L+p,P1L+p+1}={P11,P21,…,P(L+p)1,P(L+p+1)1}和低位数值序列P2={P21,P22,…,P2L+p,P2L+p+1}={P12,P22,…,P(L+p)2,P(L+p+1)2},Then, the identification code (M 1 M 2 ... M k M k+L+p+ 1 M k+L+p+2 ... M k+L+ p+n-2 ) and identity concealment codes (M k+1 M k+2 ... M k+L M k+L+1 M k+L+2 ... M k+L+p ), and Convert the identification code into numerical data character by character to obtain the corresponding numerical sequence At the same time, the identity hidden code is converted into numerical data [P i1 ,P i2 ] character by character, and the high-order numerical sequence P1={P1 1 ,P1 2 ,...,P1 L+p ,P1 L+p+1 }={P 11 ,P 21 ,…,P (L+p)1 ,P (L+p+1)1 } and the low-order numerical sequence P2={P2 1 ,P2 2 ,…,P2 L+p ,P2 L+p+ 1 }={P 12 ,P 22 ,...,P (L+p)2 ,P (L+p+1)2 },
最后,依次将数值序列S中元素Si逐个转换成8bits的二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8}、将数值序列P1中元素P1i逐个转换成8bits的二进制序列{BP1i1,BP1i2,BP1i3,BP1i4,BP1i5,BP1i6,BP1i7,BP1i8}、将数值序列P2中元素P2i逐个转换成8bits的二进制序列{BP2i1,BP2i2,BP2i3,BP2i4,BP2i5,BP2i6,BP2i7,BP2i8},Finally, convert the elements Si in the numerical sequence S into 8- bit binary sequences {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS i8 } one by one, and convert the elements in the numerical sequence P1 into Convert P1 i into a binary sequence of 8 bits one by one {BP1 i1 , BP1 i2 , BP1 i3 , BP1 i4 , BP1 i5 , BP1 i6 , BP1 i7 , BP1 i8 }, convert the elements P2 i in the numerical sequence P2 into a binary sequence of 8 bits one by one {BP2 i1 , BP2 i2 , BP2 i3 , BP2 i4 , BP2 i5 , BP2 i6 , BP2 i7 , BP2 i8 },
并将个二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8}进行组合,其中从而得到组合二进制矩阵B,and will Binary sequences {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS i8 } are combined, where Thus, the combined binary matrix B is obtained,
同时将L+p+1个二进制序列{BP1i1,BP1i2,BP1i3,BP1i4,BP1i5,BP1i6,BP1i7,BP1i8}进行组合,其中i=1,2,...,L+p,L+p+1,从而得到高位组合二进制序列B1={B11,B12,...,B18L+8p+7,B18L+8p+8}={BP11 1,BP11 2,BP113,BP114,BP115,BP116,BP117,BP118,BP121,BP122,...,BP127,BP128,...,BP1i1,BP1i2,...,BP1i7,BP1i8,...,BP1L+p+11,BP1L+p+12,BP1L+p+13,BP1L+p+14,BP1L+p+15,BP1L+p+1 6,BP1L+p+1 7,BP1L+p+18},并将L+p+1个二进制序列{BP2i1,BP2i2,BP2i3,BP2i4,BP2i5,BP2i6,BP2i7,BP2i8}进行组合,其中i=1,2,...,L+p,L+p+1,从而得到低位组合二进制序列B2={B21,B22,...,B28L+8p+7,B28L+8p+8}={BP211,BP212,BP213,BP214,BP215,BP216,BP217,BP218,BP221,BP222,...,BP227,BP228,...,BP2i1,BP2i2,...,BP2i7,BP2i8,...,BP2L+p+11,BP2L+p+12,BP2L+p+13,BP2L+p+14,BP2L+p+1 5,BP2L+p+1 6,BP2L+p+17,BP2L+p+18},Simultaneously combine L+p+1 binary sequences {BP1 i1 , BP1 i2 , BP1 i3 , BP1 i4 , BP1 i5 , BP1 i6 , BP1 i7 , BP1 i8 }, where i=1,2,...,L +p,L+p+1, so as to obtain the high-order combined binary sequence B1={B1 1 ,B1 2 ,...,B1 8L+8p+7 ,B1 8L+8p+8 }={BP1 1 1 ,BP1 1 2 ,BP1 13 ,BP1 14 ,BP1 15 ,BP1 16 ,BP1 17 ,BP1 18 ,BP1 21 ,BP1 22 ,...,BP1 27 ,BP1 28 ,...,BP1 i1 ,BP1 i2 ,..., BP1 i7 ,BP1 i8 ,...,BP1 L+p+11 ,BP1 L+p+12 ,BP1 L+p+13 ,BP1 L+p+14 ,BP1 L+p+15 ,BP1 L+p+ 1 6 , BP1 L+p+1 7 , BP1 L+p+18 }, and convert L+p+1 binary sequences {BP2 i1 , BP2 i2 , BP2 i3 , BP2 i4 , BP2 i5 , BP2 i6 , BP2 i7 ,BP2 i8 }, where i=1,2,...,L+p,L+p+1, so as to obtain the low-order combined binary sequence B2={B2 1 ,B2 2 ,...,B2 8L+ 8p+7 ,B2 8L+8p+8 }={BP2 11 ,BP2 12 ,BP2 13 ,BP2 14 ,BP2 15 ,BP2 16 ,BP2 17 ,BP2 18 ,BP2 21 ,BP2 22 ,...,BP2 27 , BP2 28 ,...,BP2 i1 ,BP2 i2 ,...,BP2 i7 ,BP2 i8 ,...,BP2 L+p+11 ,BP2 L+p+12 ,BP2 L+p+13 ,BP2 L +p+14 , BP2 L+p+1 5 , BP2 L+p+1 6 , BP2 L+p+17 , BP2 L+p+18 },
其中垃圾袋身份码包括GB2312字符集中双字节编码的汉字和ASCLL码值∈[32,126]的可见字符,垃圾袋身份码长度为k+L+p+n+6,数值序列S的长度为数值序列P1、P2的长度为L+p+1,组合二进制矩阵B的大小为组合二进制序列B1、B2的长度为8L+8p+8;Among them, the garbage bag identification code includes the double-byte encoded Chinese characters in the GB2312 character set and the visible characters with ASCLL code value ∈ [32,126]. The length of the garbage bag identification code is k+L+p+n+6, and the length of the numerical sequence S is The length of the numerical sequences P1 and P2 is L+p+1, and the size of the combined binary matrix B is The length of the combined binary sequence B1 and B2 is 8L+8p+8;
(2)某批垃圾袋的身份隐藏码统一加密(2) The identity hidden codes of a certain batch of garbage bags are uniformly encrypted
某批垃圾袋的身份隐藏码统一加密,表示利用身份标识码(M1M2…MkMk+L+p+ 1Mk+L+p+2...Mk+L+p+n-2)对身份隐藏码(Mk+1Mk+2...Mk+LMk+L+1Mk+L+2...Mk+L+p)进行加密,某批垃圾袋需且仅需经历一次身份隐藏码统一加密运算,The identity hidden code of a certain batch of garbage bags is uniformly encrypted, which means that the identity code (M 1 M 2 ... M k M k+L+p+ 1 M k+L+p+2 ... M k+L+p+n -2 ) Encrypt the identity hidden code (M k+1 M k+2 ... M k+L M k+L+1 M k+L+2 ... M k+L+p ), a batch of The garbage bag needs and only needs to undergo a unified encryption operation of the identity hidden code.
首先,利用数值序列S及其转换成的二进制矩阵B,数值序列P1、P2转换成的二进制序列B1、B2,以及外部密钥α和β,按照如下(1)-(5)公式分别计算得到Logistic混沌映射的初值x1和参数μ、抽取开始位置m,以及抽取间隔数n1、n2,First, using the numerical sequence S and the binary matrix B converted into it, the binary sequences B1 and B2 converted from the numerical sequences P1 and P2, and the external keys α and β, they are calculated according to the following formulas (1)-(5) respectively. The initial value x 1 and parameter μ of the Logistic chaotic map, the extraction start position m, and the number of extraction intervals n 1 and n 2 ,
令 make
则 but
x1=α+mod(α+kp, 1-α), (1)x 1 =α+mod(α+kp, 1-α), (1)
μ=β+mod(β+1.5×kp, 4-β), (2)μ=β+mod(β+1.5×kp, 4-β), (2)
其中,〈B1,i,B2,i,B3,i,B4,i,B5,i,B6,i,B7,i,B8,i〉表示二进制矩阵B第i列或者二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8}中二进制位‘1’的个数,<B11,B12,...,B18L+8p+7,B18L+8p+8>表示二进制序列{B11,B12,...,B18L+8p+7,B18L+8p+8}中二进制位‘1’的个数,B21,B22,...,B28L+8p+7,B28L+8p+8>表示二进制序列{B21,B22,...,B28L+8p+7,B28L+8p+8}中二进制位‘1’的个数,外部密钥满足α∈(0,1)、β∈(3.57,4),Among them, <B 1,i ,B 2,i ,B 3,i ,B 4,i ,B 5,i ,B 6,i ,B 7,i ,B 8,i >represents the i-th column of binary matrix B Or the number of binary bits '1' in the binary sequence {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS i8 }, <B1 1 , B1 2 ,...,B1 8L+8p+7 ,B1 8L+8p+8 >represents the number of binary bits '1' in the binary sequence {B1 1 ,B1 2 ,...,B1 8L+8p+7 ,B1 8L+8p+8 } ,B2 1 ,B2 2 ,...,B2 8L+8p+7 ,B2 8L+8p+8 > represents the binary sequence {B2 1 ,B2 2 ,...,B2 8L+8p+7 ,B2 8L+8p The number of binary bits '1' in +8 }, the external key satisfies α∈(0,1), β∈(3.57,4),
由混沌映射的初值x1和外部密钥μ,对如下公式(6)所示Logistic混沌映射进行迭代,式中k表示迭代次数(k=1,2,...)、xk+1表示第k次迭代得到的混沌信号,From 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个元素以形成长度为8L+8p+8的混沌信号序列同时从序列X中第m个元素开始依次间隔n2个元素取1个元素以形成长度为8L+8p+8的混沌信号序列Z={Z1,Z2,...,Z8L+8p+7,Z8L+8p+8},The chaotic signal sequence X={x 1 , x 2 ,...} is obtained, and starting from the mth element in the sequence X, one element is taken at intervals of n 1 elements to form a chaotic signal sequence with a length of 8L+8p+8 At the same time, starting from the mth element in the sequence X, 1 element is taken at intervals of n 2 elements to form a chaotic signal sequence with a length of 8L+8p+8 Z={Z 1 , Z 2 ,...,Z 8L+8p +7 ,Z 8L+8p+8 },
然后,将混沌信号序列Y按降序排序,根据混沌信号序列Y排序前、后的位置变化置乱规则,对高位组合二进制序列B1进行置乱,得到置乱后高位二进制序列同时将混沌信号序列Z按降序排序,根据混沌信号序列Z排序前、后的位置变化置乱规则,对低位组合二进制序列B2进行置乱,得到置乱后低位二进制序列 Then, sort the chaotic signal sequence Y in descending order, and scramble the high-order combined binary sequence B1 according to the scrambling rules of the position change before and after the chaotic signal sequence Y is sorted to obtain the scrambled high-order binary sequence At the same time, sort the chaotic signal sequence Z in descending order, and scrambling the low-order combined binary sequence B2 according to the scrambling rules of the position change before and after the chaotic signal sequence Z is sorted to obtain the scrambled low-order binary sequence
接着,令LB=mod(6-mod(8L+8p+8,6),6),将置乱后高位二进制序列的末尾添加LB个二进制位‘0’,将置乱后低位二进制序列的末尾添加LB个二进制位‘1’,得到二进制序列 和二进制序列 其中 Next, let LB=mod(6-mod(8L+8p+8,6),6), the scrambled high-order binary sequence Add LB binary bits '0' at the end, which will scramble the low-order binary sequence Add LB binary bits '1' at the end to get the binary sequence and binary sequence in
对二进制序列和分别进行分组,将二进制序列中元素从头到尾依次正向以6个元素为单位进行分组,得到分组后的二进制序列,表示为同时将二进制序列中元素从头到尾依次正向以6个元素为单位进行分组,得到分组后的二进制序列,表示为其中每一个二进制分组序列均包含6个二进制位,且 pair binary sequence and grouped separately, the binary sequence The elements in the middle are grouped forward in units of 6 elements from the beginning to the end, and the binary sequence after the grouping is obtained, which is expressed as Simultaneously convert the binary sequence The elements in the middle are grouped forward in units of 6 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 contains 6 binary bits, and
最后,将每一个二进制分组序列BF1{i}、BF2{i},依次进行如下扩散操作:Finally, each binary grouping sequence BF1{i}, BF2{i} is subjected to the following diffusion operations in turn:
S0:令i=1,且S0: let i=1, and
k1_switch=mod(3×<B11,B12,...,B18L+8p+7,B18L+8p+8>+2×(8L+8p+8-<B11,B12,...,B18L+8p+7,B18L+8p+8>),8),k1_switch=mod(3×<B1 1 ,B1 2 ,...,B1 8L+8p+7 ,B1 8L+8p+8 >+2×(8L+8p+8-<B1 1 ,B1 2 ,.. .,B1 8L+8p+7 ,B1 8L+8p+8 >),8),
k2_switch=mod(3×<B21,B22,...,B28L+8p+7,B28L+8p+8>-2×(8L+8p+8-<B21,B22,...,B28L+8p+7,B28L+8p+8>),25),k2_switch=mod(3×<B2 1 ,B2 2 ,...,B2 8L+8p+7 ,B2 8L+8p+8 >-2×(8L+8p+8-<B2 1 ,B2 2 ,.. .,B2 8L+8p+7 ,B2 8L+8p+8 >),25),
S1:将二进制分组序列BF1{i}、BF2{i},按如下公式(7)、(8)进行计算,S1: Calculate the binary grouping sequences BF1{i} and BF2{i} according to the following formulas (7) and (8),
CP1i=bin2dec(BF1{i})+176+k1_switch, (7)CP1 i =bin2dec(BF1{i})+176+k1_switch, (7)
CP2i=bin2dec(BF2{i})+161+k2_switch, (8)CP2 i =bin2dec(BF2{i})+161+k2_switch, (8)
S2:利用二进制分组序列BF1{i}计算而得的数值型数据CP1i,以及二进制分组序列BF2{i}计算而得的数值型数据CP2i,计算k1_switch=mod(CP1i+2×CP2i+3×k1_switch,8)、k2_switch=mod(CP2i+2×CP1i+3×k2_switch,25),且令i=i+1,接着判断i的大小,如果则转入步骤S1,否则转入步骤S3,S2: The numerical data CP1 i calculated by using the binary block sequence BF1{i}, and the numerical data CP2 i calculated by the binary block sequence BF2{i}, calculate k1_switch=mod(CP1 i +2×CP2 i +3×k1_switch,8), k2_switch=mod(CP2 i +2×CP1 i +3×k2_switch,25), and let i=i+1, then judge the size of i, if Then go to step S1, otherwise go to step S3,
S3:结束二进制分组序列的扩散操作,从而得到扩散后的数值序列CP1和CP2,即某批垃圾袋的身份隐藏码的加密信息,表示为 S3: End the diffusion operation of the binary packet sequence, so as to obtain the diffused numerical sequences CP1 and CP2, that is, the encrypted information of the identity hidden code of a certain batch of garbage bags, expressed as
(3)某批垃圾袋的垃圾分类号批量生成(3) Batch generation of garbage classification numbers for a certain batch of garbage bags
根据该批垃圾袋中单件垃圾袋的批量身份码(各个垃圾分类码制码日期、垃圾类别、垃圾分类序号信息)的不同,分别执行单个垃圾分类号生成步骤,即可实现该批垃圾袋的垃圾分类号批量生成,其中单件垃圾袋的垃圾分类号生成步骤描述如下,According to the difference in the batch identity code (code date of each garbage classification code, garbage category, garbage classification serial number information) of a single garbage bag in the batch of garbage bags, the steps of generating a single garbage classification number are performed respectively, and the batch of garbage bags can be realized. The garbage classification numbers are generated in batches, and the steps for generating the garbage classification numbers for a single garbage bag are described as follows:
首先,从垃圾袋身份码中抽取出垃圾分类码的制码日期(Mk+L+p+n-1Mk+L+p+n)、垃圾类别(Mk+L+p+n+1Mk+L+p+n+2)、垃圾分类序号信息(Mk+L+p+n+3Mk+L+p+n+4),将制码日期逐个字符利用bin2dec()函数转换成数值型数据,得到数值序列R={R1,R2},将垃圾分类序号信息逐个字符利用bin2dec()函数转换成数值型数据,得到数值序列F={F1,F2},First, extract the code date of the garbage classification code (M k+L+p+n-1 M k+L+p+n ), the garbage category (M k+L+p+n+ 1 M k+L+p+n+2 ), garbage classification serial number information (M k+L+p+n+3 M k+L+p+n+4 ), use bin2dec() to make code date character by character The function is converted into numerical data, and the numerical sequence R={R 1 , R 2 } is obtained, and the garbage classification serial number information is converted into numerical data character by character using the bin2dec() function to obtain the numerical sequence F={F 1 , F 2 } ,
然后,按照如下(9)、(10)公式分别计算得到Logistic混沌映射的初值和参数 Then, according to the following formulas (9) and (10), the initial value of the Logistic chaotic map is calculated respectively and parameters
令则make but
由混沌映射的初值和外部密钥对如下公式(11)所示Logistic混沌映射进行迭代,式中k表示迭代次数(k=1,2,...)、表示第k次迭代得到的混沌信号,Initial value mapped by chaos and external key Iterate the Logistic chaotic map shown in the following formula (11), where k represents the number of iterations (k=1, 2,...), represents the chaotic signal obtained at the kth iteration,
得到混沌信号序列从序列中第m个元素开始依次间隔n1个元素取1个元素以形成长度为的混沌信号序列同时从序列中第m个元素开始依次间隔n2个元素取1个元素以形成长度为的混沌信号序列 get chaotic signal sequence from the sequence The mth element in the middle starts to take 1 element at an interval of n 1 elements to form a length of chaotic signal sequence of Simultaneously from the sequence The mth element in the middle starts to take 1 element at an interval of n 2 elements to form a length of chaotic signal sequence of
接着,根据垃圾类别(Mk+L+p+n+1Mk+L+p+n+2)对某批垃圾袋的身份隐藏码加密信息,数值序列CP1、CP2采取如下操作,Next, according to the garbage category (M k+L+p+n+1 M k+L+p+n+2 ), the identity hidden code encryption information of a certain batch of garbage bags is performed, and the numerical sequences CP1 and CP2 take the following operations:
如果Mk+L+p+n+1Mk+L+p+n+2=“01”,则将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 If M k+L+p+n+1 M k+L+p+n+2 ="01", then the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
如果Mk+L+p+n+1Mk+L+p+n+2=“02”,则将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时将混沌信号序列按降序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 If M k+L+p+n+1 M k+L+p+n+2 = "02", then the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence Sort in descending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
如果Mk+L+p+n+1Mk+L+p+n+2=“03”,则先将混沌信号序列重组,得重组后的混沌信号序列 再将混沌信号序列按降序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 If M k+L+p+n+1 M k+L+p+n+2 = "03", then the chaotic signal sequence Recombination, get the reorganized chaotic signal sequence Then the chaotic signal sequence Sort in descending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
如果则先将混沌信号序列重组,得重组后的混沌信号序列 再将混沌信号序列按降序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时先将混沌信号序列重组,得重组后的混沌信号序列 再将混沌信号序列按降序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 if Then the chaotic signal sequence is first Recombination, get the reorganized chaotic signal sequence Then the chaotic signal sequence Sort in descending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence is first Recombination, get the reorganized chaotic signal sequence Then the chaotic signal sequence Sort in descending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
其中,运算表示得到一个不大于的整数,in, operation means to obtain a value not greater than the integer,
最后,将数值序列逐个元素组合并转换为汉字字符,得到汉字序列即为垃圾分类号,其中汉字序列C的长度为 Finally, the numerical sequence Element-by-element combination and conversion to Chinese characters to get the Chinese character sequence is the garbage classification number, where the length of the Chinese character sequence C is
根据该批垃圾袋中单个垃圾分类号生成过程,依次进行该批垃圾袋的各个垃圾分类号的生成;According to the generation process of a single garbage classification number in the batch of garbage bags, the generation of each garbage classification number of the batch of garbage bags is performed in sequence;
(4)某批垃圾袋的垃圾分类码组合与垃圾分类二维码生成(4) Combination of garbage classification codes for a certain batch of garbage bags and generation of garbage classification QR codes
将垃圾袋身份标识码(M1M2...MkMk+L+p+1Mk+L+p+2...Mk+L+p+n-2)、制码日期(Mk+L+p+n- 1Mk+L+p+n)、垃圾分类号垃圾类别(Mk+L+p+n+1Mk+L+p+n+2)、垃圾分类序号信息(Mk+L+p+n+3Mk+L+p+n+4)进行组合,生成该批垃圾袋中单个垃圾分类码,接着生成QR Code,即垃圾分类二维码,按此规则可批量组合生成该批垃圾袋的垃圾分类二维码。Put the garbage bag identification code (M 1 M 2 ... M k M k+L+p+1 M k+L+p+2 ... M k+L+p+n-2 ), the date of making the code (M k+L+p+n- 1 M k+L+p+n ), garbage classification number Garbage category (M k+L+p+n+1 M k+L+p+n+2 ), garbage classification serial number information (M k+L+p+n+3 M k+L+p+n+4 ) to generate a single garbage classification code in the batch of garbage bags, and then generate a QR Code, that is, a garbage classification two-dimensional code. According to this rule, the garbage classification two-dimensional code of the batch of garbage bags can be generated by batch combination.
进一步地,一种垃圾分类二维码批量生成方法里步骤(1)中所述的将身份标识码逐个字符转换成数值型数据,是指将身份标识码逐个字符采用unicode2native()函数将ASCII码值属于[32,126]的可见字符转换为单个数值型数据,或将GB2312字符集中双字节编码的汉字转换为两个数值型数据,从而得到对应的数值序列 Further, converting the identity code into numerical data character by character as described in step (1) in a method for batch generation of two-dimensional codes for garbage classification means that the identity code is character-by-character using the unicode2native() function to convert the ASCII code. The visible characters whose value belongs to [32,126] are converted into a single numeric data, or the Chinese characters encoded by the double-byte encoding in the GB2312 character set are converted into two numeric data, so as to obtain the corresponding numeric sequence
进一步地,一种垃圾分类二维码批量生成方法里步骤(1)中所述的将身份隐藏码逐个字符转换成数值型数据[Pi1,Pi2],是指将身份隐藏码逐个字符采用unicode2native()函数将ASCII码值属于[32,126]的可见字符转换为单个数值型数据并进行重组,表示为[Pi1,Pi2]=[0,unicode2native(Mi)],或将GB2312字符集中双字节编码的汉字转换为两个数值型数据,表示为[Pi1,Pi2]=unicode2native(Mi),从而得到高位数值序列P1={P11,P12,…,P1L+p,P1L+p+1}={P11,P21,…,P(L+p)1,P(L+p+1)1}和低位数值序列P2={P21,P22,…,P2L+p,P2L+p+1}={P12,P22,…,P(L+p)2,P(L+p+1)2}。Further, converting the identity hidden code into numerical data [P i1 , P i2 ] character by character as described in step (1) in a method for batch generation of two-dimensional codes for garbage classification means that the identity hidden code is used character by character. The unicode2native() function converts the visible characters whose ASCII code value belongs to [32,126] into a single numeric data and reorganizes them, expressed as [P i1 ,P i2 ]=[0,unicode2native(M i )], or the GB2312 character set The double-byte encoded Chinese characters are converted into two numerical data, which are expressed as [P i1 ,P i2 ]=unicode2native(M i ), so as to obtain the high-order numerical sequence P1={P1 1 ,P1 2 ,...,P1 L+p ,P1 L+p+1 }={P 11 ,P 21 ,…,P (L+p)1 ,P (L+p+1)1 } and the low-order numerical sequence P2={P2 1 ,P2 2 ,… , P2 L+p , P2 L+p+1 }={P 12 , P 22 ,...,P (L+p)2 ,P (L+p+1)2 }.
进一步地,一种垃圾分类二维码批量生成方法里步骤(1)中所述的将数值序列S中元素Si逐个转换成8bits的二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8},是指采用dec2bin(Si,8)函数得到二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8}。Further, the step (1) in a method for batch generation of two-dimensional codes for garbage classification converts the elements S i in the numerical sequence S into 8-bit binary sequences {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS i8 }, which means that the binary sequence {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS is obtained by using the dec2bin(S i , 8) function i8 }.
进一步地,一种垃圾分类二维码批量生成方法里步骤(1)中所述的将数值序列P1中元素P1i逐个转换成8bits的二进制序列{BP1i1,BP1i2,BP1i3,BP1i4,BP1i5,BP1i6,BP1i7,BP1i8},是指采用dec2bin(P1i,8)函数得到二进制序列{BP1i1,BP1i2,BP1i3,BP1i4,BP1i5,BP1i6,BP1i7,BP1i8}。Further, as described in step (1) in a method for batch generation of two-dimensional codes for garbage classification, the elements P1 i in the numerical sequence P1 are converted one by one into a binary sequence of 8 bits {BP1 i1 , BP1 i2 , BP1 i3 , BP1 i4 , BP1 i5 , BP1 i6 , BP1 i7 , BP1 i8 }, which means that the binary sequence {BP1 i1 , BP1 i2 , BP1 i3 , BP1 i4 , BP1 i5 , BP1 i6 , BP1 i7 , BP1 is obtained by using the dec2bin(P1 i , 8) function i8 }.
进一步地,一种垃圾分类二维码批量生成方法里步骤(1)中所述的将数值序列P2中元素P2i逐个转换成8bits的二进制序列{BP2i1,BP2i2,BP2i3,BP2i4,BP2i5,BP2i6,BP2i7,BP2i8},是指采用dec2bin(P2i,8)函数得到二进制序列{BP2i1,BP2i2,BP2i3,BP2i4,BP2i5,BP2i6,BP2i7,BP2i8}。Further, as described in step (1) in a method for batch generation of two-dimensional codes for garbage classification, the elements P2 i in the numerical sequence P2 are converted one by one into a binary sequence of 8 bits {BP2 i1 , BP2 i2 , BP2 i3 , BP2 i4 , BP2 i5 , BP2 i6 , BP2 i7 , BP2 i8 }, which means that the binary sequence {BP2 i1 , BP2 i2 , BP2 i3 , BP2 i4 , BP2 i5 , BP2 i6 , BP2 i7 , BP2 is obtained by using the dec2bin(P2 i , 8) function i8 }.
进一步地,一种垃圾分类二维码批量生成方法里步骤(3)中所述的将数值序列 逐个元素组合并转换为汉字字符,是指先逐个元素组合[CP1i,CP2i],然后再转换为汉字字符,即Ci=native2unicode([CP1i,CP2i])。Further, the numerical sequence described in step (3) in a method for batch generation of two-dimensional codes for garbage classification Combining elements one by one and converting them into Chinese characters refers to combining [CP1 i , CP2 i ] element by element and then converting them into Chinese characters, that is, C i =native2unicode([CP1 i ,CP2 i ]).
进一步地,一种垃圾分类二维码批量生成方法里步骤(4)中所述的将垃圾袋身份标识码(M1M2...MkMk+L+p+1Mk+L+p+2...Mk+L+p+n-2)、制码日期(Mk+L+p+n-1Mk+L+p+n)、垃圾分类号垃圾类别(Mk+L+p+n+1Mk+L+p+n+2)、垃圾分类序号信息(Mk+L+p+n+3Mk+L+p+n+4)进行组合,生成该批垃圾袋中单个垃圾分类码,是指采用将垃圾袋身份标识码、制码日期、垃圾分类号、垃圾类别和垃圾分类序号信息插入连接的组合方式,生成该批垃圾袋中单个垃圾分类码,表示为其中M1M2...Mk、Mk+L+p+1Mk+L+p+2...Mk+L+p+n-2Mk+L+p+n-1Mk+L+p+n、Mk+L+p+n+1Mk+L+p+n+2与Mk+L+p+n+3Mk+L+p+n+4之间相互用英文空格间隔。Further, in step (4) in a method for batch generation of two-dimensional codes for garbage classification, the garbage bag identification codes (M 1 M 2 ... M k M k+L+p+1 M k+L +p+2 ...M k+L+p+n-2 ), code date (M k+L+p+n-1 M k+L+p+n ), garbage classification number Garbage category (M k+L+p+n+1 M k+L+p+n+2 ), garbage classification serial number information (M k+L+p+n+3 M k+L+p+n+4 ) to generate a single garbage classification code in the batch of garbage bags, which refers to the combination method of inserting the garbage bag identification code, code production date, garbage classification number, garbage category and garbage classification serial number information into the connection to generate the batch of garbage. A single garbage classification code in the bag, expressed as where M 1 M 2 ... M k , M k+L+p+1 M k+L+p+2 ...M k+L+p+n-2 M k+L+p+n-1 M k+L+p+n , M k +L+p+n+1 M k+L+p+n+2 and M k+L+p+n+3 M k+L+p+n+4 are separated by English spaces.
有益效果:本发明依赖从垃圾袋身份码中提取的身份标识码和隐藏码并利用混沌映射产生混沌信号序列,对身份隐藏码转换并组合而成的高、低位二进制序列分别进行置乱、分组及扩散,完成某批垃圾袋的身份隐藏码统一加密,并依赖单件垃圾袋的批量身份码并利用混沌映射产生混沌信号序列,并根据垃圾类别对身份隐藏码统一加密结果分别进行不同规则的置乱,从而批量生成垃圾分类二维码,以此保证所提一种垃圾分类二维码批量生成方法简单可行,具有很强的安全性、不易破解,批量生成的垃圾分类码具有“唯一性、安全性和垃圾分类引导性”。Beneficial effect: the present invention relies on the identity identification code and hidden code extracted from the garbage bag identity code and uses chaotic mapping to generate a chaotic signal sequence, and scrambling and grouping the high and low binary sequences formed by the conversion and combination of the identity hidden code respectively. and diffusion, complete the unified encryption of the identity hidden codes of a certain batch of garbage bags, rely on the batch identity codes of a single garbage bag and use chaotic mapping to generate chaotic signal sequences, and perform different rules on the unified encryption results of the identity hidden codes according to the garbage category. Scrambling, thereby generating garbage classification two-dimensional codes in batches, so as to ensure that the proposed method for batch generation of garbage classification two-dimensional codes is simple and feasible, has strong security, and is not easy to crack. The garbage classification codes generated in batches have "uniqueness" , safety and guidance on waste sorting”.
附图说明Description of drawings
图1为本发明的一种垃圾分类二维码批量生成流程示意图;Fig. 1 is a schematic diagram of the batch generation process of a garbage classification two-dimensional code according to the present invention;
图2为本发明的垃圾分类二维码示意图,中间含有“可回收”绿色背景标志。Fig. 2 is a schematic diagram of a two-dimensional code for garbage classification according to the present invention, with a "recyclable" green background mark in the middle.
具体实施方式Detailed ways
如图1所示的一种垃圾分类二维码批量生成方法,包括如下几个步骤:As shown in Figure 1, a method for batch generation of two-dimensional codes for garbage classification includes the following steps:
(1)编码、转码(1) Encoding and transcoding
首先,将某批垃圾袋的身份信息进行编码,包括某批垃圾袋的统一身份码、单件垃圾袋的批量身份码两部分,从而生成某批单件垃圾袋唯一的中英文字符型垃圾袋身份码,表示为M1M2...MkMk+1Mk+2...Mk+LMk+L+1Mk+L+2...Mk+L+pMk+L+p+1Mk+L+p+2...Mk+L+p+nMk+L+p+n+1Mk+L+p+n+ 2Mk+L+p+n+3Mk+L+p+n+4,其中M1M2...Mk为省市区,Mk+1Mk+2...Mk+L为具体居住地址,Mk+L+1Mk+L+ 2...Mk+L+p为联系人和联系电话,Mk+L+p+1Mk+L+p+2...Mk+L+p+n为制码时间(格式为年-月-日,其中最后两位Mk+L+p+n-1Mk+L+p+n为日期),Mk+L+p+n+1Mk+L+p+n+2为垃圾分类颜色信息(表征垃圾类别),Mk+L+p+n+3Mk+L+p+n+4为垃圾分类序号信息(表征某天某种类别垃圾袋的序号),相互用英文空格间隔,相应某批垃圾袋的统一身份码为M1M2...MkMk+1Mk+2...Mk+LMk+L+1Mk+L+2...Mk+L+pMk+L+p+ 1Mk+L+p+2...Mk+L+p+n-3Mk+L+p+n-2,单件垃圾袋的批量身份码为Mk+L+p+n-1Mk+L+p+nMk+L+p+n+1Mk+L+p+n+ 2Mk+L+p+n+3Mk+L+p+n+4,First, encode the identity information of a batch of garbage bags, including the unified identity code of a batch of garbage bags and the batch identity code of a single garbage bag, so as to generate a garbage bag with Chinese and English characters that is unique to a single garbage bag. Identity code, expressed as M 1 M 2 ... M k M k+1 M k+2 ... M k+L M k+L+1 M k+L+2 ... M k+L+p M k+L+p+1 M k+L+p+2 ...M k+L+p+n M k+L+p+n+1 M k+L+p+n+ 2 M k+L +p+n+3 M k+L+p+n+4 , where M 1 M 2 ... M k are provinces and municipalities, and M k+1 M k+2 ... M k+L are specific residences Address, M k+L+1 M k+L+ 2 ... M k+L+p is the contact person and contact number, M k+L+p+1 M k+L+p+2 ... M k +L+p+n is the code time (the format is year-month-day, where the last two digits M k+L+p+n-1 M k+L+p+n is the date), M k+L+ p+n+1 M k+L+p+n+2 is the garbage classification color information (representing the garbage category), M k+L+p+n+3 M k+L+p+n+4 is the garbage classification serial number Information (representing the serial number of a certain type of garbage bags on a certain day), separated by English spaces, and the unified identity code of a corresponding batch of garbage bags is M 1 M 2 ... M k M k+1 M k+2 ... M k+L M k+L+1 M k+L+2 ...M k+L+p M k+L+p+ 1 M k+L+p+2 ...M k+L+p+ n-3 M k+L+p+n-2 , the batch ID code of a single garbage bag is M k+L+p+n-1 M k+L+p+n M k+L+p+n+ 1 M k+L+p+n+ 2 M k+L+p+n+3 M k+L+p+n+4 ,
然后,从某批垃圾袋的统一身份码中抽取出身份标识码(M1M2...MkMk+L+p+ 1Mk+L+p+2...Mk+L+p+n-2)和身份隐藏码(Mk+1Mk+2...Mk+LMk+L+1Mk+L+2...Mk+L+p),并将身份标识码逐个字符采用unicode2native()函数将ASCII码值属于[32,126]的可见字符转换为单个数值型数据,或将GB2312字符集中双字节编码的汉字转换为两个数值型数据,从而得到对应的数值序列同时将身份隐藏码逐个字符采用unicode2native()函数将ASCII码值属于[32,126]的可见字符转换为单个数值型数据并进行重组,表示为[Pi1,Pi2]=[0,unicode2native(Mi)],或将GB2312字符集中双字节编码的汉字转换为两个数值型数据,表示为[Pi1,Pi2]=unicode2native(Mi),从而得到高位数值序列P1={P11,P12,…,P1L+p,P1L+p+1}={P11,P21,…,P(L+p)1,P(L+p+1)1}和低位数值序列P2={P21,P22,…,P2L+p,P2L+p+1}={P12,P22,…,P(L+p)2,P(L+p+1)2},Then, the identification code (M 1 M 2 ... M k M k+L+p+ 1 M k+L+p+2 ... M k+L+ p+n-2 ) and identity concealment codes (M k+1 M k+2 ... M k+L M k+L+1 M k+L+2 ... M k+L+p ), and Use the unicode2native() function to convert the visible characters whose ASCII code value belongs to [32,126] into single numeric data, or convert the double-byte encoded Chinese characters in the GB2312 character set into two numeric data, thereby obtaining Corresponding numeric sequence At the same time, the unicode2native() function is used to convert the visible characters whose ASCII code value belongs to [32, 126] into a single numerical data and recombine them by using the unicode2native() function, which is expressed as [P i1 ,P i2 ]=[0,unicode2native(M i )], or convert the double-byte encoded Chinese characters in the GB2312 character set into two numerical data, expressed as [P i1 ,P i2 ]=unicode2native(M i ), so as to obtain the high-order numerical sequence P1={P1 1 ,P1 2 ,...,P1 L+p ,P1 L+p+1 }={P 11 ,P 21 ,...,P (L+p)1 ,P (L+p+1)1 } and the low-order numerical sequence P2= {P2 1 ,P2 2 ,…,P2 L+p ,P2 L+p+1 }={P 12 ,P 22 ,…,P (L+p)2 ,P (L+p+1)2 },
最后,依次将数值序列S中元素Si逐个采用dec2bin(Si,8)函数转换成8bits的二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8}、将数值序列P1中元素P1i逐个采用dec2bin(P1i,8)函数转换成8bits的二进制序列{BP1i1,BP1i2,BP1i3,BP1i4,BP1i5,BP1i6,BP1i7,BP1i8}、将数值序列P2中元素P2i逐个采用dec2bin(P2i, 8)函数转换成8bits的二进制序列{BP2i1,BP2i2,BP2i3,BP2i4,BP2i5,BP2i6,BP2i7,BP2i8},Finally, the elements Si in the numerical sequence S are sequentially converted into binary sequences of 8 bits {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS by using the dec2bin (Si , 8) function one by one i8 }. Convert the elements P1 i in the numerical sequence P1 into a binary sequence of 8 bits using the dec2bin(P1 i , 8) function one by one {BP1 i1 , BP1 i2 , BP1 i3 , BP1 i4 , BP1 i5 , BP1 i6 , BP1 i7 , BP1 i8 }. Convert the elements P2 i in the numerical sequence P2 one by one using the dec2bin(P2 i , 8) function into a binary sequence of 8 bits {BP2 i1 , BP2 i2 , BP2 i3 , BP2 i4 , BP2 i5 , BP2 i6 , BP2 i7 , BP2 i8 },
并将个二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8}进行组合,其中从而得到组合二进制矩阵B,and will Binary sequences {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS i8 } are combined, where Thus, the combined binary matrix B is obtained,
同时将L+p+1个二进制序列{BP1i1,BP1i2,BP1i3,BP1i4,BP1i5,BP1i6,BP1i7,BP1i8}进行组合,其中i=1,2,...,L+p,L+p+1,从而得到高位组合二进制序列B1={B11,B12,...,B18L+8p+7,B18L+8p+8}={BP11 1,BP11 2,BP113,BP114,BP115,BP116,BP117,BP118,BP121,BP122,...,BP127,BP128,...,BP1i1,BP1i2,...,BP1i7,BP1i8,...,BP1L+p+11,BP1L+p+12,BP1L+p+13,BP1L+p+14,BP1L+p+15,BP1L+p+1 6,BP1L+p+1 7,BP1L+p+18},并将L+p+1个二进制序列{BP2i1,BP2i2,BP2i3,BP2i4,BP2i5,BP2i6,BP2i7,BP2i8}进行组合,其中i=1,2,...,L+p,L+p+1,从而得到低位组合二进制序列B2={B21,B22,...,B28L+8p+7,B28L+8p+8}={BP211,BP212,BP213,BP214,BP215,BP216,BP217,BP218,BP221,BP222,...,BP227,BP228,...,BP2i1,BP2i2,...,BP2i7,BP2i8,...,BP2L+p+11,BP2L+p+12,BP2L+p+13,BP2L+p+14,BP2L+p+15,BP2L+p+16,BP2L+p+17,BP2L+p+18},Simultaneously combine L+p+1 binary sequences {BP1 i1 , BP1 i2 , BP1 i3 , BP1 i4 , BP1 i5 , BP1 i6 , BP1 i7 , BP1 i8 }, where i=1,2,...,L +p,L+p+1, so as to obtain the high-order combined binary sequence B1={B1 1 ,B1 2 ,...,B1 8L+8p+7 ,B1 8L+8p+8 }={BP1 1 1 ,BP1 1 2 ,BP1 13 ,BP1 14 ,BP1 15 ,BP1 16 ,BP1 17 ,BP1 18 ,BP1 21 ,BP1 22 ,...,BP1 27 ,BP1 28 ,...,BP1 i1 ,BP1 i2 ,..., BP1 i7 ,BP1 i8 ,...,BP1 L+p+11 ,BP1 L+p+12 ,BP1 L+p+13 ,BP1 L+p+14 ,BP1 L+p+15 ,BP1 L+p+ 1 6 , BP1 L+p+1 7 , BP1 L+p+18 }, and convert L+p+1 binary sequences {BP2 i1 , BP2 i2 , BP2 i3 , BP2 i4 , BP2 i5 , BP2 i6 , BP2 i7 ,BP2 i8 }, where i=1,2,...,L+p,L+p+1, so as to obtain the low-order combined binary sequence B2={B2 1 ,B2 2 ,...,B2 8L+ 8p+7 ,B2 8L+8p+8 }={BP2 11 ,BP2 12 ,BP2 13 ,BP2 14 ,BP2 15 ,BP2 16 ,BP2 17 ,BP2 18 ,BP2 21 ,BP2 22 ,...,BP2 27 , BP2 28 ,...,BP2 i1 ,BP2 i2 ,...,BP2 i7 ,BP2 i8 ,...,BP2 L+p+11 ,BP2 L+p+12 ,BP2 L+p+13 ,BP2 L +p+14 , BP2 L+p+15 , BP2 L+p+16 , BP2 L+p+17 , BP2 L+p+18 },
其中垃圾袋身份码包括GB2312字符集中双字节编码的汉字和ASCLL码值∈[32,126]的可见字符,垃圾袋身份码长度为k+L+p+n+6,数值序列S的长度为数值序列P1、P2的长度为L+p+1,组合二进制矩阵B的大小为组合二进制序列B1、B2的长度为8L+8p+8;Among them, the garbage bag identification code includes the double-byte encoded Chinese characters in the GB2312 character set and the visible characters with ASCLL code value ∈ [32,126]. The length of the garbage bag identification code is k+L+p+n+6, and the length of the numerical sequence S is The length of the numerical sequences P1 and P2 is L+p+1, and the size of the combined binary matrix B is The length of the combined binary sequence B1 and B2 is 8L+8p+8;
(2)某批垃圾袋的身份隐藏码统一加密(2) The identity hidden codes of a certain batch of garbage bags are uniformly encrypted
某批垃圾袋的身份隐藏码统一加密,表示利用身份标识码(M1M2…MkMk+L+p+ 1Mk+L+p+2...Mk+L+p+n-2)对身份隐藏码(Mk+1Mk+2...Mk+LMk+L+1Mk+L+2...Mk+L+p)进行加密,某批垃圾袋需且仅需经历一次身份隐藏码统一加密运算,The identity hidden code of a certain batch of garbage bags is uniformly encrypted, which means that the identity code (M 1 M 2 ... M k M k+L+p+ 1 M k+L+p+2 ... M k+L+p+n -2 ) Encrypt the identity hidden code (M k+1 M k+2 ... M k+L M k+L+1 M k+L+2 ... M k+L+p ), a batch of The garbage bag needs and only needs to undergo a unified encryption operation of the identity hidden code.
首先,利用数值序列S及其转换成的二进制矩阵B,数值序列P1、P2转换成的二进制序列B1、B2,以及外部密钥α和β,按照如下所示公式分别计算得到Logistic混沌映射的初值x1和参数μ、抽取开始位置m,以及抽取间隔数n1、n2,First, using the numerical sequence S and the binary matrix B converted into it, the binary sequences B1 and B2 converted from the numerical sequences P1 and P2, and the external keys α and β, respectively, according to the following formulas, the initial calculation of the Logistic chaotic mapping is obtained. the value x 1 and the parameter μ, the decimation start position m, and the decimation interval numbers n 1 , n 2 ,
令 make
则 but
x1=α+mod(α+kp,1-α),x 1 =α+mod(α+kp,1-α),
μ=β+mod(β+1.5×kp,4-β),μ=β+mod(β+1.5×kp,4-β),
其中,〈B1,i,B2,i,B3,i,B4,i,B5,i,B6,i,B7,i,B8,i〉表示二进制矩阵B第i列或者二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8}中二进制位‘1’的个数,<B11,B12,...,B18L+8p+7,B18L+8p+8表示二进制序列{B11,B12,...,B18L+8p+7,B18L+8p+8}中二进制位‘1’的个数,<B21,B22,...,B28L+8p+7,B28L+8p+8>表示二进制序列{B21,B22,...,B28L+8p+7,B28L+8p+8}中二进制位‘1’的个数,外部密钥满足α∈(0,1)、β∈(3.57,4),Among them, <B 1,i ,B 2,i ,B 3,i ,B 4,i ,B 5,i ,B 6,i ,B 7,i ,B 8,i >represents the i-th column of binary matrix B Or the number of binary bits '1' in the binary sequence {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS i8 }, <B1 1 , B1 2 ,...,B1 8L+8p+7 ,B1 8L+8p+8 represents the number of binary bits '1' in the binary sequence {B1 1 ,B1 2 ,...,B1 8L+8p+7 ,B1 8L+8p+8 }, <B2 1 ,B2 2 ,...,B2 8L+8p+7 ,B2 8L+8p+8 >represents the binary sequence {B2 1 ,B2 2 ,...,B2 8L+8p+7 ,B2 8L+8p The number of binary bits '1' in +8 }, the external key satisfies α∈(0,1), β∈(3.57,4),
由混沌映射的初值x1和外部密钥μ,对如下公式所示Logistic混沌映射进行迭代,式中k表示迭代次数(k=1,2,...)、xk+1表示第k次迭代得到的混沌信号,From the initial value x 1 of the chaotic map and the external key μ, iterate the Logistic chaotic map shown in the following formula, where k represents the number of iterations (k=1, 2,...), and x k+1 represents the kth The chaotic signal obtained by the second iteration,
xk+1=μ×xk×(1-xk)x k+1 = μ×x k ×(1-x k )
得到混沌信号序列X={x1,x2,...},从序列X中第m个元素开始依次间隔n1个元素取1个元素以形成长度为8L+8p+8的混沌信号序列同时从序列X中第m个元素开始依次间隔n2个元素取1个元素以形成长度为8L+8p+8的混沌信号序列Z={Z1,Z2,...,Z8L+8p+7,Z8L+8p+8},The chaotic signal sequence X={x 1 , x 2 ,...} is obtained, and starting from the mth element in the sequence X, one element is taken at intervals of n 1 elements to form a chaotic signal sequence with a length of 8L+8p+8 At the same time, starting from the mth element in the sequence X, 1 element is taken at intervals of n 2 elements to form a chaotic signal sequence with a length of 8L+8p+8 Z={Z 1 , Z 2 ,...,Z 8L+8p +7 ,Z 8L+8p+8 },
然后,将混沌信号序列Y按降序排序,根据混沌信号序列Y排序前、后的位置变化置乱规则,对高位组合二进制序列B1进行置乱,得到置乱后高位二进制序列同时将混沌信号序列Z按降序排序,根据混沌信号序列Z排序前、后的位置变化置乱规则,对低位组合二进制序列B2进行置乱,得到置乱后低位二进制序列 Then, sort the chaotic signal sequence Y in descending order, and scramble the high-order combined binary sequence B1 according to the scrambling rules of the position change before and after the chaotic signal sequence Y is sorted to obtain the scrambled high-order binary sequence At the same time, sort the chaotic signal sequence Z in descending order, and scrambling the low-order combined binary sequence B2 according to the scrambling rules of the position change before and after the chaotic signal sequence Z is sorted to obtain the scrambled low-order binary sequence
接着,令LB=mod(6-mod(8L+8p+8,6),6),将置乱后高位二进制序列的末尾添加LB个二进制位‘0’,将置乱后低位二进制序列的末尾添加LB个二进制位‘1’,得到二进制序列 和二进制序列 其中 Next, let LB=mod(6-mod(8L+8p+8,6),6), the scrambled high-order binary sequence Add LB binary bits '0' at the end, which will scramble the low-order binary sequence Add LB binary bits '1' at the end to get the binary sequence and binary sequence in
对二进制序列和分别进行分组,将二进制序列中元素从头到尾依次正向以6个元素为单位进行分组,得到分组后的二进制序列,表示为同时将二进制序列中元素从头到尾依次正向以6个元素为单位进行分组,得到分组后的二进制序列,表示为其中每一个二进制分组序列均包含6个二进制位,且 pair binary sequence and grouped separately, the binary sequence The elements in the middle are grouped forward in units of 6 elements from the beginning to the end, and the binary sequence after the grouping is obtained, which is expressed as Simultaneously convert the binary sequence The elements in the middle are grouped forward in units of 6 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 contains 6 binary bits, and
最后,将每一个二进制分组序列BF1{i}、BF2{i},依次进行如下扩散操作:Finally, each binary grouping sequence BF1{i}, BF2{i} is subjected to the following diffusion operations in turn:
S0:令i=1,且S0: let i=1, and
k1_switch=mod(3×<B11,B12,...,B18L+8p+7,B18L+8p+8>+2×(8L+8p+8-<B11,B12,...,B18L+8p+7,B18L+8p+8>),8),k1_switch=mod(3×<B1 1 ,B1 2 ,...,B1 8L+8p+7 ,B1 8L+8p+8 >+2×(8L+8p+8-<B1 1 ,B1 2 ,.. .,B1 8L+8p+7 ,B1 8L+8p+8 >),8),
k2_switch=mod(3×<B21,B22,...,B28L+8p+7,B28L+8p+8>-2×(8L+8p+8-<B21,B22,...,B28L+8p+7,B28L+8p+8>),25),k2_switch=mod(3×<B2 1 ,B2 2 ,...,B2 8L+8p+7 ,B2 8L+8p+8 >-2×(8L+8p+8-<B2 1 ,B2 2 ,.. .,B2 8L+8p+7 ,B2 8L+8p+8 >),25),
S1:将二进制分组序列BF1{i}、BF2{i},按如下所示公式进行计算,S1: Calculate the binary grouping sequence BF1{i}, BF2{i} according to the following formula,
CP1i=bin2dec(BF1{i})+176+k1_switch,CP1 i =bin2dec(BF1{i})+176+k1_switch,
CP2i=bin2dec(BF2{i})+161+k2_switch,CP2 i =bin2dec(BF2{i})+161+k2_switch,
S2:利用二进制分组序列BF1{i}计算而得的数值型数据CP1i,以及二进制分组序列BF2{i}计算而得的数值型数据CP2i,计算k1_switch=mod(CP1i+2×CP2i+3×k1_switch,8)、k2_switch=mod(CP2i+2×CP1i+3×k2_switch,25),且令i=i+1,接着判断i的大小,如果则转入步骤S1,否则转入步骤S3,S2: The numerical data CP1 i calculated by using the binary block sequence BF1{i}, and the numerical data CP2 i calculated by the binary block sequence BF2{i}, calculate k1_switch=mod(CP1 i +2×CP2 i +3×k1_switch,8), k2_switch=mod(CP2 i +2×CP1 i +3×k2_switch,25), and let i=i+1, then judge the size of i, if Then go to step S1, otherwise go to step S3,
S3:结束二进制分组序列的扩散操作,从而得到扩散后的数值序列CP1和CP2,即某批垃圾袋的身份隐藏码的加密信息,表示为 S3: End the diffusion operation of the binary packet sequence, so as to obtain the diffused numerical sequences CP1 and CP2, that is, the encrypted information of the identity hidden code of a certain batch of garbage bags, expressed as
(3)某批垃圾袋的垃圾分类号批量生成(3) Batch generation of garbage classification numbers for a certain batch of garbage bags
根据该批垃圾袋中单件垃圾袋的批量身份码(各个垃圾分类码制码日期、垃圾类别、垃圾分类序号信息)的不同,分别执行单个垃圾分类号生成步骤,即可实现该批垃圾袋的垃圾分类号批量生成,其中单件垃圾袋的垃圾分类号生成步骤描述如下,According to the difference in the batch identity code (code date of each garbage classification code, garbage category, garbage classification serial number information) of a single garbage bag in the batch of garbage bags, the steps of generating a single garbage classification number are performed respectively, and the batch of garbage bags can be realized. The garbage classification numbers are generated in batches, and the steps for generating the garbage classification numbers for a single garbage bag are described as follows:
首先,从垃圾袋身份码中抽取出垃圾分类码的制码日期(Mk+L+p+n-1Mk+L+p+n)、垃圾类别(Mk+L+p+n+1Mk+L+p+n+2)、垃圾分类序号信息(Mk+L+p+n+3Mk+L+p+n+4),将制码日期逐个字符利用bin2dec()函数转换成数值型数据,得到数值序列R={R1,R2},将垃圾分类序号信息逐个字符利用bin2dec()函数转换成数值型数据,得到数值序列F={F1,F2},First, extract the code date of the garbage classification code (M k+L+p+n-1 M k+L+p+n ), the garbage category (M k+L+p+n+ 1 M k+L+p+n+2 ), garbage classification serial number information (M k+L+p+n+3 M k+L+p+n+4 ), use bin2dec() to make code date character by character The function is converted into numerical data, and the numerical sequence R={R 1 , R 2 } is obtained, and the garbage classification serial number information is converted into numerical data character by character using the bin2dec() function to obtain the numerical sequence F={F 1 , F 2 } ,
然后,按照如下所示公式分别计算得到Logistic混沌映射的初值和参数 Then, according to the following formulas, the initial values of the Logistic chaotic map are calculated respectively. and parameters
令则make but
由混沌映射的初值和外部密钥对如下公式所示Logistic混沌映射进行迭代,式中k表示迭代次数(k=1,2,...)、表示第k次迭代得到的混沌信号,Initial value mapped by chaos and external key Iterate the Logistic chaotic map shown in the following formula, where k represents the number of iterations (k=1, 2,...), represents the chaotic signal obtained at the kth iteration,
得到混沌信号序列从序列中第m个元素开始依次间隔n1个元素取1个元素以形成长度为的混沌信号序列同时从序列中第m个元素开始依次间隔n2个元素取1个元素以形成长度为的混沌信号序列 get chaotic signal sequence from the sequence The mth element in the middle starts to take 1 element at an interval of n 1 elements to form a length of chaotic signal sequence of Simultaneously from the sequence The mth element in the middle starts to take 1 element at an interval of n 2 elements to form a length of chaotic signal sequence of
接着,根据垃圾类别(Mk+L+p+n+1Mk+L+p+n+2)对某批垃圾袋的身份隐藏码加密信息,数值序列CP1、CP2采取如下操作,Next, according to the garbage category (M k+L+p+n+1 M k+L+p+n+2 ), the identity hidden code encryption information of a certain batch of garbage bags is performed, and the numerical sequences CP1 and CP2 take the following operations:
如果Mk+L+p+n+1Mk+L+p+n+2=“01”,则将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 If M k+L+p+n+1 M k+L+p+n+2 ="01", then the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
如果Mk+L+p+n+1Mk+L+p+n+2=“02”,则将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时将混沌信号序列按降序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 If M k+L+p+n+1 M k+L+p+n+2 = "02", then the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence Sort in descending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
如果Mk+L+p+n+1Mk+L+p+n+2=“03”,则先将混沌信号序列重组,得重组后的混沌信号序列 再将混沌信号序列按降序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 If M k+L+p+n+1 M k+L+p+n+2 = "03", then the chaotic signal sequence Recombination, get the reorganized chaotic signal sequence Then the chaotic signal sequence Sort in descending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
如果Mk+L+p+n+1Mk+L+p+n+2=“04”,则先将混沌信号序列重组,得重组后的混沌信号序列 再将混沌信号序列按降序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时先将混沌信号序列重组,得重组后的混沌信号序列 再将混沌信号序列按降序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 If M k+L+p+n+1 M k+L+p+n+2 = "04", then the chaotic signal sequence Recombination, get the reorganized chaotic signal sequence Then the chaotic signal sequence Sort in descending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence is first Recombination, get the reorganized chaotic signal sequence Then the chaotic signal sequence Sort in descending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
其中,运算表示得到一个不大于的整数,in, operation means to obtain a value not greater than the integer,
最后,将数值序列先逐个元素组合[CP1i,CP2i],然后再转换为汉字字符,即Ci=native2unicode([CP1i,CP2i]),得到汉字序列即为垃圾分类号,其中汉字序列C的长度为 Finally, the numerical sequence First combine [CP1 i , CP2 i ] element by element, and then convert them into Chinese characters, that is, C i =native2unicode([CP1 i ,CP2 i ]), get the Chinese character sequence is the garbage classification number, where the length of the Chinese character sequence C is
根据该批垃圾袋中单个垃圾分类号生成过程,依次进行该批垃圾袋的各个垃圾分类号的生成;According to the generation process of a single garbage classification number in the batch of garbage bags, the generation of each garbage classification number of the batch of garbage bags is performed in sequence;
(4)某批垃圾袋的垃圾分类码组合与垃圾分类二维码生成(4) Combination of garbage classification codes for a certain batch of garbage bags and generation of garbage classification QR codes
将垃圾袋身份标识码(M1M2...MkMk+L+p+1Mk+L+p+2...Mk+L+p+n-2)、制码日期(Mk+L+p+n- 1Mk+L+p+n)、垃圾分类号垃圾类别(Mk+L+p+n+1Mk+L+p+n+2)、垃圾分类序号信息(Mk+L+p+n+3Mk+L+p+n+4)采用插入连接的组合方式,生成该批垃圾袋中单个垃圾分类码,表示为其中M1M2...Mk、Mk+L+p+1Mk+L+p+2...Mk+L+p+n-2Mk+L+p+n-1Mk+L+p+n、Mk+L+p+n+1Mk+L+p+n+2与Mk+L+p+n+3Mk+L+p+n+4之间相互用英文空格间隔,生成该批垃圾袋中单个垃圾分类码,接着生成QR Code,即垃圾分类二维码,按此规则可批量组合生成该批垃圾袋的垃圾分类二维码。Put the garbage bag identification code (M 1 M 2 ... M k M k+L+p+1 M k+L+p+2 ... M k+L+p+n-2 ), the date of making the code (M k+L+p+n- 1 M k+L+p+n ), garbage classification number Garbage category (M k+L+p+n+1 M k+L+p+n+2 ), garbage classification serial number information (M k+L+p+n+3 M k+L+p+n+4 ) adopts the combination of inserting and connecting to generate a single garbage classification code in the batch of garbage bags, which is expressed as where M 1 M 2 ... M k , M k+L+p+1 M k+L+p+2 ...M k+L+p+n-2 M k+L+p+n-1 M k+L+p+n , M k +L+p+n+1 M k+L+p+n+2 and M k+L+p+n+3 M k+L+p+n+4 are separated by English spaces to generate the batch A single garbage classification code in the garbage bag, and then generate a QR Code, that is, a garbage classification two-dimensional code. According to this rule, the garbage classification two-dimensional code of the batch of garbage bags can be generated in batches.
下面结合具体的实施例对本发明作进一步说明:Below in conjunction with specific embodiment, the present invention will be further described:
实施例1Example 1
按照上述一种垃圾分类二维码批量生成方法,步骤如下:According to the above-mentioned method for batch generation of QR codes for garbage classification, the steps are as follows:
(1)编码、转码(1) Encoding and transcoding
将某批垃圾袋的身份信息进行编码,包括某批垃圾袋的统一身份码、单件垃圾袋的批量身份码两部分,生成某批单件垃圾袋唯一的中英文字符型垃圾袋身份码为“江苏省-南通市-海门区中南世纪城-12#1201李晓强15005709999 2020-08-02 01 03”,长度为k+L+p+n+9=11+13+14+10+9=57,其中“江苏省-南通市-崇川区”为省市区,“中南世纪城-12#1201”为具体居住地址(如小区-门牌),“李晓强15005709999”为联系人和联系电话,“2020-08-02”为制码时间,“01”为垃圾分类颜色信息(如绿色的可回收垃圾),“03”为垃圾分类序号信息,相应地,某批垃圾袋的统一身份码为“江苏省-南通市-海门区中南世纪城-12#1201李晓强15005709999 2020-08-”,单件垃圾袋的批量身份码为“02 01 03”,Encode the identity information of a batch of garbage bags, including the unified identity code of a batch of garbage bags and the batch identity code of a single garbage bag, and generate the unique Chinese and English character garbage bag identity code of a single garbage bag of a batch of garbage bags: "Jiangsu Province-Nantong City-Haimen District Zhongnan Century City-12#1201 Li Xiaoqiang 15005709999 2020-08-02 01 03", the length is k+L+p+n+9=11+13+14+10+9=57 , among which "Jiangsu Province-Nantong City-Chongchuan District" is the provincial and urban area, "Central South Century City-12#1201" is the specific residential address (such as the community-house number), "Li Xiaoqiang 15005709999" is the contact person and telephone number, " 2020-08-02" is the code production time, "01" is the color information of garbage classification (such as green recyclable garbage), and "03" is the information of the garbage classification serial number. Correspondingly, the unified identity code of a batch of garbage bags is " Jiangsu Province - Nantong City - Zhongnan Century City, Haimen District - 12#1201 Li Xiaoqiang 15005709999 2020-08-", the batch ID code for a single garbage bag is "02 01 03",
然后,从某批垃圾袋的统一身份码中分别抽取出身份标识码(江苏省-南通市-海门区2020-08-)和身份隐藏码(中南世纪城-12#1201李晓强15005709999),并将身份标识码逐个字符采用unicode2native()函数转换成数值型数据,得到对应的数值序列S={189,173,203,213,202,161,45,196,207,205,168,202,208,45,186,163,195,197,199,248,32,50,48,50,48,45,48,56,45},同时将身份隐藏码逐个字符转换成数值型数据,得到对应的高位数值序列P1={214,196,202,188,179,0,0,0,0,0,0,0,0,0,192,207,199,0,0,0,0,0,0,0,0,0,0,0}和低位数值序列P2={208,207,192,205,199,45,49,50,35,49,50,48,49,32,238,254,191,49,53,48,48,53,55,48,57,57,57,57},其中数值序列S的长度为数值序列P1、P2的长度为L+p+1=13+14+1=28,Then, extract the identity code (Jiangsu Province-Nantong City-Haimen District 2020-08-) and the identity hidden code (Central South Century City-12#1201 Li Xiaoqiang 15005709999) from the unified identity code of a certain batch of garbage bags, and set the The identification code is converted into numerical data character by character using the unicode2native() function to obtain the corresponding numerical sequence S={189,173,203,213,202,161,45,196,207,205,168,202,208,45,186,163,195,197,199,248,32,50,48,50,5,8,45,48} Convert the identity hidden code character by character into numerical data to obtain the corresponding high-order numerical sequence P1={214,196,202,188,179,0,0,0,0,0,0,0,0,0,192,207,199,0,0,0,0,0 ,0,0,0,0,0,0} and low-order numerical sequence P2={208,207,192,205,199,45,49,50,35,49,50,48,49,32,238,254,191,49,53,48,48,53, 55,48,57,57,57,57}, where the length of the numerical sequence S is The length of the numerical sequences P1 and P2 is L+p+1=13+14+1=28,
最后,依次将数值序列S中元素Si逐个转换成8bits的二进制序列,将数值序列P1中元素P1i逐个转换成8bits的二进制序列,将数值序列P2中元素P2i逐个转换成8bits的二进制序列,Finally, convert the elements S i in the numerical sequence S into a binary sequence of 8 bits one by one, convert the elements P1 i in the numerical sequence P1 into a binary sequence of 8 bits one by one, and convert the elements P2 i in the numerical sequence P2 into a binary sequence of 8 bits one by one ,
并将29个二进制序列{BSi1,BSi2,BSi3,BSi4,BSi5,BSi6,BSi7,BSi8}进行组合,从而得到组合二进制矩阵B,and combine 29 binary sequences {BS i1 , BS i2 , BS i3 , BS i4 , BS i5 , BS i6 , BS i7 , BS i8 } to obtain a combined binary matrix B,
同时将28个二进制序列{BP1i1,BP1i2,BP1i3,BP1i4,BP1i5,BP1i6,BP1i7,BP1i8}进行组合,从而得到高位组合二进制序列B1={B11,B12,...,B1223,B1224}={1,1,0,1,0,1,1,0,1,1,0,0,0,1,0,0,1,1,0,0,1,0,1,0,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},At the same time, 28 binary sequences {BP1 i1 , BP1 i2 , BP1 i3 , BP1 i4 , BP1 i5 , BP1 i6 , BP1 i7 , BP1 i8 } are combined to obtain the high-order combined binary sequence B1={B1 1 ,B1 2 ,. ..,B1 223 ,B1 224 }={1,1,0,1,0,1,1,0,1,1,0,0,0,1,0,0,1,1,0,0 ,1,0,1,0,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0 ,1,1,0,0,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0},
将28个二进制序列{BP2i1,BP2i2,BP2i3,BP2i4,BP2i5,BP2i6,BP2i7,BP2i8}进行组合,从而得到低位组合二进制序列B2={B21,B22,...,B2223,B2224}={1,1,0,1,0,0,0,0,1,1,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,0,0,1,1,0,1,1,1,0,0,0,1,1,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,1,0,0,1,0,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,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,0,0,1,1,0,0,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,0,0,0,01,1,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,1,0,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1};Combine 28 binary sequences {BP2 i1 , BP2 i2 , BP2 i3 , BP2 i4 , BP2 i5 , BP2 i6 , BP2 i7 , BP2 i8 } to obtain the low-order combined binary sequence B2={B2 1 , B2 2 , .. .,B2 223 ,B2 224 }={1,1,0,1,0,0,0,0,1,1,0,0,1,1,1,1,1,1,0,0, 0,0,0,0,1,1,0,0,1,1,0,1,1,1,0,0,0,1,1,1,0,0,1,0,1, 1,0,1,0,0,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,0,0,0, 1,1,0,0,1,1,0,0,0,1,0,0,1,1,0,0,1,0,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,1,0,1,1,1,0, 1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,0,0,1,1,0,0,0,1,0, 0,1,1,0,1,0,1,0,0,1,1,0,0,0,0,0,01,1,0,0,0,0,0,0,1, 1,0,1,0,1,0,0,1,1,0,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1, 1,0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1, 0,0,1};
(2)某批垃圾袋的身份隐藏码统一加密(2) The identity hidden codes of a certain batch of garbage bags are uniformly encrypted
某批垃圾袋的身份隐藏码统一加密,表示利用身份标识码(江苏省-南通市-海门区2020-08-)对身份隐藏码(中南世纪城-12#1201李晓强15005709999)进行加密,某批垃圾袋需且仅需经历一次身份隐藏码统一加密运算,The identity hidden codes of a certain batch of garbage bags are uniformly encrypted, which means that the identity hidden codes (Central South Century City-12#1201 Li Xiaoqiang 15005709999) are encrypted with the identity code (Jiangsu Province-Nantong City-Haimen District 2020-08-), and a batch of The garbage bag needs and only needs to undergo a unified encryption operation of the identity hidden code.
首先,利用数值序列S及其转换成的二进制矩阵B,数值序列P1、P2转换成的二进制序列B1、B2,以及外部密钥α=0.12345和β=3.75,按照如下所示公式分别计算得到Logistic混沌映射的初值x1和参数μ、抽取开始位置m,以及抽取间隔数n1、n2,First, using the numerical sequence S and the binary matrix B converted into it, the binary sequences B1 and B2 converted from the numerical sequences P1 and P2, and the external keys α=0.12345 and β=3.75, Logistic is calculated according to the following formulas respectively. The initial value x 1 of the chaotic map, the parameter μ, the extraction start position m, and the number of extraction intervals n 1 , n 2 ,
令则make but
x1=0.12345+mod(0.12345+0.527325318380424,1-0.12345)=0.774225318380424,x 1 =0.12345+mod(0.12345+0.527325318380424,1-0.12345)=0.774225318380424,
μ=3.75+mod(3.75+1.5×0.527325318380424,4-3.75)=3.790987977570636,μ=3.75+mod(3.75+1.5×0.527325318380424,4-3.75)=3.790987977570636,
m=987+mod(13295951060,67)=1037,m=987+mod(13295951060,67)=1037,
n1=1+mod(13295951060,57)=18,n 1 =1+mod(13295951060,57)=18,
n2=1+mod(13295951060,47)=36,n 2 =1+mod(13295951060,47)=36,
由混沌映射的初值x1和外部密钥μ,对如下公式所示Logistic混沌映射进行迭代,式中k表示迭代次数(k=1,2,...)、xk+1表示第k次迭代得到的混沌信号,From the initial value x 1 of the chaotic map and the external key μ, iterate the Logistic chaotic map shown in the following formula, where k represents the number of iterations (k=1, 2,...), and x k+1 represents the kth The chaotic signal obtained by the second iteration,
xk+1=μ×xk×(1-xk)x k+1 = μ×x k ×(1-x k )
得到混沌信号序列X={x1,x2,...},从序列X中第1037个元素开始依次间隔18个元素取1个元素以形成长度为224的混沌信号序列Y={Y1,Y2,...,Y223,Y224},同时从序列X中第1037个元素开始依次间隔36个元素取1个元素以形成长度为224的混沌信号序列Z={Z1,Z2,...,Z223,Z224},The chaotic signal sequence X={x 1 , x 2 ,...} is obtained, starting from the 1037th element in the sequence X and taking 1 element at an interval of 18 elements to form a chaotic signal sequence of length 224 Y={Y 1 ,Y 2 ,...,Y 223 ,Y 224 }, and at the same time, starting from the 1037th element in the sequence X, one element is taken at an interval of 36 elements to form a chaotic signal sequence of length 224 Z={Z 1 ,Z 2 ,...,Z 223 ,Z 224 },
然后,将混沌信号序列Y按降序排序,根据混沌信号序列Y排序前、后的位置变化置乱规则,对高位组合二进制序列B1进行置乱,得到置乱后高位二进制序列0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0},同时将混沌信号序列Z按降序排序,根据混沌信号序列Z排序前、后的位置变化置乱规则,对低位组合二进制序列B2进行置乱,得到置乱后低位二进制序列 Then, sort the chaotic signal sequence Y in descending order, and scramble the high-order combined binary sequence B1 according to the scrambling rules of the position change before and after the chaotic signal sequence Y is sorted to obtain the scrambled high-order binary sequence 0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0, 0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,1,0, 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0} , at the same time sort the chaotic signal sequence Z in descending order, according to the scrambling rules of the position change before and after the sorting of the chaotic signal sequence Z, scramble the low-order combined binary sequence B2, and obtain the scrambled low-order binary sequence
接着,令LB=mod(6-mod(224,6),6)=4,将置乱后高位二进制序列的末尾添加4个二进制位‘0’,将置乱后低位二进制序列的末尾添加4个二进制位‘1’,得到二进制序列 和二进制序列 其中二进制序列的长度为 Next, let LB=mod(6-mod(224,6),6)=4, and scramble the high-order binary sequence Add 4 binary bits '0' at the end, which will scramble the low-order binary sequence Add 4 binary bits '1' at the end to get the binary sequence and binary sequence where binary sequence length is
将二进制序列中元素从头到尾依次正向以6个元素为单位进行分组,得到分组后的二进制序列,BF1{1}={1,1,0,0,0,0},BF1{2}={0,0,0,0,0,0},…,BF1{19}={0,1,0,0,0,0},…,BF1{37}={0,0,0,1,0,0},BF1{38}={0,0,0,0,0,0},同时将二进制序列中元素从头到尾依次正向以6个元素为单位进行分组,得到分组后的二进制序列,BF2{1}={0,0,1,0,1,1},BF2{2}={1,0,1,0,0,0},…,BF2{19}={1,1,0,0,0,1},…,BF2{37}={1,0,0,0,1,1},BF2{38}={1,1,1,1,1,1},binary sequence The elements in the middle are grouped in units of 6 elements from the beginning to the end, and the binary sequence after the grouping is obtained, BF1{1}={1,1,0,0,0,0}, BF1{2}={0 ,0,0,0,0,0},…,BF1{19}={0,1,0,0,0,0},…,BF1{37}={0,0,0,1,0 ,0}, BF1{38}={0,0,0,0,0,0}, while converting the binary sequence The elements in the middle are grouped in units of 6 elements from the beginning to the end, and the binary sequence after the grouping is obtained, BF2{1}={0,0,1,0,1,1}, BF2{2}={1 ,0,1,0,0,0},…,BF2{19}={1,1,0,0,0,1},…,BF2{37}={1,0,0,0,1 ,1}, BF2{38}={1,1,1,1,1,1},
最后,将每一个二进制分组序列BF1{i}、BF2{i}依次进行扩散操作,从而得到扩散后的数值序列,即某批垃圾袋的身份隐藏码的加密信息,CP1={227,176,182,184,188,206,180,182,178,182,176,234,178,213,178,177,182,178,194,197,190,181,176,186,217,179,178,178,178,190,184,178,178,182,181,185,184,180}和CP2={194,215,175,195,177,204,241,237,235,200,178,202,220,206,178,202,162,177,230,218,212,166,225,223,192,222,184,193,222,174,228,229,191,189,190,195,212,227};最后,将每一个二进制分组序列BF1{i}、BF2{i}依次进行扩散操作,从而得到扩散后的数值序列,即某批垃圾袋的身份隐藏码的加密信息,CP1={227,176,182,184,188,206,180,182,178,182,176,234,178,213,178,177,182,178,194,197,190,181,176,186,217,179,178,178,178,190,184,178,178,182,181,185,184,180}和CP2 ={194,215,175,195,177,204,241,237,235,200,178,202,220,206,178,202,162,177,230,218,212,166,225,223,192,222,184,193,222,174,228,229,191,189,190,195,212,227};
(3)某批垃圾袋的垃圾分类号批量生成(3) Batch generation of garbage classification numbers for a certain batch of garbage bags
根据该批垃圾袋中单件垃圾袋的批量身份码(各个垃圾分类码制码日期、垃圾类别、垃圾分类序号信息)的不同,分别执行单个垃圾分类号生成步骤,即可实现该批垃圾袋的垃圾分类号批量生成,其中单件垃圾袋的垃圾分类号生成步骤描述如下,According to the difference in the batch identity code (code date of each garbage classification code, garbage category, garbage classification serial number information) of a single garbage bag in the batch of garbage bags, the steps of generating a single garbage classification number are performed respectively, and the batch of garbage bags can be realized. The garbage classification numbers are generated in batches, and the steps for generating the garbage classification numbers for a single garbage bag are described as follows:
首先,从垃圾袋身份码中抽取出垃圾分类码制码日期“02”、垃圾类别“01”、垃圾分类序号信息“03”,将制码日期逐个字符利用bin2dec()函数转换成数值型数据,得到数值序列R={48,50},将垃圾分类序号信息逐个字符利用bin2dec()函数转换成数值型数据,得到数值序列F={48,51},First, extract the garbage classification code date "02", garbage category "01", and garbage classification serial number information "03" from the garbage bag identity code, and convert the code date into numerical data character by character using the bin2dec() function. , obtain the numerical sequence R={48,50}, convert the garbage classification serial number information into numerical data character by character using the bin2dec() function, and obtain the numerical sequence F={48,51},
然后,令则Then, let but
由混沌映射的初值和外部密钥对Logistic混沌映射进行迭代,式中k表示迭代次数(k=1,2,...)、表示第k次迭代得到的混沌信号,Initial value mapped by chaos and external key Iterate the Logistic chaotic map, where k represents the number of iterations (k=1, 2,...), represents the chaotic signal obtained at the kth iteration,
得到混沌信号序列从序列中第1037个元素开始依次间隔18个元素取1个元素以形成长度为38的混沌信号序列同时从序列中第1037个元素开始依次间隔36个元素取1个元素以形成长度为38的混沌信号序列 get chaotic signal sequence from the sequence The 1037th element in the middle starts to take 1 element at an interval of 18 elements to form a chaotic signal sequence with a length of 38 Simultaneously from the sequence The 1037th element starts to take 1 element at intervals of 36 elements to form a chaotic signal sequence of length 38
接着,根据垃圾类别“01”对某批垃圾袋的身份隐藏码加密信息,数值序列CP1、CP2采取如下操作——将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对数值序列CP1进行置乱,得到置乱后的数值序列 同时将混沌信号序列按升序排序,根据混沌信号序列排序前、后的位置变化置乱规则,对低位组合二进制序列CP2进行置乱,得到置乱后的数值序列 Then, according to the garbage category "01", the identity hidden code encryption information of a certain batch of garbage bags is performed, and the numerical sequences CP1 and CP2 take the following operations: the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the numerical sequence CP1, and obtaining the scrambled numerical sequence At the same time, the chaotic signal sequence Sort in ascending order, according to the chaotic signal sequence The position change scrambling rules before and after sorting, scrambling the low-order combination binary sequence CP2, and obtaining the scrambled numerical sequence
最后,将数值序列先逐个元素组合再转换为汉字字符,得到汉字序列,即垃圾分类号为“静佘脖翠裁步案淀玖袄脖彩辎孤闶府舵搞晨疮嫁拨尾哆涸呸卞岗短霸柴册等码睹蹲站参”,Finally, the numerical sequence First combine the elements one by one and then convert them into Chinese characters to get the sequence of Chinese characters, that is, the garbage classification number is "Jingshe Neck Cui Cui Step Case Dian Jiu Ao Neck Cai Y Gu Yu Fu Rudder Engaged in Morning Sore Marry Tail Duo Bian Gang Short Ba Chai Book and other codes see squatting and standing.”,
根据该批垃圾袋中单个垃圾分类号生成过程,依次进行该批垃圾袋的各个垃圾分类号的生成;According to the generation process of a single garbage classification number in the batch of garbage bags, the generation of each garbage classification number of the batch of garbage bags is performed in sequence;
(4)某批垃圾袋的垃圾分类码组合与垃圾分类二维码生成(4) Combination of garbage classification codes for a certain batch of garbage bags and generation of garbage classification QR codes
将垃圾袋身份标识码(“江苏省-南通市-海门区2020-08-”)、制码日期(“02”)、垃圾分类号(“静佘脖翠裁步案淀玖袄脖彩辎孤闶府舵搞晨疮嫁拨尾哆涸呸卞岗短霸柴册等码睹蹲站参”)、垃圾类别(“01”)、垃圾分类序号信息(“03”)采用插入连接的组合方式,生成该批垃圾袋中单个垃圾分类码为“江苏省-南通市-海门区静佘脖翠裁步案淀玖袄脖彩辎孤闶府舵搞晨疮嫁拨尾哆涸呸卞岗短霸柴册等码睹蹲站参2020-08-02 01 03”,生成该批垃圾袋中单个垃圾分类码,接着生成QR Code,即垃圾分类二维码,按此规则可批量组合生成该批垃圾袋的垃圾分类二维码。The identification code of the garbage bag ("Jiangsu Province-Nantong City-Haimen District 2020-08-"), the date of making the code ("02"), the garbage classification number ("Jingshe Neck Cui Cui Step Case Dian Jiu Ao Neck Cai Ying") The rudder of Gujiafu is engaged in morning sore, marriage, tail, duo dry, Biangang, short bar, firewood, etc. "), garbage category ("01"), garbage classification serial number information ("03") using a combination of plug-in connections method, the single garbage classification code in the batch of garbage bags is generated as "Jiangsu Province-Nantong City-Haimen District Jingshe Neck Cuisin Step Case Dian Jiu Ao Neck Cai Yi Gu Gu Fu Rui Engage in Morning Sore Marry the Tail Duo Dry Bian Gang" Codes such as Dianba Chai Book and other codes see squatting station refer to 2020-08-02 01 03” to generate a single garbage classification code in the batch of garbage bags, and then generate a QR Code, that is, a two-dimensional code for garbage classification. QR code for garbage classification of batch garbage bags.
实施例2Example 2
按照上述一种垃圾分类二维码批量生成方法,某批单件垃圾袋的垃圾分类二维码生成步骤以及外部密钥、制码日期、垃圾类别、垃圾分类序号信息与具体实施例1相似,对于垃圾袋身份标识码(“江苏省-南通市-海门区2020-08-”,或者“工苏省-南通市-海门区2020-08-”,或者“江苏省-南通市-海们区2020-08-”,或者“江苏省-南通市-海门区2020-09-”),仅原垃圾袋身份信息中的身份隐藏码(“中南世纪城-12#1201李晓强15005709999”)发生细微变化:“钟南世纪城-12#1201李晓强15005709999”;或“中南世纪城-12#1211李晓强1500570999”;或“中南世纪城-12#1201李晓强15005709998”,某件垃圾袋的垃圾分类二维码生成结果如表1所示。由下表可知,某批单件垃圾袋的身份隐藏码发生细微变化会引起垃圾分类二维码发生很大的变化,由此可见本专利所提一种垃圾分类二维码批量生成方法对垃圾袋身份信息中隐藏部分(即垃圾袋身份隐藏码)具有敏感性。According to the above-mentioned method for generating a batch of two-dimensional codes for garbage classification, the steps for generating a two-dimensional code for garbage classification of a batch of single garbage bags, as well as the external key, code production date, garbage category, and garbage classification serial number information are similar to those in the
表1某批单件垃圾袋的身份隐藏码发生微变时,垃圾分类二维码生成结果Table 1 When the identity hidden code of a batch of single garbage bags changes slightly, the generation results of the QR code for garbage classification
实施例3Example 3
按照上述一种垃圾分类二维码批量生成方法,某批单件垃圾袋的垃圾分类二维码生成步骤以及垃圾袋身份隐藏码、制码日期、垃圾类别、垃圾分类序号信息与具体实施例1相似,对于垃圾袋身份标识码(“江苏省-南通市-海门区2020-08-”,或者“工苏省-南通市-海门区2020-08-”,或者“江苏省-南通市-海们区2020-08-”,或者“江苏省-南通市-海门区2020-09-”),仅外部密钥(α=0.12345、β=3.75)单个发生细微变化:α=0.123450000000001;或β=3.750000000000001,某批单件垃圾袋的垃圾分类二维码生成结果如表2所示。由下表可见:一旦外部密钥发生即使细微变化,即“失之毫厘”,生成的垃圾分类二维码会“差之千里”,由此可见本专利所提一种垃圾分类二维码批量生成方法具有密钥敏感性。According to the above-mentioned method for generating a batch of two-dimensional codes for garbage classification, the steps for generating a two-dimensional code for garbage classification of a batch of single garbage bags, and the information of the identity hidden code of the garbage bags, the date of making the code, the garbage category, the garbage classification serial number, and the
表2外部密钥发生微变时,垃圾分类二维码的生成结果Table 2 The generation results of the QR code for garbage classification when the external key changes slightly
实施例4Example 4
按照上述一种垃圾分类二维码批量生成方法,某批单件垃圾袋的垃圾分类二维码生成步骤以及垃圾袋身份标识码、垃圾袋身份隐藏码、外部密钥与具体实施例1相似,某批垃圾袋的垃圾分类颜色信息分别为“01”、“02”、“03”、“04”;或者某批垃圾袋的制码日期分别为“02”、“06”、“12”、“16”、“22”、“26”;或者某批垃圾袋的垃圾分类序号信息分别为“01”、“02”、“03”、“04”、“05”、“06”,对应的三批垃圾分类二维码生成结果如表3所示。由下表可知,某批垃圾袋的垃圾分类颜色信息、制码日期、垃圾分类序号信息的依次变化可批量生成某批垃圾袋的垃圾分类二维码,且本专利所提一种垃圾分类二维码批量生成方法对垃圾袋身份信息中垃圾分类颜色信息、制码日期和垃圾分类序号信息均具有敏感性。According to the above-mentioned method for generating a batch of two-dimensional codes for garbage classification, the steps for generating a two-dimensional code for garbage classification of a batch of single garbage bags, as well as the garbage bag identification code, the garbage bag identity hidden code, and the external key are similar to those in the
表3垃圾分类二维码的批量生成结果Table 3 Batch generation results of QR codes for garbage classification
由上述具体实施例1-4分析可知,本专利所提一种垃圾分类码批量生成方法所批量生成的垃圾分类码不仅与外部密钥密切相关,而且依赖于垃圾袋身份信息(某批垃圾袋的统一身份码、单件垃圾袋的批量身份码),因此本专利所提的一种垃圾分类码批量生成方法具有很强的安全性,以保证批量生成的垃圾分类码具有“唯一性、安全性和垃圾分类引导性”。From the analysis of the above-mentioned specific embodiments 1-4, it can be seen that the garbage classification codes generated in batches by the method for batch generation of garbage classification codes proposed in this patent are not only closely related to the external key, but also depend on the identity information of garbage bags (a certain batch of garbage bags). Therefore, the method for batch generation of garbage classification codes proposed in this patent has strong security, so as to ensure that the garbage classification codes generated in batches are “unique, safe and secure”. Sexuality and Waste Sorting Guidance".
以上所述,仅是本发明的较佳实施例而已,并非对本发明作任何形式上的限制,虽然本发明已以较佳实施例揭露如上,然而并非用以限定本发明,任何熟悉本专业的技术人员,在不脱离本发明技术方案范围内,当可利用上述揭示的技术内容作出些许更动或修饰为等同变化的等效实施例,但凡是未脱离本发明技术方案的内容,依据本发明的技术实质对以上实施例所作的任何简单修改、等同变化与修饰,均仍属于本发明技术方案的范围内。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 (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011038759.0A CN112183697B (en) | 2020-09-28 | 2020-09-28 | A method for batch generation of two-dimensional codes for garbage classification |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011038759.0A CN112183697B (en) | 2020-09-28 | 2020-09-28 | A method for batch generation of two-dimensional codes for garbage classification |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112183697A CN112183697A (en) | 2021-01-05 |
CN112183697B true CN112183697B (en) | 2022-05-03 |
Family
ID=73944697
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011038759.0A Active CN112183697B (en) | 2020-09-28 | 2020-09-28 | A method for batch generation of two-dimensional codes for garbage classification |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112183697B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104680220A (en) * | 2015-03-24 | 2015-06-03 | 南通大学 | Commodity anti-counterfeiting code batch generation method |
CN109472338A (en) * | 2018-11-19 | 2019-03-15 | 南通大学 | A batch generation method of commodity anti-counterfeiting two-dimensional code |
CN109933755A (en) * | 2019-03-21 | 2019-06-25 | 江苏工程职业技术学院 | A kind of generation method of garbage classification code |
CN109977371A (en) * | 2019-03-21 | 2019-07-05 | 江苏工程职业技术学院 | A kind of generation method of character type garbage classification code |
CN110033066A (en) * | 2019-03-21 | 2019-07-19 | 江苏工程职业技术学院 | A kind of generation method of colour garbage classification two dimensional code |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100571750B1 (en) * | 2003-06-18 | 2006-04-18 | 삼성전자주식회사 | Method and apparatus for generating preamble using chaotic sequence |
US20160234009A1 (en) * | 2015-02-08 | 2016-08-11 | Wenhua Li | Chaotic Baseband Modulation Hopping Based Post-Quantum Physical-Layer Encryption |
-
2020
- 2020-09-28 CN CN202011038759.0A patent/CN112183697B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104680220A (en) * | 2015-03-24 | 2015-06-03 | 南通大学 | Commodity anti-counterfeiting code batch generation method |
CN109472338A (en) * | 2018-11-19 | 2019-03-15 | 南通大学 | A batch generation method of commodity anti-counterfeiting two-dimensional code |
CN109933755A (en) * | 2019-03-21 | 2019-06-25 | 江苏工程职业技术学院 | A kind of generation method of garbage classification code |
CN109977371A (en) * | 2019-03-21 | 2019-07-05 | 江苏工程职业技术学院 | A kind of generation method of character type garbage classification code |
CN110033066A (en) * | 2019-03-21 | 2019-07-19 | 江苏工程职业技术学院 | A kind of generation method of colour garbage classification two dimensional code |
Non-Patent Citations (1)
Title |
---|
混沌数码防伪技术研究与应用;盛苏英等;《微电子学与计算机》;20120831;第169-174页 * |
Also Published As
Publication number | Publication date |
---|---|
CN112183697A (en) | 2021-01-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112116046B (en) | Garbage classification two-dimensional code generation method based on layered encryption | |
CN110033066B (en) | Method for generating color garbage classification two-dimensional code | |
CN109933755B (en) | Method for generating garbage classification code | |
CN104486073B (en) | A kind of encryption and decryption method of character type data | |
CN101599118A (en) | Method for detecting and locating HTML page tampering | |
CN112001468B (en) | A method for generating and recognizing anti-counterfeiting codes for character-type commodities | |
CN106095735A (en) | A kind of method plagiarized based on deep neural network detection academic documents | |
CN112183697B (en) | A method for batch generation of two-dimensional codes for garbage classification | |
CN106021344B (en) | A Multi-adaptive CIME Grid Model Sharing Method | |
CN112163230B (en) | A method for generating anti-counterfeiting code of goods with Chinese character encryption | |
CN112183698B (en) | A method for generating two-dimensional codes for Chinese garbage classification | |
CN111680316B (en) | Information security sharing method for multiple business entities in the power industry | |
CN109977371B (en) | Method for generating character type garbage classification code | |
CN111382820A (en) | Four-lattice pure-color commodity anti-counterfeiting code generation method | |
CN114741712A (en) | Chinese character encryption method based on hierarchical scrambling | |
CN113935345B (en) | A batch generation method of commodity anti-counterfeiting code based on string-to-image encryption | |
CN113159252A (en) | Commodity anti-counterfeiting two-dimensional code generation method based on different scrambling rules | |
CN102509058B (en) | Point type GIS vector data disguise and recovery method based on redundant bit replacement | |
CN114997353A (en) | Garbage classification two-dimensional code generation method based on block encryption | |
CN114881189A (en) | Garbage classification two-dimensional code generation method based on different combination modes | |
CN115358361A (en) | Garbage classification code generation method based on combined encryption | |
CN114722409A (en) | Character string decryption method based on layered bidirectional diffusion | |
Zhang et al. | A Study on Encoding of Urban Underground Space Facilities Based | |
CN113935343B (en) | Commodity anti-counterfeiting code generation method based on character string-to-picture encryption | |
CN115913792B (en) | DGA domain name identification method, system and readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20241206 Address after: 518000 1104, Building A, Zhiyun Industrial Park, No. 13, Huaxing Road, Henglang Community, Longhua District, Shenzhen, Guangdong Province Patentee after: Shenzhen Hongyue Enterprise Management Consulting Co.,Ltd. Country or region after: China Address before: 226000 Jiangsu city of Nantong province sik Road No. 9 Patentee before: NANTONG University Country or region before: China |