CN116320200B - Multi-point fusion anti-cracking encryption method applied to two-dimensional code - Google Patents

Multi-point fusion anti-cracking encryption method applied to two-dimensional code Download PDF

Info

Publication number
CN116320200B
CN116320200B CN202310582963.6A CN202310582963A CN116320200B CN 116320200 B CN116320200 B CN 116320200B CN 202310582963 A CN202310582963 A CN 202310582963A CN 116320200 B CN116320200 B CN 116320200B
Authority
CN
China
Prior art keywords
encrypted
character sequence
data stream
data
dimensional code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310582963.6A
Other languages
Chinese (zh)
Other versions
CN116320200A (en
Inventor
毛霖
黄德民
陈海军
齐佰剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Turtle Rabbit Race Software Research Institute Co ltd
Original Assignee
Nanjing Turtle Rabbit Race Software Research Institute Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Turtle Rabbit Race Software Research Institute Co ltd filed Critical Nanjing Turtle Rabbit Race Software Research Institute Co ltd
Priority to CN202310582963.6A priority Critical patent/CN116320200B/en
Publication of CN116320200A publication Critical patent/CN116320200A/en
Application granted granted Critical
Publication of CN116320200B publication Critical patent/CN116320200B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/32Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
    • H04N1/32101Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
    • H04N1/32144Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
    • H04N1/32149Methods relating to embedding, encoding, decoding, detection or retrieval operations
    • H04N1/32267Methods relating to embedding, encoding, decoding, detection or retrieval operations combined with processing of the image
    • H04N1/32272Encryption or ciphering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/0819Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s)
    • H04L9/0825Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s) using asymmetric-key encryption or public key infrastructure [PKI], e.g. key signature or public key certificates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/32Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
    • H04N1/32101Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
    • H04N1/32144Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
    • H04N1/32149Methods relating to embedding, encoding, decoding, detection or retrieval operations
    • H04N1/32288Multiple embedding, e.g. cocktail embedding, or redundant embedding, e.g. repeating the additional information at a plurality of locations in the image
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/34Encoding or coding, e.g. Huffman coding or error correction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/72Signcrypting, i.e. digital signing and encrypting simultaneously

Abstract

The invention discloses a multipoint fusion anti-cracking encryption method applied to a two-dimensional code, which belongs to the technical field of information encoding and decoding and comprises the following steps: acquiring a two-dimensional code character sequence of a product, establishing a corresponding relation between the two-dimensional code character sequence of the product and original information points of a two-dimensional code, generating a target image according to the corresponding relation between the original information points of the two-dimensional code, and performing encryption processing on the target image to generate a first encrypted image; performing data preprocessing on the first character sequence to generate first preset data; encrypting the data of the second character sequence to generate first encrypted data; normalizing the first encrypted data to generate second encrypted data; embedding the second encrypted data and the first preset data into the first encrypted image to obtain a two-dimensional code after fusing the images.

Description

Multi-point fusion anti-cracking encryption method applied to two-dimensional code
Technical Field
The invention relates to the technical field of information encoding and decoding, in particular to a multipoint fusion anti-cracking encryption method applied to two-dimensional codes.
Background
The food safety problem is very important, and is directly related to the physical health of people, and is also closely related to the aspects of economic development, social stability and the like. The establishment of the food traceability system can help the supervision department to track the sources, production flows, transportation processes and sales channels of foods more accurately, can effectively reduce the occurrence of food safety problems, ensures the rights and safety of the public, and can enable consumers to know information such as production, processing and quality detection of agricultural products, so that brand products can be better known, the brand awareness is improved, and brand development is promoted.
The application of the two-dimensional code technology provides convenience for a food tracing system, but potential safety hazards exist at the same time. The traditional two-dimensional code encryption mode has fixed rules, so that the two-dimensional code encryption mode is easy to crack by an attacker and generates character strings with the same length. Under the condition, an attacker can utilize the analyzed information to perform actions such as data tampering, fake making and the like, so that the credibility and effectiveness of the food safety traceability system are damaged. Therefore, in order to ensure the safety of a food safety traceability system, a more efficient two-dimensional code encryption technology is required.
In view of the above, the invention provides a multipoint fusion anti-cracking encryption method applied to two-dimensional codes.
Disclosure of Invention
In order to overcome the defects in the prior art, the embodiment of the invention provides a multipoint fusion anti-cracking encryption method applied to two-dimensional codes.
In order to achieve the above purpose, the present invention provides the following technical solutions: a multipoint fusion anti-cracking encryption method applied to two-dimension codes comprises the following steps:
s1: acquiring a two-dimensional code character sequence of a product, establishing a corresponding relation between the two-dimensional code character sequence of the product and original information points of a two-dimensional code, and correspondingly generating a target image according to the original information points of the two-dimensional code, wherein the target image comprises a blank graphic area, a position detection graphic area, a positioning graphic area, a format information graphic area, a version information graphic area, a correction graphic area and a data error correction graphic area;
s2: encrypting the target image to generate a first encrypted image;
s3: marking the character sequence of the product two-dimensional code corresponding to the correction pattern area as a first character sequence, and performing data preprocessing on the first character sequence to generate first preset data;
s4: marking the character sequence of the product two-dimensional code corresponding to the data error correction graphic region as a second character sequence; encrypting the data of the second character sequence to generate first encrypted data; normalizing the first encrypted data to generate second encrypted data;
s5: embedding the second encrypted data and the first preset data into the first encrypted image to obtain a two-dimensional code after fusing the images.
Preferably, the generating logic of the first encrypted image is:
acquiring a pixel gray matrix of the target imageWherein->For the pixel gray values in said pixel gray matrix, is->Is an integer from 0 to 255, ">For the matrix number of the pixel gray matrix, for>For the matrix column number of the pixel gray matrix, < >> 、/>Each pixel gray value is an integer greater than or equal to 1, and each pixel gray value has a corresponding weight value;
matrix the pixel gray scalePixel gray value +.>And a preset two-dimensional code pixel gray level threshold interval +.>Comparing, wherein->
If it isThe corresponding pixel gray value +.>The weight value of (2) is assigned as B+2; if it isThe corresponding pixel gray value +.>The weight value of (2) is assigned as B+1; if it isThe corresponding pixel gray value +.>Is assigned a weight value of 0; wherein B is a constant greater than or equal to 0;
gray value of pixelNormalization processing is performed, and the pixel gray value of the normalization processing is +.>And multiplying the first encrypted image by the corresponding weight value respectively, thereby generating the first encrypted image.
Preferably, the generating logic of the first preset data is:
constructing a digital twin model for the first character sequence, and generating a first twin character sequence according to the digital twin model;
performing character exclusive or encryption on the first character sequence to generate a first encrypted character sequence;
constructing a character sequence-encrypted character sequence bipartite graph for a first twin character sequence and the first encrypted character sequence; and obtaining matching data between the first twin character sequence and the first encrypted character sequence according to a character sequence-encrypted character sequence bipartite graph, and defining the matching data as the first preset data.
Preferably, the processing logic of the character sequence-encrypted character sequence bipartite graph is:
the character sequence-encrypted character sequence bipartite graph modeling is expressed as G= (V, S, E), wherein V represents the first twin character sequence set, S represents the first encrypted character sequence set, m first twin character sequences and n first encrypted character sequences are shared, E represents a set of selectable links between the first twin character sequences and the first encrypted character sequences, the selectable links are edges e= (V, S), E, V E V, S E S in the bipartite graph, and each selectable link has a weight l m,n Selecting the maximum weight value l m,n And carrying out digital association between the first character sequence and the first encryption character sequence through the matching data as matching data of the optional link.
Preferably, the generating logic of the second encrypted data is:
converting the second character sequence into binary numbers through a QR coding mode, packaging the coded data stream into a data group according to 4 bits, and supplementing less than 0 to form a binary data stream;
sequentially filling the binary data stream into X data groups, and sequentially performing exclusive-or encryption on the filled X data groups to form first encrypted data;
and carrying out normalization processing on the first encrypted data to form second encrypted data.
Preferably, the processing of the second encrypted data further includes the steps of:
setting a communication confirmation signature for the second encrypted data, wherein the communication confirmation signature comprises a shared dynamic key and a digital signature;
the shared dynamic key is a random signature key generated by a server, and the digital signature is a digital signature key with an identity authenticated by the server;
the server is a two-dimension code application server.
Preferably, the character sequence of the second encrypted data and the first preset data is embedded into the first encrypted image to obtain a two-dimensional code after the image is fused, which comprises the following fusion steps:
analyzing a first encrypted image to generate a first encrypted image sequence, converting the first encrypted image sequence into a first encrypted image binary data stream in a QR (quick response) coding mode, packaging the first encrypted image binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized first encrypted image binary data stream;
analyzing the second encrypted data to generate a second encrypted character sequence, converting the second encrypted character sequence into a second encrypted binary data stream by a QR (quick response) coding mode, packaging the second encrypted binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized second encrypted binary data stream;
analyzing first preset data to generate a first preset character sequence, converting the first preset character sequence into a first preset binary data stream in a QR (quick response) coding mode, packaging the first preset binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized first preset binary data stream;
adding the second encrypted binary data stream and the first preset binary data stream into the first encrypted image binary data stream according to binary addition to generate a second target binary data stream;
and converting the second target binary data stream to generate a second target character sequence, and generating a two-dimensional code after the fusion image is obtained through the second target character sequence.
Preferably, processing logic of the first encrypted image binary data stream, the second encrypted binary data stream and the first preset binary data stream about binary data streams is:
dividing each 4 bits in a binary data stream into an array and using polynomialsExpression, polynomial->Index of q>Representing the corresponding array position in the binary data stream, coefficient +.>Decimal data corresponding to each array position is represented;
wherein q is a placeholder in the polynomial expression, and concretely represents an unknown number, an index p of q represents an array position corresponding to an array in a binary data stream, and a coefficient of qIndicate->Decimal data corresponding to the array of the numbers, +.>The value of (2) is in the range of 0 to 15;
wherein:、/>、/>and->A binary number corresponding to four bits, namely 0 or 1,、/>、/>and->The positions of the binary numbers in the array are represented in ascending order, namely k1=1, k2=2, k3=3, and k4=4.
The multipoint fusion anti-cracking encryption method applied to the two-dimensional code has the technical effects and advantages that:
according to the invention, the purpose of anti-cracking encryption is realized by encrypting the two-dimension code information, and the data ciphertext is embedded into the image ciphertext, so that the safety of the two-dimension code data is protected, and the safety problems of information theft, tampering and the like are prevented.
The two-dimensional code encryption method based on the different structural region division is realized by applying different encryption algorithms to different two-dimensional code regions, so that the safety and the reliability of two-dimensional code information are improved.
The first character sequence and the second character sequence can effectively prevent the two-dimensional code information from being acquired and tampered by unauthorized persons through encryption and normalization processing, and meanwhile, the anti-interference performance and the readability of the two-dimensional code can be improved, so that the method has a wide application prospect.
Drawings
FIG. 1 is a block diagram of a two-dimensional code according to the present invention;
FIG. 2 is a flow chart of the anti-hacking encryption method of the present invention;
FIG. 3 is a block diagram of a character sequence-encrypted character sequence bipartite graph node and edge of the present invention.
In fig. 1: 1. blank pattern areas; 2. a position detection pattern area; 3. positioning a graphic area; 4. a format information graphic area; 5. version information graphic area; 6. correcting the graphic area; 7. and a data error correction pattern area.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
Referring to fig. 1-2, the multipoint fusion anti-cracking encryption method applied to two-dimensional codes in the embodiment includes the following steps:
s1: acquiring a two-dimensional code character sequence of a product, establishing a corresponding relation between the two-dimensional code character sequence of the product and original information points of a two-dimensional code, and generating a corresponding target image according to the original information points of the two-dimensional code, wherein the target image comprises a blank graphic area 1, a position detection graphic area 2, a positioning graphic area 3, a format information graphic area 4, a version information graphic area 5, a correction graphic area 6 and a data error correction graphic area 7;
what needs to be explained here is: the basic format of an image formed by the two-dimensional code is shown in fig. 1, and specifically comprises a blank graphic area 1, a position detection graphic area 2, a positioning graphic area 3, a format information graphic area 4, a version information graphic area 5, a correction graphic area 6 and a data error correction graphic area 7;
the blank graphic area 1 is a boundary line of a two-dimensional code area, the boundary of the two-dimensional code is defined, and the actual data meaning is avoided;
the position detection pattern area 2 and the positioning pattern area 3 are used for positioning two-dimensional codes, and the positions of the two-dimensional codes are fixed, and only the sizes of the two-dimensional codes are different; when the specification is determined, the number and positions of the correction patterns are also determined, thereby determining the correction pattern area 6;
the format information graphic area 4 is the format information of the current two-dimensional code, represents the error correction level of the two-dimensional code, and determines the error correction level according to the error correction level; the code word sequence is segmented according to the requirement, error correction code words are generated according to the error correction grade and the segmented code words, and the error correction code words are added to the back of the data code word sequence to form a new sequence.
The version information graphic area 5 is the data coding version information of the current two-dimensional code, namely the specification of the two-dimensional code, wherein the two-dimensional code symbols are 40 matrixes (generally black and white) with the specification, from 21x21 (version 1) to 177x177 (version 40), and each version symbol is added with 4 modules on each side compared with the previous version; these are all basic formats, which are already set up before use, and do not involve data transmission;
the data error correction pattern area 7 is actually stored two-dimensional code information and error correction code words (used for correcting errors caused by damage to the two-dimensional code), and the data code words obtained at the beginning of use are preset data.
S2: encrypting the target image to generate a first encrypted image;
what needs to be explained here is: the two-dimension code for tracing the product information at present is generally a static two-dimension code; once the static two-dimensional code is generated, the content of the static two-dimensional code is not changed; therefore, when the invention carries out safe encryption processing on the target image, the embedded image is added on the target image to increase the complexity and difficulty of the target image, thereby improving the safety of the target image.
The generation logic of the first encrypted image is as follows:
acquiring a pixel gray matrix of the target imageWherein->,/>For the pixel gray values in said pixel gray matrix, is->Is an integer from 0 to 255, ">For the matrix number of the pixel gray matrix, for>For the matrix column number of the pixel gray matrix, < >> 、/>Each pixel gray value is an integer greater than or equal to 1, and each pixel gray value has a corresponding weight value;
matrix the pixel gray scalePixel gray value +.>And a preset two-dimensional code pixel gray level threshold interval +.>Comparing, wherein->
If it isThe corresponding pixel gray value +.>The weight value of (2) is assigned as B+2; if it isThe corresponding pixel gray value +.>The weight value of (2) is assigned as B+1; if it isThe corresponding pixel gray value +.>Is assigned a weight value of 0; wherein B is a constant greater than or equal to 0;
gray value of pixelNormalization processing is performed, and the pixel gray value of the normalization processing is +.>And multiplying the first encrypted image by the corresponding weight value respectively, thereby generating the first encrypted image.
S3: performing data preprocessing on the product two-dimensional code character sequence corresponding to the correction pattern area 6 to generate first preset data;
what needs to be explained here is: the current correction pattern area 6 mainly refers to a special pattern provided in a two-dimensional code, and is used for helping a decoder to identify the position and the direction of the two-dimensional code when scanning the two-dimensional code, and mainly aims to help a scanner or mobile equipment to identify and correct the direction and the position of the two-dimensional code.
The generation logic of the first preset data is as follows:
constructing a digital twin model for the first character sequence, and generating a first twin character sequence according to the digital twin model;
performing character exclusive or encryption on the first character sequence to generate a first encrypted character sequence;
constructing a character sequence-encrypted character sequence bipartite graph for a first twin character sequence and the first encrypted character sequence; and obtaining matching data between the first twin character sequence and the first encrypted character sequence according to a character sequence-encrypted character sequence bipartite graph, and defining the matching data as the first preset data.
The processing logic of the character sequence-encrypted character sequence bipartite graph is as follows:
the character sequence-encrypted character sequence bipartite graph modeling is represented as g= (V, S, E), where V represents the first set of twinned character sequencesS represents the first encryption character sequence set, m first twin character sequences and n first encryption character sequences are shared, E represents a set of optional links between the first twin character sequences and the first encryption character sequences, the optional links are edges e= (V, S) in a bipartite graph, E, V E V, S E S, each optional link has a weight value l m,n Selecting the maximum weight value l m,n And carrying out digital association between the first character sequence and the first encryption character sequence through the matching data as matching data of the optional link.
S4: marking the character sequence of the product two-dimensional code corresponding to the data error correction graphic area 7 as a second character sequence; encrypting the data of the second character sequence to generate first encrypted data; normalizing the first encrypted data to generate second encrypted data;
what needs to be explained here is: and encrypting the data of the product two-dimensional code character sequence corresponding to the data error correction graphic area 7, encrypting the data by using a symmetrical or asymmetrical encryption algorithm, and decrypting the data only by a user with a secret key.
The generation logic of the second encrypted data is as follows:
converting the second character sequence into binary numbers through a QR coding mode, packaging the coded data stream into a data group according to 4 bits, supplementing 0, forming a binary data stream, and preparing for subsequent error correction code generation;
sequentially filling the binary data stream into X arrays, sequentially performing exclusive-or encryption on the obtained X arrays to form first encrypted data;
and carrying out normalization processing on the first encrypted data to form second encrypted data.
The processing of the second encrypted data further includes the steps of:
setting a communication confirmation signature for the second encrypted data, wherein the communication confirmation signature comprises a shared dynamic key and a digital signature;
the shared dynamic key is a random signature key generated by a server, and the digital signature is a digital signature key with an identity authenticated by the server;
the server is a two-dimension code application server.
What needs to be explained here is: the use of digital signatures is one way to prevent tampering and verify the integrity of data. When the two-dimensional code is generated, the integrity of the two-dimensional code can be ensured by using the digital signature, and the two-dimensional code is prevented from being tampered or copied.
S5: embedding the second encrypted data and the first preset data into the first encrypted image to obtain a two-dimensional code after fusing the images.
What needs to be explained here is: the multipoint fusion anti-cracking encryption method is a common encryption technology and aims to improve the safety and confidentiality of data. The basic principle is that a plurality of secret keys are combined together to increase the complexity and difficulty of the password, so that a cracker cannot easily crack the encrypted data.
However, the current multi-point fusion anti-cracking encryption method cannot completely guarantee the security of data. It is still possible for a cracker to crack the encrypted data using other means, and thus it is also necessary to secure the data in combination with other security measures.
Embedding the character sequence of the second encrypted data and the first preset data into the first encrypted image to obtain a two-dimensional code after fusing the images, wherein the two-dimensional code comprises the following fusing steps:
analyzing a first encrypted image to generate a first encrypted image sequence, converting the first encrypted image sequence into a first encrypted image binary data stream in a QR (quick response) coding mode, packaging the first encrypted image binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized first encrypted image binary data stream;
analyzing the second encrypted data to generate a second encrypted character sequence, converting the second encrypted character sequence into a second encrypted binary data stream by a QR (quick response) coding mode, packaging the second encrypted binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized second encrypted binary data stream;
analyzing first preset data to generate a first preset character sequence, converting the first preset character sequence into a first preset binary data stream in a QR (quick response) coding mode, packaging the first preset binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized first preset binary data stream;
adding the second encrypted binary data stream and the first preset binary data stream into the first encrypted image binary data stream according to binary addition to generate a second target binary data stream;
and converting the second target binary data stream to generate a second target character sequence, and generating a two-dimensional code after the fusion image is obtained through the second target character sequence.
What needs to be explained here is: the first encrypted image, the second encrypted data and the first preset data can be fused to generate a two-dimensional code after the fusion image, so that hidden transmission of the encrypted data in the two-dimensional code is realized.
The processing logic of the first encrypted image binary data stream, the second encrypted binary data stream and the first preset binary data stream about the binary data stream is:
dividing each 4 bits in a binary data stream into an array and using polynomialsExpression, polynomial->Index of q>Representing the corresponding array position in the binary data stream, coefficient +.>Decimal data corresponding to each array position is represented;
wherein q is a placeholder in the polynomial expression, and concretely represents an unknown number, an index p of q represents an array position corresponding to an array in a binary data stream, and a coefficient of qIndicate->The decimal data corresponding to the array of the numbers,the value of (2) is in the range of 0 to 15;
wherein:、/>、/>and->A binary number corresponding to four bits, namely 0 or 1,、/>、/>and->The positions of the binary numbers in the array are represented in ascending order, namely k1=1, k2=2, k3=3, and k4=4.
Specifically, each binary digit of 4 bits is converted into a decimal number, and then the decimal numbers are used as corresponding coefficients in the polynomial, and the indexes represent the corresponding array positions, so that the polynomial expression can be obtained.
For example, assume that there is one binary data stream: 10110111001010 it is divided into groups of 4 bits, resulting in: 101101110010 1000. Each set of binary digits is then converted to decimal digits, yielding 11,7,2 and 8. Taking the numbers as coefficients of polynomials, and the indexes represent the corresponding array positions, the following polynomial expression is obtained:
the index of the polynomial represents the corresponding array position in the binary data stream, and the coefficient represents the decimal data corresponding to each array position. In polynomialsRepresenting unknowns, being placeholders in polynomial expressions, ++>The exponent p of (2) represents the corresponding array position of the array in the binary data stream, i.e. the number of times of the term, the coefficient +.>Representing the coefficients of the term.
It should be noted that, as used herein, a decimal number represents a value corresponding to each group of positions, not a binary number. This is because coefficients of polynomials are typically represented using decimal numbers, while exponents are typically represented using natural numbers, unlike binary numbers.
What needs to be explained here is: in the above method used in performing the binary addition, the coefficient of each term in the polynomialFor the decimal data corresponding to the array, the decimal data is obtained by the rule that 4 binary digits are converted into decimal digits through binary conversionTaking, each coefficient->The range of the value of (2) is an integer between 0 and 15, so that binary data stream can be converted into decimal polynomial, and addition operation is convenient.
Example 2
In this embodiment, the details of which are not described in detail in embodiment 1, this embodiment provides a multipoint fusion anti-cracking encryption method applied to two-dimensional codes, where the generating logic of the first preset data is as follows:
constructing a digital twin model for the first character sequence, and generating a first twin character sequence according to the digital twin model;
performing character exclusive or encryption on the first character sequence to generate a first encrypted character sequence;
and fitting the first encrypted character sequence by using a least square method curve to obtain an edge fitting line, so as to obtain an edge fitting line of the first encrypted character sequence, and defining the matching data as the first preset data by using the edge fitting line of the first encrypted character sequence and an edge line corresponding to the first twin character sequence in the two-dimensional code digital twin model to obtain the matching data of the first encrypted character sequence in the two-dimensional code digital twin model.
The difference from example 1 is that: constructing a character sequence-encrypted character sequence bipartite graph for a first twin character sequence and the first encrypted character sequence; obtaining matching data between the first twin character sequence and the first encrypted character sequence, more precisely matching between points, according to a character sequence-encrypted character sequence bipartite graph; according to the embodiment, the line is fitted through the edges, and the first preset data are more accurate through data matching between the lines.
The above formulas are all formulas with dimensionality removed and numerical calculation, the formulas are formulas with the latest real situation obtained by software simulation through collecting a large amount of data, and preset parameters and threshold selection in the formulas are set by those skilled in the art according to the actual situation.
The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product comprises one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the processes or functions described in accordance with embodiments of the present invention are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website site, computer, server, or data center to another website site, computer, server, or data center over a wired network or a wireless network. The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more sets of available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. The semiconductor medium may be a solid state disk.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely one, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Finally: the foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (8)

1. The multipoint fusion anti-cracking encryption method applied to the two-dimensional code is characterized by comprising the following steps of:
s1: acquiring a two-dimensional code character sequence of a product, establishing a corresponding relation between the two-dimensional code character sequence of the product and original information points of a two-dimensional code, and generating a target image according to the corresponding relation between the original information points of the two-dimensional code, wherein the target image comprises a blank graphic area (1), a position detection graphic area (2), a positioning graphic area (3), a format information graphic area (4), a version information graphic area (5), a correction graphic area (6) and a data error correction graphic area (7);
s2: encrypting the target image to generate a first encrypted image;
s3: marking the character sequence of the product two-dimensional code corresponding to the correction pattern area (6) as a first character sequence, and performing data preprocessing on the first character sequence to generate first preset data;
s4: marking the character sequence of the product two-dimensional code corresponding to the data error correction graphic area (7) as a second character sequence; encrypting the data of the second character sequence to generate first encrypted data; normalizing the first encrypted data to generate second encrypted data;
s5: embedding the second encrypted data and the first preset data into the first encrypted image to obtain a two-dimensional code after fusing the images;
respectively generating a first encrypted image sequence, a second encrypted character sequence and a first preset character sequence by analyzing the first encrypted image, the second encrypted data and the first preset data, and respectively converting the generated first encrypted image sequence, the generated second encrypted character sequence and the generated first preset character sequence into a first encrypted image binary data stream, a second encrypted binary data stream and a first preset binary data stream by a QR (quick response) coding mode;
adding the second encrypted binary data stream and the first preset binary data stream into the first encrypted image binary data stream according to binary addition to generate a second target binary data stream;
and converting the second target binary data stream to generate a second target character sequence, and generating a two-dimensional code after the fusion image is obtained through the second target character sequence.
2. The multipoint fusion anti-cracking encryption method applied to two-dimensional codes according to claim 1, wherein the generation logic of the first encrypted image is as follows:
acquiring a pixel gray matrix of the target imageWherein->,/>For the pixel gray values in said pixel gray matrix, is->Is an integer from 0 to 255, ">For the matrix number of the pixel gray matrix, for>For the matrix column number of the pixel gray matrix, < >>、/>Each pixel gray value is an integer greater than or equal to 1, and each pixel gray value has a corresponding weight value;
matrix the pixel gray scalePixel gray value +.>And a preset two-dimensional code pixel gray level threshold intervalComparing, wherein->
If it isThe corresponding pixel gray value +.>The weight value of (2) is assigned as B+2; if it isThe corresponding pixel gray value +.>The weight value of (2) is assigned as B+1; if->The corresponding pixel gray value +.>Is assigned a weight value of 0; wherein B is a constant greater than or equal to 0;
gray value of pixelNormalization processing is performed, and the pixel gray value of the normalization processing is +.>And multiplying the first encrypted image by the corresponding weight value respectively, thereby generating the first encrypted image.
3. The multipoint fusion anti-cracking encryption method applied to the two-dimensional code according to claim 2, wherein the generating logic of the first preset data is as follows:
constructing a digital twin model for the first character sequence, and generating a first twin character sequence according to the digital twin model;
performing character exclusive or encryption on the first character sequence to generate a first encrypted character sequence;
constructing a character sequence-encrypted character sequence bipartite graph for a first twin character sequence and the first encrypted character sequence; and obtaining matching data between the first twin character sequence and the first encrypted character sequence according to a character sequence-encrypted character sequence bipartite graph, and defining the matching data as the first preset data.
4. The multipoint fusion anti-cracking encryption method applied to two-dimensional codes according to claim 3, wherein the processing logic of the character sequence-encrypted character sequence bipartite graph is as follows:
the character sequence-encrypted character sequence bipartite graph modeling is expressed as G= (V, S, E), wherein V represents the first twin character sequence set, S represents the first encrypted character sequence set, m first twin character sequences and n first encrypted character sequences are shared, E represents a set of selectable links between the first twin character sequences and the first encrypted character sequences, the selectable links are edges e= (V, S), E, V E V, S E S in the bipartite graph, and each selectable link has a weight l m,n Selecting the maximum weight value l m,n And carrying out digital association between the first character sequence and the first encryption character sequence through the matching data as matching data of the optional link.
5. The multipoint fusion anti-cracking encryption method applied to the two-dimensional code according to claim 4, wherein the generation logic of the second encrypted data is as follows:
converting the second character sequence into binary numbers through a QR coding mode, packaging the coded data stream into a data group according to 4 bits, and supplementing less than 0 to form a binary data stream;
sequentially filling the binary data stream into X data groups, and sequentially performing exclusive-or encryption on the filled X data groups to form first encrypted data;
and carrying out normalization processing on the first encrypted data to form second encrypted data.
6. The multipoint fusion anti-cracking encryption method applied to two-dimensional codes according to claim 5, wherein the processing of the second encrypted data further comprises the following steps:
setting a communication confirmation signature for the second encrypted data, wherein the communication confirmation signature comprises a shared dynamic key and a digital signature;
the shared dynamic key is a random signature key generated by a server, and the digital signature is a digital signature key with an identity authenticated by the server;
the server is a two-dimension code application server.
7. The multipoint fusion anti-cracking encryption method applied to the two-dimensional code according to claim 6, wherein the character sequence of the second encrypted data and the first preset data is embedded into the first encrypted image, and the two-dimensional code after the image fusion is obtained comprises the following fusion steps:
analyzing a first encrypted image to generate a first encrypted image sequence, converting the first encrypted image sequence into a first encrypted image binary data stream in a QR (quick response) coding mode, packaging the first encrypted image binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized first encrypted image binary data stream;
analyzing the second encrypted data to generate a second encrypted character sequence, converting the second encrypted character sequence into a second encrypted binary data stream by a QR (quick response) coding mode, packaging the second encrypted binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized second encrypted binary data stream;
analyzing first preset data to generate a first preset character sequence, converting the first preset character sequence into a first preset binary data stream in a QR (quick response) coding mode, packaging the first preset binary data stream into a group of 4 bits, supplementing less than 0, and generating a standardized first preset binary data stream;
adding the second encrypted binary data stream and the first preset binary data stream into the first encrypted image binary data stream according to binary addition to generate a second target binary data stream;
and converting the second target binary data stream to generate a second target character sequence, and generating a two-dimensional code after the fusion image is obtained through the second target character sequence.
8. The multipoint fusion anti-cracking encryption method applied to two-dimensional codes according to claim 7, wherein processing logic of the first encrypted image binary data stream, the second encrypted binary data stream and the first preset binary data stream about binary data streams is:
dividing each 4 bits in a binary data stream into an array and using polynomialsExpression, polynomial->Index of q>Representing the corresponding array position in the binary data stream, coefficient +.>Decimal data corresponding to each array position is represented;
wherein q is a placeholder in the polynomial expression, and concretely represents an unknown number, an index p of q represents an array position corresponding to an array in a binary data stream, and a coefficient of qIndicate->Decimal data corresponding to the array of the numbers, +.>The value of (2) is in the range of 0 to 15;
wherein:、/>、/>and->Binary numbers corresponding to four bits, i.e. 0 or 1, respectively>、/>、/>And->The positions of the binary numbers in the array are represented in ascending order, namely k1=1, k2=2, k3=3, and k4=4.
CN202310582963.6A 2023-05-23 2023-05-23 Multi-point fusion anti-cracking encryption method applied to two-dimensional code Active CN116320200B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310582963.6A CN116320200B (en) 2023-05-23 2023-05-23 Multi-point fusion anti-cracking encryption method applied to two-dimensional code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310582963.6A CN116320200B (en) 2023-05-23 2023-05-23 Multi-point fusion anti-cracking encryption method applied to two-dimensional code

Publications (2)

Publication Number Publication Date
CN116320200A CN116320200A (en) 2023-06-23
CN116320200B true CN116320200B (en) 2023-08-11

Family

ID=86815348

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310582963.6A Active CN116320200B (en) 2023-05-23 2023-05-23 Multi-point fusion anti-cracking encryption method applied to two-dimensional code

Country Status (1)

Country Link
CN (1) CN116320200B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102194115A (en) * 2010-03-18 2011-09-21 富士通株式会社 Image processing apparatus and image processing method
JP2016006945A (en) * 2014-05-29 2016-01-14 健一 先名 Digital signature two-dimensional code generation device, and digital signature two-dimensional code authentication device
CN107563475A (en) * 2017-07-18 2018-01-09 中国农业大学 A kind of coding method of Quick Response Code and device
CN110991589A (en) * 2019-12-09 2020-04-10 李蕴光 Two-dimensional code and encryption method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102194115A (en) * 2010-03-18 2011-09-21 富士通株式会社 Image processing apparatus and image processing method
JP2016006945A (en) * 2014-05-29 2016-01-14 健一 先名 Digital signature two-dimensional code generation device, and digital signature two-dimensional code authentication device
CN107563475A (en) * 2017-07-18 2018-01-09 中国农业大学 A kind of coding method of Quick Response Code and device
CN110991589A (en) * 2019-12-09 2020-04-10 李蕴光 Two-dimensional code and encryption method thereof

Also Published As

Publication number Publication date
CN116320200A (en) 2023-06-23

Similar Documents

Publication Publication Date Title
JP6961705B2 (en) Composite 2D barcode generation, readers and methods
TWI670621B (en) Information encryption and decryption method and device
RU2263407C2 (en) Data protection method
CN111314069B (en) Block chain-based shaking system and method, electronic device and storage medium
CN106650869B (en) Information hiding method based on two-dimensional code
CN108229596A (en) Combined two-dimension code, digital certificates carrier, generation, reading device and method
CN104376356A (en) Two-dimensional code generating method with encryption function
CN102609890A (en) Image digital watermark embedding and detecting system
CN102656840A (en) System and method for securing media content
CN112632475B (en) Picture copyright protection system and method based on national password and picture steganography
CN109033766A (en) Database water mark method based on local difference privacy
CN107846530A (en) Digital watermarking algorithm
CN103259621A (en) Encoding method and device of colorized three-dimensional codes and application method and system of colorized three-dimensional codes
CN114915809A (en) Video file copyright protection method and transaction method based on block chain
CN101442671B (en) Method and apparatus for embedding and extracting digital information
CN116320200B (en) Multi-point fusion anti-cracking encryption method applied to two-dimensional code
Koley et al. A novel approach of secret message passing through text steganography
CN104573781A (en) Encoding and decoding method of two-dimensional code
CN114078071A (en) Image tracing method, device and medium
CN109635905B (en) Two-dimensional code generation method, device and system
Mandal et al. A mathematical model for secret message passing using Steganography
US20160189015A1 (en) Data exchange methods, systems and apparatus using color images
Wang et al. Security Mechanism Improvement for 2D Barcodes using Error Correction with Random Segmentation
CN115334317B (en) Information processing method, device and equipment
CN115952481B (en) Method for realizing trusted real name authentication

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