WO2019095170A1 - Two-dimensional code generation method, two-dimensional code decoding method, and terminal - Google Patents

Two-dimensional code generation method, two-dimensional code decoding method, and terminal Download PDF

Info

Publication number
WO2019095170A1
WO2019095170A1 PCT/CN2017/111211 CN2017111211W WO2019095170A1 WO 2019095170 A1 WO2019095170 A1 WO 2019095170A1 CN 2017111211 W CN2017111211 W CN 2017111211W WO 2019095170 A1 WO2019095170 A1 WO 2019095170A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
dimensional code
encoded
target
authentication information
Prior art date
Application number
PCT/CN2017/111211
Other languages
French (fr)
Chinese (zh)
Inventor
谢宁
陈昌盛
谭杰
Original Assignee
深圳大学
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 深圳大学 filed Critical 深圳大学
Priority to PCT/CN2017/111211 priority Critical patent/WO2019095170A1/en
Publication of WO2019095170A1 publication Critical patent/WO2019095170A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • 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

Definitions

  • the present invention relates to the field of information technology, and in particular, to a two-dimensional code generation method, a two-dimensional code decoding method, and a terminal.
  • the two-dimensional code records the data symbol information in a black and white pattern distributed in a plane by a certain geometry according to a certain rule.
  • Traditional QR codes are easily copied by illegal users after they are printed.
  • the two-dimensional code on the product carries the genuine or genuine verification information of the commodity information and the commodity, and if the illegal user scans and prints the two-dimensional code of the commodity and prints it on the counterfeit and shoddy commodity, the user scans the fake and shoddy commodity.
  • the QR code also does not recognize whether the item is genuine. It can be seen that the security of the current two-dimensional code is easily scanned and copied, and the security of the two-dimensional code is low.
  • the embodiment of the invention discloses a two-dimensional code generation method, a two-dimensional code decoding method and a terminal, which can improve the security of the two-dimensional code.
  • a first aspect of the embodiment of the present invention discloses a method for generating a two-dimensional code, comprising: preparing original information and authentication information different from the original information, wherein a capacity of the authentication information is smaller than a predetermined ratio of a capacity of the original information; Embedding the authentication information in the original information to obtain target information; modulating the target information to obtain a target bitstream; and converting the target bitstream into a two-dimensional code image according to a preset generation algorithm.
  • a second aspect of the embodiments of the present invention discloses a two-dimensional code decoding method, including: capturing a two-dimensional code image, performing image restoration on the two-dimensional code image, and obtaining a restored two-dimensional code image; according to a preset bit stream Generating an algorithm to convert the restored two-dimensional code image into a target bit stream; demodulating the target bit stream to obtain target encoding information; and extracting an encoded original letter from the target encoding information And decoding the original information by using a first decoding manner to obtain original information; extracting the encoded authentication information from the target encoded information, and decoding the encoded authentication information by using a second decoding manner to obtain the authentication information.
  • a third aspect of the embodiments of the present invention discloses a terminal, including: a first coding unit, configured to encode original information by using a first coding manner, to obtain coded original information; and a second coding unit, configured to use a second coding mode
  • the authentication information is encoded to obtain the encoded authentication information, where the first encoding mode is different from the second encoding mode
  • the embedding unit is configured to embed the encoding authentication information into the encoding original information to obtain target encoding information.
  • a modulating unit configured to modulate the target encoding information to obtain a target bit stream
  • a converting unit configured to convert the target bit stream into a two-dimensional code according to a preset two-dimensional code generating algorithm.
  • a fourth aspect of the present invention discloses a terminal, including: a scan recovery unit, configured to scan a two-dimensional code image, perform image restoration on the two-dimensional code image, and obtain a restored two-dimensional code image; Converting the restored two-dimensional code image into a target bit stream according to a preset bit stream generation algorithm; and demodulating means for demodulating the target bit stream to obtain target coded information; the first decoding unit For extracting the original information from the target encoding information, decoding the original encoding information by using a first decoding manner to obtain original information, and second decoding unit, configured to extract encoding authentication from the target encoding information. The information is decoded by using the second decoding method to obtain the authentication information.
  • a fifth aspect of the embodiments of the present invention discloses a method for generating a two-dimensional code, comprising: encoding an original information by using a first encoding manner to obtain encoded original information; and encoding the authentication information by using a second encoding manner to obtain encoded authentication information,
  • the first encoding mode is different from the second encoding mode;
  • the encoding authentication information is embedded in the encoding original information to obtain target encoding information; and the target encoding information is modulated to obtain a target bitstream;
  • the authentication bit stream is embedded in the original bit stream to obtain a target bit stream; and the target bit stream is converted into a two-dimensional code image according to a preset two-dimensional code generation algorithm.
  • the original information is encoded by using the first coding manner to obtain a coding original.
  • the first information is used to encode the authentication information to obtain the encoded authentication information;
  • the encoded authentication information is embedded in the encoded original information to obtain the target encoded information; and
  • the target encoded information is modulated to obtain a target bit stream;
  • the two-dimensional code generation algorithm converts the target bit stream into a two-dimensional code image. Since the coded authentication information is embedded in the coded original information, the two-dimensional code image carries the authentication information.
  • the two-dimensional code image When the two-dimensional code image is scanned and copied, more noise is introduced, so that the copied two-dimensional code image cannot be used, so implementation In the embodiment of the present invention, the two-dimensional code can be prevented from being illegally copied, and the security of the two-dimensional code is improved.
  • FIG. 1 is a schematic flow chart of a method for generating a two-dimensional code according to an embodiment of the present invention
  • FIG. 2 is a schematic flow chart of another method for generating a two-dimensional code according to an embodiment of the present invention
  • FIG. 3 is a schematic flow chart of a method for decoding a two-dimensional code according to an embodiment of the present invention
  • FIG. 4 is a schematic flowchart of a two-dimensional code decoding method according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of another terminal according to an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of still another terminal according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a mobile terminal according to an embodiment of the present invention.
  • Embodiments of the present invention disclose a two-dimensional code generation method, a two-dimensional code decoding method, and a terminal, which can improve the security of a two-dimensional code. The details are described below separately.
  • FIG. 1 is a schematic flowchart diagram of a method for generating a two-dimensional code according to an embodiment of the present invention. As shown in FIG. 1, the two-dimensional code generation method includes the following steps.
  • Step 101 The terminal encodes the original information by using a first coding manner to obtain coded original information.
  • the original information may be information input by the user, for example, a character string, a web address, or the like.
  • the first coding mode may be Reed-Solomon (RS) coding, which is a forward error correction channel coding, which is valid for polynomials generated by correcting oversampled data.
  • RS Reed-Solomon
  • the RS code has strong anti-interference and anti-noise ability and has strong error correction capability.
  • the original information can be decoded using the RS decoding method.
  • the obtained encoded original information may be a binary bit stream composed of "0" and "1".
  • Step 102 The terminal encodes the authentication information by using the second coding mode to obtain the coded authentication information, where the first coding mode is different from the second coding mode.
  • the second coding mode may be BCH (Bose, Ray-Chaudhuri Hocquenghem) coding
  • the BCH coding is multi-level, cyclic, error correction, variable length digital coding for correcting multiple random error modes.
  • BCH coding can also be used for multi-level phase shift keying at the power level or prime level. Compared with RS coding, the anti-interference and anti-noise ability of BCH coding is weaker, and the error correction capability of BCH coding is worse than that of RS coding.
  • the obtained encoding authentication information may be a binary bit stream composed of "0" and "1".
  • the authentication information may be a character string, a binary bit stream, or the like, and the authentication information may be used to authenticate the authenticity of the two-dimensional code.
  • the authentication information may be anti-counterfeiting verification information in a two-dimensional code on the commodity.
  • the capacity of the authentication information is smaller than the error correction capacity of the two-dimensional code.
  • the error correction capacity of the two-dimensional code is related to the coding mode of the two-dimensional code. For example, for QS, the error correction capacity can reach 30% of the original information capacity. In some examples, optionally, the capacity of the authentication information is less than 30% of the capacity of the original information.
  • the authentication information when the capacity of the authentication information is less than 30% of the capacity of the original information, in the scanned two-dimensional code image, the authentication information has little influence on the original information, and is within the automatic error correction range of the two-dimensional code. There is no case where the original information cannot be read from the QR code.
  • the capacity of the authentication information is greater than 30% of the capacity of the original information, the authentication information has a greater impact on the original information, which is beyond the automatic error correction range of the two-dimensional code, and may not be able to read the original information from the two-dimensional code. happensing.
  • the authentication information may not need to be encoded.
  • the authentication information itself is a binary bit stream composed of “0” and “1”
  • no encoding is needed.
  • the second encoding method is to change "0" in the authentication information to "0", and "1” to "1", that is, equivalent to no encoding.
  • step 101 and step 102 in the embodiment of the present invention may be reversed. Steps 101 and 102 can also be performed simultaneously.
  • Step 103 The terminal embeds the encoded authentication information into the encoded original information to obtain target encoding information.
  • the terminal may embed the coded authentication information into the code original information.
  • Both the encoded authentication information and the encoded original information are binary bit streams.
  • the encoded authentication information is much smaller than the encoded original information, for example, the encoded authentication information is less than 30% of the encoded original information.
  • the encoding authentication information is 100 bits
  • the encoding original information is 1000 bits
  • the size of the finally obtained target encoding information is between 1000 and 1100 bits.
  • the terminal randomly embeds the coding authentication information into the original information to obtain the target coding information.
  • the terminal may insert the coded authentication information into the coded original information according to an embedded policy. For example, the terminal may randomly insert each bit in the encoded authentication information into the encoded original information to obtain target encoded information. For another example, the terminal may randomly insert the entire encoded authentication information into the encoded original information. If the encoding authentication information is 100 bits, the encoding original information is 1000. The size of the resulting target encoded information is 1100 bits.
  • the terminal replaces part of the information in the original information with the coded authentication information to obtain target coded information.
  • the terminal may select a bit number equal to the size of the coded authentication information in the original code information, and replace the selected bit number with the coded authentication information to obtain the target coded information. For example, if the encoding authentication information is 100 bits and the encoding original information is 1000 bits, the terminal can select 100 bits from the encoding original information, and replace the 100 bits with the encoding authentication information to obtain 1000-bit target encoding information.
  • Step 104 The terminal modulates the target coding information to obtain a target bit stream.
  • the terminal may modulate the target coding information by using a Quadrature Amplitude Modulation modulation method to obtain a target bit stream.
  • the target bit stream may be a bit stream consisting of "0", "1", "-1”.
  • a target bit stream suitable for channel transmission is obtained, so that the target bit stream is transmitted in the channel.
  • Step 105 The terminal converts the target bit stream into a two-dimensional code image according to a preset two-dimensional code generation algorithm.
  • the terminal modulates the target coding information to obtain a target bit stream, and then converts the target bit stream into a two-dimensional code image according to a preset two-dimensional code generation algorithm.
  • the terminal may respectively correspond to “0”, “1”, “-1” in the target bitstream to different grayscale image pixels, and according to “0”, “1”, “-1” in the target bitstream.
  • the position in the target bitstream corresponds to the pixel location in the two-dimensional code image.
  • the two-dimensional code image carries the authentication information. Since the authentication information is small, when the two-dimensional code image is scanned and copied, the noise generated by the authentication information is relatively large, resulting in the copied two-dimensional code image. The authentication information is easily lost, and the copied two-dimensional code image cannot be used. Therefore, the embodiment of the present invention can prevent the two-dimensional code from being illegally copied and improve the security of the use of the two-dimensional code.
  • FIG. 2 is a schematic flowchart diagram of another method for generating a two-dimensional code according to an embodiment of the present invention. As shown in FIG. 2, the two-dimensional code generating method includes the following steps.
  • Step 201 The terminal encodes the original information by using a first coding manner to obtain coded original information.
  • the original information may be information input by the user, for example, a character string, a web address, or the like.
  • the first coding mode may be RS coding, which is a forward error correction channel coding, which is valid for a polynomial generated by correcting oversampled data.
  • the RS code has strong anti-interference and anti-noise ability and has strong error correction capability.
  • Step 202 The terminal modulates the original information to obtain an original bit stream.
  • the terminal may modulate the original information by using a Quadrature Amplitude Modulation modulation method to obtain an original bit stream.
  • the original bit stream may be a bit stream consisting of "0", "1", "-1”.
  • a raw bit stream suitable for channel transmission is obtained so that the original bit stream is transmitted in the channel.
  • Step 203 The terminal encodes the authentication information by using the second coding mode to obtain the coded authentication information, where the first coding mode is different from the second coding mode.
  • the second coding mode may be BCH (Bose, Ray-Chaudhuri Hocquenghem) coding
  • the BCH coding is multi-level, cyclic, error correction, variable length digital coding for correcting multiple random error modes.
  • BCH coding can also be used for multi-level phase shift keying at the power level or prime level. Compared with RS coding, the anti-interference and anti-noise ability of BCH coding is weaker, and the error correction capability of BCH coding is worse than that of RS coding.
  • BCH is decoded, when the number of occurrences of the error exceeds the preset number of bits, the decoding fails and the authentication information cannot be decoded.
  • the obtained encoded original information may be a binary ratio consisting of “0” and “1”. Special flow.
  • the capacity of the authentication information is smaller than the error correction capacity of the two-dimensional code.
  • the error correction capacity of the two-dimensional code is related to the coding mode of the two-dimensional code. For example, for QS, the error correction capacity can reach 30% of the original information capacity. In some examples, optionally, the capacity of the authentication information is less than 30% of the capacity of the original information.
  • the authentication information when the capacity of the authentication information is less than 30% of the capacity of the original information, in the scanned two-dimensional code image, the authentication information has little influence on the original information, and is within the automatic error correction range of the two-dimensional code. There is no case where the original information cannot be read from the QR code.
  • the capacity of the authentication information is greater than 30% of the capacity of the original information, the authentication information has a greater impact on the original information, which is beyond the automatic error correction range of the two-dimensional code, and may not be able to read the original information from the two-dimensional code. happensing.
  • the authentication information may not need to be encoded.
  • the authentication information itself is a binary bit stream composed of “0” and “1”
  • no encoding is needed.
  • the second encoding method is to change "0" in the authentication information to "0", and "1” to "1", that is, equivalent to no encoding.
  • Step 204 The terminal modulates the encoded authentication information to obtain an authentication bitstream.
  • the terminal may modulate the encoded authentication information by using a Quadrature Phase Shift Keying (QPSK) modulation method to obtain an authentication bit stream.
  • QPSK modulation the authentication bitstream may be a bitstream consisting of "0", "1", "-1”.
  • an authentication bitstream suitable for channel transmission is obtained to authenticate the bitstream for transmission in the channel.
  • step 201, step 202, and step 203 and step 204 may be reversed.
  • step 203 and step 204 may be performed first, and then step 201 and step 202 may be performed.
  • step 201 and step 202 are performed simultaneously with steps 203 and 204.
  • Step 205 The terminal embeds the authentication bit stream into the original bit stream to obtain a target bit stream.
  • the terminal may embed the authentication bit stream into the original bit stream.
  • Both the authentication bit stream and the original bit stream are binary bit streams.
  • the authentication bit stream is much smaller than the original The bitstream, for example, the authentication bitstream is less than 30% of the original bitstream.
  • the authentication bit stream is 100 bits
  • the original bit stream is 1000 bits
  • the resulting target bit stream has a size between 1000 and 1100 bits.
  • the terminal randomly embeds the authentication bit stream into the original bit stream to obtain a target bit stream.
  • the terminal may randomly insert the authentication bit stream into the original bit stream.
  • the terminal can randomly insert each bit in the authentication bitstream into the original bitstream to obtain a target bitstream.
  • the terminal can randomly insert the authentication bit stream into the original bit stream as a whole. If the authentication bit stream is 100 bits and the original bit stream is 1000 bits, the resulting target bit stream has a size of 1100 bits.
  • the terminal replaces part of the information in the original bitstream with the authentication bitstream to obtain a target bitstream.
  • the terminal may select a bit number equal to the size of the authentication bit stream in the original bit stream, and replace the selected bit number with the authentication bit stream to obtain a target bit stream. For example, if the authentication bit stream is 100 bits and the original bit stream is 1000 bits, the terminal can select 100 bits from the original bit stream, and replace the 100 bits with the authentication bit stream to obtain a 1000 bit target bit stream.
  • Step 206 The terminal converts the target bit stream into a two-dimensional code image according to a preset two-dimensional code generation algorithm.
  • the terminal embeds the authentication bit stream into the original bit stream, and after obtaining the target bit stream, the target bit stream may be converted into the two-dimensional code image according to a preset two-dimensional code generation algorithm. Specifically, the terminal may respectively correspond to “0”, “1”, “-1” in the target bitstream to different grayscale image pixels, and according to “0”, “1”, “-1” in the target bitstream. The position in the target bitstream corresponds to the pixel location in the two-dimensional code image.
  • the two-dimensional code image carries the authentication information. Since the authentication information is small, when the two-dimensional code image is scanned and copied, the noise generated by the authentication information is relatively large, resulting in duplicated two. The authentication information in the code image is easily lost, and the copied two-dimensional code image cannot be used. Therefore, the embodiment of the present invention can prevent the two-dimensional code from being illegally copied and improve the security of the use of the two-dimensional code.
  • FIG. 3 is a schematic flowchart diagram of a two-dimensional code decoding method according to an embodiment of the present invention.
  • the two-dimensional code decoding method shown in FIG. 3 corresponds to the two-dimensional code generating method shown in FIG. 1.
  • the two-dimensional code decoding method includes the following steps.
  • Step 301 The terminal scans the two-dimensional code image, and performs image recovery on the two-dimensional code image to obtain a restored two-dimensional code image.
  • the terminal scans the two-dimensional code image, performs image recovery on the two-dimensional code image, and obtains the restored two-dimensional code image.
  • a small amount of noise appears in the restored two-dimensional code image compared to the (initial) two-dimensional code image.
  • the information carried by the two-dimensional code image itself is P
  • the information carried by the restored two-dimensional code image is P+P1, wherein P1 is the noise that occurs when the terminal scans the two-dimensional code image, and P1 is relative to P.
  • P1 is smaller than the maximum noise T allowed by the two-dimensional code in the range of fault tolerance (T is related to the size of P, generally, the larger P is, the larger T is), that is, P1 ⁇ T.
  • T is related to the size of P, generally, the larger P is, the larger T is
  • the noise caused by P1 is not enough to affect the information P carried by the two-dimensional code image itself. Since the two-dimensional code itself has a certain fault tolerance, the terminal can still scan from the restored two-dimensional code image to obtain the need.
  • Information original information and authentication information).
  • Step 302 The terminal converts the restored two-dimensional code image into a target bit stream according to a preset bit stream generation algorithm.
  • the terminal scans the two-dimensional code image, performs image recovery on the two-dimensional code image, and obtains the restored two-dimensional code image, and then converts the restored two-dimensional code image according to a preset bit stream generation algorithm.
  • the terminal may correspond the gray values of the pixels at different positions in the restored two-dimensional code image to different bits, and obtain a target bit stream composed of “0”, “1” “-1”.
  • Step 303 The terminal demodulates the target bit stream to obtain target coding information.
  • the terminal can adopt quadrature phase shift keying (Quadrature Phase Shift)
  • QPSK Quadrature Phase Shift
  • the Keying, QPSK modulation method demodulates the target bit stream to obtain the coded information.
  • QPSK modulation a bit stream composed of "0", “1", "-1" in the target bit stream can be demodulated into target coded information of a binary bit stream composed of "0" and "1".
  • Step 304 The terminal extracts the original encoding information from the target encoding information, and decodes the encoded original information by using the first decoding manner to obtain the original information.
  • the terminal may extract the original encoding information from the target encoding information, and decode the encoded original information by using the first decoding manner to obtain the original information. Since the original information is encoded by the first encoding method in the process of generating the two-dimensional code image, the encoded original information is obtained.
  • the first decoding mode corresponds to the first encoding mode. For example, if the first coding mode is RS coding, the first decoding mode is RS decoding. After the original information is decoded by the first decoding method, the original information can be obtained, and the original information can be information input by the user, for example, a character string, a web address, and the like.
  • Step 305 The terminal extracts the encoded authentication information from the target encoding information, and decodes the encoded authentication information by using the second decoding manner to obtain the authentication information.
  • the terminal may extract the encoded authentication information from the target encoding information, and decode the encoded authentication information by using the second decoding manner to obtain the authentication information. Since the authentication information is encoded by the second encoding method in the process of generating the two-dimensional code image, the encoded authentication information is obtained.
  • the second decoding mode corresponds to the second encoding mode. For example, if the second coding mode is BCH coding, the second decoding mode is BCH decoding.
  • the authentication information may be a character string, a binary bit stream, or the like, and the authentication information may be used to authenticate the authenticity of the two-dimensional code. For example, the authentication information may be anti-counterfeiting verification information in a two-dimensional code on the commodity.
  • Step 306 The terminal sends the authentication information to the authentication platform for authentication.
  • the terminal may send the authentication information to the authentication platform for authentication.
  • the user can obtain the authentication information by scanning the two-dimensional code on the product, and send it to the authentication platform to verify the authenticity of the product.
  • QR code images can be printed on a variety of products.
  • the user can scan the two-dimensional code image on the commodity (for example, on the outer packaging of the commodity) through the terminal, and the noise P1 appearing in the process of scanning the two-dimensional code image by the terminal, but P1 is smaller than the maximum allowed in the range of the fault tolerance capability of the two-dimensional code.
  • Security code for example, the website of the company producing the product, the origin of the product, the product logistics information, the product material information, the product manufacturing date, and the like.
  • the QR code image is stolen by illegal molecules (for example, illegal copying), and the QR code image on the genuine product is illegally scanned and printed and printed on the outer packaging of the counterfeit and shoddy goods, the QR code image is illegally scanned and copied.
  • noise P2 will appear, and P2 is much larger than P1.
  • the terminal will appear in the process of scanning the illegally copied two-dimensional code image.
  • the noise P3, P3 and P1 are about the same size.
  • the noise of the QR code image becomes P2+P3, which will cause P2+P3>T, which has exceeded the maximum noise T allowed by the QR code in the fault tolerance range.
  • the user cannot obtain the correct authentication information by scanning the illegally copied two-dimensional code image on the outer package of the counterfeit and shoddy goods, so that the authentication information in the illegally copied two-dimensional code image acquired by the user is easily mistaken or lost, resulting in illegality.
  • the authentication information in the copied QR code image cannot be authenticated, thereby preventing the two-dimensional code from being illegally copied, and the use of the two-dimensional code can be improved. safety.
  • the authentication information in the illegally copied two-dimensional code image is prone to error or loss, and the authentication information in the illegally copied two-dimensional code image cannot pass.
  • the purpose of authentication is to prevent the two-dimensional code from being illegally copied, and the security of the use of the two-dimensional code can be improved.
  • FIG. 4 is a schematic flowchart diagram of a two-dimensional code decoding method according to an embodiment of the present invention.
  • the two-dimensional code decoding method shown in FIG. 4 corresponds to the two-dimensional code generating method shown in FIG. 2.
  • the two-dimensional code decoding method includes the following steps.
  • Step 401 The terminal scans the two-dimensional code image, and performs image recovery on the two-dimensional code image to obtain a restored two-dimensional code image.
  • the terminal scans the two-dimensional code image, performs image recovery on the two-dimensional code image, and obtains the restored two-dimensional code image.
  • a small amount of noise appears in the restored two-dimensional code image compared to the (initial) two-dimensional code image.
  • the information carried by the two-dimensional code image itself is P
  • the information carried by the restored two-dimensional code image is P+P1, wherein P1 is the noise that occurs when the terminal scans the two-dimensional code image, and P1 is relative to P.
  • P1 is smaller than the maximum noise T allowed by the two-dimensional code in the range of fault tolerance (T is related to the size of P, generally, the larger P is, the larger T is), that is, P1 ⁇ T.
  • T is related to the size of P, generally, the larger P is, the larger T is
  • the noise caused by P1 is not enough to affect the information P carried by the two-dimensional code image itself. Since the two-dimensional code itself has a certain fault tolerance, the terminal can still scan from the restored two-dimensional code image to obtain the need.
  • Information original information and authentication information).
  • Step 402 The terminal converts the restored two-dimensional code image into a target bit stream according to a preset bit stream generation algorithm.
  • the terminal scans the two-dimensional code image, performs image recovery on the two-dimensional code image, and obtains the restored two-dimensional code image, and then converts the restored two-dimensional code image according to a preset bit stream generation algorithm.
  • the terminal may correspond the gray values of the pixels at different positions in the restored two-dimensional code image to different bits, and obtain a target bit stream composed of “0”, “1” “-1”.
  • step 403 the terminal extracts the original bit stream and the authentication bit stream from the target bit stream.
  • Step 404 The terminal demodulates the original bit stream to obtain encoded original information, and decodes the original information by using the first decoding manner to obtain original information.
  • the terminal may demodulate the original bit stream to obtain the original information, and decode the original information by using the first decoding manner to obtain original information. Since the original information is encoded by the first encoding method in the process of generating the two-dimensional code image, the encoded original information is obtained.
  • the first decoding mode corresponds to the first encoding mode. For example, if the first coding mode is RS coding, the first decoding mode is RS decoding. After the original information is decoded by the first decoding method, the original information can be obtained, and the original information can be information input by the user, for example, a character string, a web address, and the like.
  • Step 405 The terminal demodulates the authentication bit stream to obtain coded authentication information, and decodes the coded authentication information by using a second decoding mode to obtain authentication information.
  • the terminal may demodulate the authentication bitstream to obtain the encoded authentication information, and decode the encoded authentication information by using the second decoding manner to obtain the authentication information. Since the authentication information is encoded by the second encoding method in the process of generating the two-dimensional code image, the encoded authentication information is obtained.
  • the second decoding mode corresponds to the second encoding mode. For example, if the second coding mode is BCH coding, the second decoding mode is BCH decoding.
  • the authentication information may be a character string, a binary bit stream, or the like, and the authentication information may be used to authenticate the authenticity of the two-dimensional code. For example, the authentication information may be anti-counterfeiting verification information in a two-dimensional code on the commodity.
  • Step 406 The terminal sends the authentication information to the authentication platform for authentication.
  • the terminal may send the authentication information to the authentication platform for authentication.
  • the user can obtain the authentication information by scanning the two-dimensional code on the product, and send it to the authentication platform to verify the authenticity of the product.
  • the authentication information in the illegally copied two-dimensional code image is prone to error or loss, and the authentication information in the illegally copied two-dimensional code image cannot pass.
  • the purpose of authentication is to prevent the two-dimensional code from being illegally copied, and the security of the use of the two-dimensional code can be improved.
  • FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • the terminal includes a first encoding unit 501, a second encoding unit 502, an embedding unit 503, a modulating unit 504, and a converting unit 505, wherein: a first encoding unit 501 is configured to use the first encoding method to The information is encoded to obtain the encoded original information.
  • the second encoding unit 502 is configured to encode the authentication information by using the second encoding method to obtain the encoded authentication information, where the first encoding mode is different from the second encoding mode.
  • the embedding unit 503 is configured to embed the encoding authentication information into the encoding original information to obtain the target encoding information.
  • the modulating unit 504 is configured to modulate the target coding information to obtain a target bit stream.
  • the converting unit 505 is configured to convert the target bit stream into a two-dimensional code according to a preset two-dimensional code generation algorithm.
  • the two-dimensional code image carries the authentication information. Since the authentication information is small, when the two-dimensional code image is scanned and copied, the noise generated by the authentication information is relatively large, resulting in the copied two-dimensional code image. The authentication information is easily lost, and the copied two-dimensional code image cannot be used. Therefore, the embodiment of the present invention can prevent the two-dimensional code from being illegally copied and improve the security of the use of the two-dimensional code.
  • FIG. 6 is a schematic structural diagram of another terminal according to an embodiment of the present invention.
  • the terminal includes a scan recovery unit 601, a conversion unit 602, a demodulation unit 603, a first decoding unit 604, a second decoding unit 605, and a transmission unit 606, where:
  • the scan recovery unit 601 is configured to scan a two-dimensional code image, perform image restoration on the two-dimensional code image, and obtain a restored two-dimensional code image.
  • the converting unit 602 is configured to convert the restored two-dimensional code image into a target bit stream according to a preset bit stream generation algorithm.
  • the demodulation unit 603 is configured to demodulate the target bit stream to obtain target coding information.
  • the first decoding unit 604 is configured to extract the encoded original information from the target encoding information, and decode the encoded original information by using the first decoding manner to obtain original information.
  • the second decoding unit 605 is configured to extract the encoded authentication information from the target encoding information, and decode the encoded authentication information by using the second decoding method to obtain the authentication information.
  • the sending unit 606 is configured to send the authentication information to the authentication platform for authentication.
  • the authentication information in the illegally copied two-dimensional code image is prone to error or loss, and the authentication information in the illegally copied two-dimensional code image cannot pass.
  • the purpose of authentication is to prevent the two-dimensional code from being illegally copied, and the security of the use of the two-dimensional code can be improved.
  • the authentication information in the illegally copied two-dimensional code image is prone to error or loss, and the authentication information in the illegally copied two-dimensional code image cannot pass.
  • the purpose of authentication is to prevent the two-dimensional code from being illegally copied, and the security of the use of the two-dimensional code can be improved.
  • FIG. 7 is a schematic structural diagram of another terminal according to an embodiment of the present invention.
  • the terminal 710 includes a processor 712, a communication interface 713, and a memory 711.
  • terminal 710 can also include a bus 715.
  • the communication interface 713, the processor 712, and the memory 711 may be connected to each other through a bus 715.
  • the bus 715 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (abbreviated). EISA) bus and so on.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the bus 715 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 7, but it does not mean that there is only one bus or one type of bus.
  • FIG. 8 is a schematic structural diagram of a mobile terminal according to an embodiment of the present invention. As shown in FIG. 8 , for the convenience of description, only parts related to the embodiment of the present invention are shown. If the specific technical details are not disclosed, please refer to the method part of the embodiment of the present invention.
  • the mobile terminal can be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, and the mobile terminal is used as a mobile phone as an example:
  • FIG. 8 is a block diagram showing a partial structure of a mobile phone related to a mobile terminal provided by an embodiment of the present invention.
  • the mobile phone includes: a radio frequency (RF) circuit 910 , a memory 920 , an input unit 930 , a display unit 940 , a sensor 950 , an audio circuit 960 , a wireless fidelity (WiFi) module 970 , and a processor 980 . , power supply 990 and camera 9110 and other components.
  • RF radio frequency
  • the structure of the handset shown in FIG. 8 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different component arrangements.
  • the RF circuit 910 can be used for receiving and transmitting information.
  • RF circuit 910 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
  • LNA Low Noise Amplifier
  • RF circuitry 910 can also communicate with the network and other devices via wireless communication.
  • the above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), E-mail, Short Messaging Service (SMS), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • E-mail Short Messaging Service
  • the memory 920 can be used to store software programs and modules, and the processor 980 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 920.
  • the memory 920 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function, and the like; the storage data area may store data created according to usage of the mobile phone, and the like.
  • memory 920 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 930 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function controls of the handset.
  • the input unit 930 can include a fingerprint identification module 931 and other input devices 932.
  • the fingerprint identification module 931 can collect fingerprint data of the user.
  • the input unit 930 may also include other input devices 932.
  • other input devices 932 may include, but are not limited to, one or more of a touch screen, a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 940 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone.
  • the display unit 940 can include a display screen 941.
  • a liquid crystal display (LCD) or an organic light emitting diode (Organic Light-Emitting) can be used.
  • the display screen 941 is configured in the form of Diode, OLED, or the like.
  • the fingerprint recognition module 931 and the display screen 941 function as two separate components to implement the input and input functions of the mobile phone, in some embodiments, the fingerprint recognition module 931 and the display screen 941 can be implemented. Integrated to achieve the input and playback functions of the phone.
  • the handset may also include at least one type of sensor 950, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen 941 according to the brightness of the ambient light, and the proximity sensor may turn off the display screen 941 and/or when the mobile phone moves to the ear. Or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • the mobile phone can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the mobile phone can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, no longer Narration.
  • the gesture of the mobile phone such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration
  • vibration recognition related functions such as pedometer, tapping
  • the mobile phone can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, no longer Narration.
  • An audio circuit 960, a speaker 961, and a microphone 962 can provide an audio interface between the user and the handset.
  • the audio circuit 960 can transmit the converted electrical data of the received audio data to the speaker 961 for conversion to the sound signal by the speaker 961; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal by the audio circuit 960. After receiving, it is converted into audio data, and then processed by the audio data playback processor 980, sent to the other mobile phone via the RF circuit 910, or played back to the memory 920 for further processing.
  • WiFi is a short-range wireless transmission technology
  • the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 970, which provides users with wireless broadband Internet access.
  • FIG. 8 shows the WiFi module 970, it can be understood that it does not belong to the essential configuration of the mobile phone, and may be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 980 is the control center of the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 920, and invoking data stored in the memory 920, executing Mobile phone's various functions and processing data to rival The machine performs overall monitoring.
  • the processor 980 may include one or more processing units; preferably, the processor 980 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
  • the modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 980.
  • the handset also includes a power source 990 (such as a battery) that supplies power to the various components.
  • a power source 990 such as a battery
  • the power source can be logically coupled to the processor 980 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the camera 9110 can perform photographing, photographing, and the like. When scanning the two-dimensional code image, the camera 9110 turns on and scans the two-dimensional code image.
  • the mobile phone may further include a Bluetooth module and the like, and details are not described herein again.
  • each step method flow can be implemented based on the structure of the mobile phone.
  • each unit function can be implemented based on the structure of the mobile phone.
  • the embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes any one of the two-dimensional code generation method and the two-dimensional code decoding method described in the foregoing method embodiments. Some or all of the steps.
  • the disclosed apparatus may be implemented in other ways.
  • the device embodiments described above are merely illustrative, such as The division of the elements is only a logical function division, and the actual implementation may have another division manner. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present invention may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a memory. A number of instructions are included to cause a computer device (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing memory includes: a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and the like, which can store program codes.
  • the invention will be described below with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or FIG.
  • the computer program instructions may be provided to a general purpose computer, a special purpose computer or a processor of other programmable data processing apparatus to produce a machine such that when executed by a processor of a computer or other programmable data processing apparatus Means for implementing the functions/acts specified in one or more of the blocks of the flowcharts and/or block diagrams.
  • the computer program instructions can also be stored in a computer readable medium that causes a computer, other programmable data processing device, or other device to operate in a particular manner, such that instructions stored in the computer readable medium are An article of manufacture that implements the instructions of the functions/actions specified in one or more of the blocks of the flowcharts and/or block diagrams.
  • the computer program instructions can also be loaded onto a computer, other programmable data processing device, or other device to cause a series of operational steps to be performed on a computer, other programmable data processing device or other device to produce computer-implemented processing, thereby
  • the instructions executed on a computer or other programmable device are provided for processing to implement the functions/acts specified in one or more of the blocks of the flowcharts and/or block diagrams.
  • each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable make.
  • the functions noted in the blocks may also occur in a different order than that illustrated in the drawings. For example, two consecutive blocks may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or function. Or it can be implemented by a combination of dedicated hardware and computer instructions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

Disclosed are a two-dimensional code generation method, a two-dimensional code decoding method, and a terminal. The method comprises: encoding original information by using a first encoding mode to obtain encoded original information; encoding authentication information by using a second encoding mode to obtain encoded authentication information, wherein the first encoding mode is different from the second encoding mode; embedding the encoded authentication information into the encoded original information to obtain target encoded information; modulating the target encoded information to obtain a target bit stream; and converting the target bit stream into a two-dimensional code image according to a pre-set two-dimensional code generation algorithm. The implementation of the embodiments of the present invention can improve the security of a two-dimensional code.

Description

二维码生成方法、二维码解码方法以及终端Two-dimensional code generation method, two-dimensional code decoding method and terminal 技术领域Technical field
本发明涉及信息技术领域,尤其涉及一种二维码生成方法、二维码解码方法以及终端。The present invention relates to the field of information technology, and in particular, to a two-dimensional code generation method, a two-dimensional code decoding method, and a terminal.
背景技术Background technique
二维码是用某种特定的几何图形按一定的规律在平面分布的黑白相间的图形记录数据符号信息的。传统的二维码在打印出来之后,容易被非法用户复制。比如,商品上的二维码,其中携带有商品信息和商品的正品或正版验证信息,如果非法用户将该商品的二维码扫描复制并打印在假冒伪劣商品上,则用户扫描假冒伪劣商品上的二维码也无法识别该商品是否为正品。可见,目前的二维码的安全性容易被扫描复制,二维码的安全性较低。The two-dimensional code records the data symbol information in a black and white pattern distributed in a plane by a certain geometry according to a certain rule. Traditional QR codes are easily copied by illegal users after they are printed. For example, the two-dimensional code on the product carries the genuine or genuine verification information of the commodity information and the commodity, and if the illegal user scans and prints the two-dimensional code of the commodity and prints it on the counterfeit and shoddy commodity, the user scans the fake and shoddy commodity. The QR code also does not recognize whether the item is genuine. It can be seen that the security of the current two-dimensional code is easily scanned and copied, and the security of the two-dimensional code is low.
发明内容Summary of the invention
本发明实施例公开了一种二维码生成方法、二维码解码方法以及终端,可以提高二维码的安全性。The embodiment of the invention discloses a two-dimensional code generation method, a two-dimensional code decoding method and a terminal, which can improve the security of the two-dimensional code.
本发明实施例第一方面公开一种二维码生成方法,包括:准备原始信息和与所述原始信息不同的认证信息,其中所述认证信息的容量小于所述原始信息的容量的规定比例;将所述认证信息嵌入于所述原始信息,得到目标信息;对所述目标信息进行调制以得到目标比特流;并且按照预设的生成算法将所述目标比特流转换为二维码图像。A first aspect of the embodiment of the present invention discloses a method for generating a two-dimensional code, comprising: preparing original information and authentication information different from the original information, wherein a capacity of the authentication information is smaller than a predetermined ratio of a capacity of the original information; Embedding the authentication information in the original information to obtain target information; modulating the target information to obtain a target bitstream; and converting the target bitstream into a two-dimensional code image according to a preset generation algorithm.
本发明实施例第二方面公开一种二维码解码方法,包括:拍摄二维码图像,对所述二维码图像进行图像恢复,得到还原后的二维码图像;按照预设的比特流生成算法将所述还原后的二维码图像转换为目标比特流;对所述目标比特流进行解调,得到目标编码信息;从所述目标编码信息中提取编码原始信 息,使用第一解码方式将所述编码原始信息进行解码,得到原始信息;从所述目标编码信息中提取编码认证信息,使用第二解码方式将所述编码认证信息进行解码,得到认证信息。A second aspect of the embodiments of the present invention discloses a two-dimensional code decoding method, including: capturing a two-dimensional code image, performing image restoration on the two-dimensional code image, and obtaining a restored two-dimensional code image; according to a preset bit stream Generating an algorithm to convert the restored two-dimensional code image into a target bit stream; demodulating the target bit stream to obtain target encoding information; and extracting an encoded original letter from the target encoding information And decoding the original information by using a first decoding manner to obtain original information; extracting the encoded authentication information from the target encoded information, and decoding the encoded authentication information by using a second decoding manner to obtain the authentication information.
本发明实施例第三方面公开一种终端,包括:第一编码单元,用于使用第一编码方式将原始信息进行编码,得到编码原始信息;第二编码单元,用于使用第二编码方式将认证信息进行编码,得到编码认证信息,所述第一编码方式与所述第二编码方式不相同;嵌入单元,用于将所述编码认证信息嵌入所述编码原始信息中,得到目标编码信息;调制单元,用于对所述目标编码信息进行调制,得到目标比特流;转换单元,用于按照预设的二维码生成算法将所述目标比特流转换为二维码。A third aspect of the embodiments of the present invention discloses a terminal, including: a first coding unit, configured to encode original information by using a first coding manner, to obtain coded original information; and a second coding unit, configured to use a second coding mode The authentication information is encoded to obtain the encoded authentication information, where the first encoding mode is different from the second encoding mode, and the embedding unit is configured to embed the encoding authentication information into the encoding original information to obtain target encoding information. a modulating unit, configured to modulate the target encoding information to obtain a target bit stream, and a converting unit, configured to convert the target bit stream into a two-dimensional code according to a preset two-dimensional code generating algorithm.
本发明实施例第四方面公开一种终端,包括:扫描恢复单元,用于扫描二维码图像,对所述二维码图像进行图像恢复,得到还原后的二维码图像;转换单元,用于按照预设的比特流生成算法将所述还原后的二维码图像转换为目标比特流;解调单元,用于对所述目标比特流进行解调,得到目标编码信息;第一解码单元,用于从所述目标编码信息中提取编码原始信息,使用第一解码方式将所述编码原始信息进行解码,得到原始信息;第二解码单元,用于从所述目标编码信息中提取编码认证信息,使用第二解码方式将所述编码认证信息进行解码,得到认证信息。A fourth aspect of the present invention discloses a terminal, including: a scan recovery unit, configured to scan a two-dimensional code image, perform image restoration on the two-dimensional code image, and obtain a restored two-dimensional code image; Converting the restored two-dimensional code image into a target bit stream according to a preset bit stream generation algorithm; and demodulating means for demodulating the target bit stream to obtain target coded information; the first decoding unit For extracting the original information from the target encoding information, decoding the original encoding information by using a first decoding manner to obtain original information, and second decoding unit, configured to extract encoding authentication from the target encoding information. The information is decoded by using the second decoding method to obtain the authentication information.
本发明实施例第五方面公开一种二维码生成方法,包括:使用第一编码方式将原始信息进行编码,得到编码原始信息;使用第二编码方式将认证信息进行编码,得到编码认证信息,所述第一编码方式与所述第二编码方式不相同;将所述编码认证信息嵌入所述编码原始信息中,得到目标编码信息;将所述目标编码信息进行调制,得到目标比特流;将所述认证比特流嵌入所述原始比特流中,得到目标比特流;按照预设的二维码生成算法将所述目标比特流转换为二维码图像。A fifth aspect of the embodiments of the present invention discloses a method for generating a two-dimensional code, comprising: encoding an original information by using a first encoding manner to obtain encoded original information; and encoding the authentication information by using a second encoding manner to obtain encoded authentication information, The first encoding mode is different from the second encoding mode; the encoding authentication information is embedded in the encoding original information to obtain target encoding information; and the target encoding information is modulated to obtain a target bitstream; The authentication bit stream is embedded in the original bit stream to obtain a target bit stream; and the target bit stream is converted into a two-dimensional code image according to a preset two-dimensional code generation algorithm.
本发明实施例中,使用第一编码方式将原始信息进行编码,得到编码原 始信息;使用第二编码方式将认证信息进行编码,得到编码认证信息;将编码认证信息嵌入编码原始信息中,得到目标编码信息;对目标编码信息进行调制,得到目标比特流;按照预设的二维码生成算法将目标比特流转换为二维码图像。由于编码认证信息嵌入到了编码原始信息,二维码图像中携带有认证信息,当二维码图像被扫描复制时,引入了更多的噪声,从而导致复制的二维码图像不能使用,因此实施本发明实施例,可以防止二维码被非法复制,提高二维码的安全性。In the embodiment of the present invention, the original information is encoded by using the first coding manner to obtain a coding original. The first information is used to encode the authentication information to obtain the encoded authentication information; the encoded authentication information is embedded in the encoded original information to obtain the target encoded information; and the target encoded information is modulated to obtain a target bit stream; The two-dimensional code generation algorithm converts the target bit stream into a two-dimensional code image. Since the coded authentication information is embedded in the coded original information, the two-dimensional code image carries the authentication information. When the two-dimensional code image is scanned and copied, more noise is introduced, so that the copied two-dimensional code image cannot be used, so implementation In the embodiment of the present invention, the two-dimensional code can be prevented from being illegally copied, and the security of the two-dimensional code is improved.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings to be used in the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without paying any creative work.
图1是本发明实施例公开的一种二维码生成方法的流程示意图;1 is a schematic flow chart of a method for generating a two-dimensional code according to an embodiment of the present invention;
图2是本发明实施例公开的另一种二维码生成方法的流程示意图;2 is a schematic flow chart of another method for generating a two-dimensional code according to an embodiment of the present invention;
图3是本发明实施例公开的一种二维码解码方法的流程示意图;3 is a schematic flow chart of a method for decoding a two-dimensional code according to an embodiment of the present invention;
图4是本发明实施例公开的一种二维码解码方法的流程示意图;4 is a schematic flowchart of a two-dimensional code decoding method according to an embodiment of the present invention;
图5是本发明实施例公开的一种终端的结构示意图;FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present disclosure;
图6是本发明实施例公开的另一种终端的结构示意图;6 is a schematic structural diagram of another terminal according to an embodiment of the present invention;
图7是本发明实施例公开的又一种终端的结构示意图;FIG. 7 is a schematic structural diagram of still another terminal according to an embodiment of the present invention; FIG.
图8是本发明实施例公开的一种移动终端的结构示意图。FIG. 8 is a schematic structural diagram of a mobile terminal according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出 创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, those of ordinary skill in the art have not made All other embodiments obtained under the premise of creative labor are within the scope of the invention.
本发明的实施方式公开了一种二维码生成方法、二维码解码方法以及终端,可以提高二维码的安全性。以下分别进行详细说明。Embodiments of the present invention disclose a two-dimensional code generation method, a two-dimensional code decoding method, and a terminal, which can improve the security of a two-dimensional code. The details are described below separately.
参见图1,图1是本发明实施例公开的一种二维码生成方法的流程示意图。如图1所示,该二维码生成方法包括如下步骤。Referring to FIG. 1, FIG. 1 is a schematic flowchart diagram of a method for generating a two-dimensional code according to an embodiment of the present invention. As shown in FIG. 1, the two-dimensional code generation method includes the following steps.
步骤101,终端使用第一编码方式将原始信息进行编码,得到编码原始信息。Step 101: The terminal encodes the original information by using a first coding manner to obtain coded original information.
本发明实施例中,原始信息可以是用户输入的信息,例如,字符串,网址等。第一编码方式可以为里德所罗门(Reed-solomon,RS)编码,RS编码是一种前向纠错的信道编码,对由校正过采样数据所产生的多项式有效。RS编码的抗干扰和抗噪声能力较强,具有较强的纠错能力。当接收装置接收到大部分的编码原始信息之后,就可以采用RS解码方法解码出原始信息。原始信息进行RS编码之后,得到的编码原始信息可以是一段由“0”和“1”组成的二进制比特流。In the embodiment of the present invention, the original information may be information input by the user, for example, a character string, a web address, or the like. The first coding mode may be Reed-Solomon (RS) coding, which is a forward error correction channel coding, which is valid for polynomials generated by correcting oversampled data. The RS code has strong anti-interference and anti-noise ability and has strong error correction capability. After the receiving device receives most of the encoded original information, the original information can be decoded using the RS decoding method. After the original information is RS-encoded, the obtained encoded original information may be a binary bit stream composed of "0" and "1".
步骤102,终端使用第二编码方式将认证信息进行编码,得到编码认证信息,第一编码方式与第二编码方式不相同。Step 102: The terminal encodes the authentication information by using the second coding mode to obtain the coded authentication information, where the first coding mode is different from the second coding mode.
本发明实施例中,第二编码方式可以为BCH(Bose、Ray-Chaudhuri Hocquenghem)编码,BCH编码是用于校正多个随机错误模式的多级、循环、错误校正、变长数字编码。BCH编码也可以用于质数级或者质数的幂级的多级相移键控。与RS编码相比,BCH编码的抗干扰和抗噪声能力要弱一些,BCH编码的纠错能力比RS编码的纠错能力要差。BCH解码时,当出现错误的位数超过预设位数时,则解码失败,无法解码出认证信息。认证信息进行BCH编码之后,得到的编码认证信息可以是一段由“0”和“1”组成的二进制比特流。认证信息可以是字符串、二进制比特流等,认证信息可以用于对二维码的真伪进行认证。举例来说,认证信息可以是商品上的二维码中的防伪验证信息。 In the embodiment of the present invention, the second coding mode may be BCH (Bose, Ray-Chaudhuri Hocquenghem) coding, and the BCH coding is multi-level, cyclic, error correction, variable length digital coding for correcting multiple random error modes. BCH coding can also be used for multi-level phase shift keying at the power level or prime level. Compared with RS coding, the anti-interference and anti-noise ability of BCH coding is weaker, and the error correction capability of BCH coding is worse than that of RS coding. When BCH is decoded, when the number of occurrences of the error exceeds the preset number of bits, the decoding fails and the authentication information cannot be decoded. After the BCH encoding of the authentication information, the obtained encoding authentication information may be a binary bit stream composed of "0" and "1". The authentication information may be a character string, a binary bit stream, or the like, and the authentication information may be used to authenticate the authenticity of the two-dimensional code. For example, the authentication information may be anti-counterfeiting verification information in a two-dimensional code on the commodity.
一般而言,认证信息的容量要小于二维码的纠错容量。二维码的纠错容量与二维码的编码方式有关,例如,对于QS而言,其纠错容量能够达到原始信息容量的30%。在一些示例中,可选地,认证信息的容量小于原始信息的容量的30%。In general, the capacity of the authentication information is smaller than the error correction capacity of the two-dimensional code. The error correction capacity of the two-dimensional code is related to the coding mode of the two-dimensional code. For example, for QS, the error correction capacity can reach 30% of the original information capacity. In some examples, optionally, the capacity of the authentication information is less than 30% of the capacity of the original information.
本发明实施例中,当认证信息的容量小于原始信息的容量的30%时,在扫描二维码图像中,认证信息对原始信息的影响较小,在二维码的自动纠错范围之内,不会出现无法从二维码中读取原始信息的情况。当认证信息的容量大于原始信息的容量的30%时,认证信息对原始信息的影响较大,超出了二维码的自动纠错范围,可能会出现无法从二维码中读取原始信息的情况。In the embodiment of the present invention, when the capacity of the authentication information is less than 30% of the capacity of the original information, in the scanned two-dimensional code image, the authentication information has little influence on the original information, and is within the automatic error correction range of the two-dimensional code. There is no case where the original information cannot be read from the QR code. When the capacity of the authentication information is greater than 30% of the capacity of the original information, the authentication information has a greater impact on the original information, which is beyond the automatic error correction range of the two-dimensional code, and may not be able to read the original information from the two-dimensional code. Happening.
在一种可行的实施方式中,认证信息也可以无需编码,当认证信息本身为“0”和“1”组成的二进制比特流时,则无需进行编码。此时,第二编码方式就是将认证信息中的“0”变为“0”,“1”变为“1”,即相当于没有进行编码。In a feasible implementation manner, the authentication information may not need to be encoded. When the authentication information itself is a binary bit stream composed of “0” and “1”, no encoding is needed. At this time, the second encoding method is to change "0" in the authentication information to "0", and "1" to "1", that is, equivalent to no encoding.
需要说明的是,本发明实施例中的步骤101和步骤102的执行顺序可以调换。步骤101和步骤102也可以同时执行。It should be noted that the execution order of step 101 and step 102 in the embodiment of the present invention may be reversed. Steps 101 and 102 can also be performed simultaneously.
步骤103,终端将编码认证信息嵌入编码原始信息中,得到目标编码信息。Step 103: The terminal embeds the encoded authentication information into the encoded original information to obtain target encoding information.
本发明实施例中,终端可以将编码认证信息嵌入到编码原始信息中。编码认证信息和编码原始信息都是二进制比特流。一般而言,编码认证信息要远小于编码原始信息,比如,编码认证信息小于编码原始信息的30%。例如,编码认证信息为100比特,编码原始信息为1000比特,最终得到的目标编码信息的大小为1000~1100比特之间。In the embodiment of the present invention, the terminal may embed the coded authentication information into the code original information. Both the encoded authentication information and the encoded original information are binary bit streams. In general, the encoded authentication information is much smaller than the encoded original information, for example, the encoded authentication information is less than 30% of the encoded original information. For example, the encoding authentication information is 100 bits, the encoding original information is 1000 bits, and the size of the finally obtained target encoding information is between 1000 and 1100 bits.
在一种可行的实施方式中,终端将编码认证信息随机嵌入编码原始信息中,得到目标编码信息。In a feasible implementation manner, the terminal randomly embeds the coding authentication information into the original information to obtain the target coding information.
本发明实施例中,终端可以将编码认证信息按某种嵌入策略插入编码原始信息中。例如,终端可以将编码认证信息中的每个比特位随机的插入编码原始信息中,得到目标编码信息。又例如,终端可以将编码认证信息整体随机插入编码原始信息中。如果编码认证信息为100比特,编码原始信息为1000 比特,最终得到的目标编码信息的大小为1100比特。In the embodiment of the present invention, the terminal may insert the coded authentication information into the coded original information according to an embedded policy. For example, the terminal may randomly insert each bit in the encoded authentication information into the encoded original information to obtain target encoded information. For another example, the terminal may randomly insert the entire encoded authentication information into the encoded original information. If the encoding authentication information is 100 bits, the encoding original information is 1000. The size of the resulting target encoded information is 1100 bits.
在另一种可行的实施方式中,终端将编码原始信息中的部分信息用编码认证信息进行替换,得到目标编码信息。In another feasible implementation manner, the terminal replaces part of the information in the original information with the coded authentication information to obtain target coded information.
本发明实施例中,终端可以在编码原始信息中选择与编码认证信息大小相等的比特位数,将选择的比特位数用编码认证信息进行替换,得到目标编码信息。例如,如果编码认证信息为100比特,编码原始信息为1000比特,终端可以从编码原始信息中选择100比特,将这100比特用编码认证信息进行替代,得到1000比特的目标编码信息。In the embodiment of the present invention, the terminal may select a bit number equal to the size of the coded authentication information in the original code information, and replace the selected bit number with the coded authentication information to obtain the target coded information. For example, if the encoding authentication information is 100 bits and the encoding original information is 1000 bits, the terminal can select 100 bits from the encoding original information, and replace the 100 bits with the encoding authentication information to obtain 1000-bit target encoding information.
步骤104,终端对目标编码信息进行调制,得到目标比特流。Step 104: The terminal modulates the target coding information to obtain a target bit stream.
本发明实施例中,终端可以采用正交振幅调制(Quadrature Amplitude Modulation)调制方式对目标编码信息进行调制,得到目标比特流。对于QAM调制来说,目标比特流可以是由“0”、“1”“-1”组成的一段比特流。对目标编码信息调制后,得到适合信道传输的目标比特流,以便目标比特流在信道中进行传输。In the embodiment of the present invention, the terminal may modulate the target coding information by using a Quadrature Amplitude Modulation modulation method to obtain a target bit stream. For QAM modulation, the target bit stream may be a bit stream consisting of "0", "1", "-1". After modulating the target coded information, a target bit stream suitable for channel transmission is obtained, so that the target bit stream is transmitted in the channel.
步骤105,终端按照预设的二维码生成算法将目标比特流转换为二维码图像。Step 105: The terminal converts the target bit stream into a two-dimensional code image according to a preset two-dimensional code generation algorithm.
本发明实施例中,终端对目标编码信息进行调制,得到目标比特流之后,可以按照预设的二维码生成算法将目标比特流转换为二维码图像。具体的,终端可以将目标比特流中的“0”、“1”“-1”分别对应不同的灰度图像像素,并根据目标比特流中的“0”、“1”“-1”在目标比特流中的位置对应二维码图像中的像素位置。In the embodiment of the present invention, the terminal modulates the target coding information to obtain a target bit stream, and then converts the target bit stream into a two-dimensional code image according to a preset two-dimensional code generation algorithm. Specifically, the terminal may respectively correspond to “0”, “1”, “-1” in the target bitstream to different grayscale image pixels, and according to “0”, “1”, “-1” in the target bitstream. The position in the target bitstream corresponds to the pixel location in the two-dimensional code image.
本发明实施例中,二维码图像中携带有认证信息,由于认证信息较小,当二维码图像被扫描复制时,认证信息产生的噪声相对较大,导致复制的二维码图像中的认证信息容易丢失,进而导致复制的二维码图像不能使用,因此实施本发明实施例,可以防止二维码被非法复制,提高二维码使用的安全性。 In the embodiment of the present invention, the two-dimensional code image carries the authentication information. Since the authentication information is small, when the two-dimensional code image is scanned and copied, the noise generated by the authentication information is relatively large, resulting in the copied two-dimensional code image. The authentication information is easily lost, and the copied two-dimensional code image cannot be used. Therefore, the embodiment of the present invention can prevent the two-dimensional code from being illegally copied and improve the security of the use of the two-dimensional code.
参见图2,图2是本发明实施例公开的另一种二维码生成方法的流程示意图。如图2所示,该二维码生成方法包括如下步骤。Referring to FIG. 2, FIG. 2 is a schematic flowchart diagram of another method for generating a two-dimensional code according to an embodiment of the present invention. As shown in FIG. 2, the two-dimensional code generating method includes the following steps.
步骤201,终端使用第一编码方式将原始信息进行编码,得到编码原始信息。Step 201: The terminal encodes the original information by using a first coding manner to obtain coded original information.
本发明实施例中,原始信息可以是用户输入的信息,例如,字符串,网址等。第一编码方式可以为RS编码,RS编码是一种前向纠错的信道编码,对由校正过采样数据所产生的多项式有效。RS编码的抗干扰和抗噪声能力较强,具有较强的纠错能力。当接收装置接收到大部分的编码原始信息之后,就可以采用RS解码方法解码出原始信息。原始信息进行RS编码之后,得到的编码原始信息可以是一段由“0”和“1”组成的二进制比特流。In the embodiment of the present invention, the original information may be information input by the user, for example, a character string, a web address, or the like. The first coding mode may be RS coding, which is a forward error correction channel coding, which is valid for a polynomial generated by correcting oversampled data. The RS code has strong anti-interference and anti-noise ability and has strong error correction capability. After the receiving device receives most of the encoded original information, the original information can be decoded using the RS decoding method. After the original information is RS-encoded, the obtained encoded original information may be a binary bit stream composed of "0" and "1".
步骤202,终端将编码原始信息进行调制,得到原始比特流。Step 202: The terminal modulates the original information to obtain an original bit stream.
本发明实施例中,终端可以采用正交振幅调制(Quadrature Amplitude Modulation)调制方式对编码原始信息进行调制,得到原始比特流。对于QAM调制来说,原始比特流可以是由“0”、“1”“-1”组成的一段比特流。对编码原始信息调制后,得到适合信道传输的原始比特流,以便原始比特流在信道中进行传输。In the embodiment of the present invention, the terminal may modulate the original information by using a Quadrature Amplitude Modulation modulation method to obtain an original bit stream. For QAM modulation, the original bit stream may be a bit stream consisting of "0", "1", "-1". After modulating the original information, a raw bit stream suitable for channel transmission is obtained so that the original bit stream is transmitted in the channel.
步骤203,终端使用第二编码方式将认证信息进行编码,得到编码认证信息,第一编码方式与第二编码方式不相同。Step 203: The terminal encodes the authentication information by using the second coding mode to obtain the coded authentication information, where the first coding mode is different from the second coding mode.
本发明实施例中,第二编码方式可以为BCH(Bose、Ray-Chaudhuri Hocquenghem)编码,BCH编码是用于校正多个随机错误模式的多级、循环、错误校正、变长数字编码。BCH编码也可以用于质数级或者质数的幂级的多级相移键控。与RS编码相比,BCH编码的抗干扰和抗噪声能力要弱一些,BCH编码的纠错能力比RS编码的纠错能力要差。BCH解码时,当出现错误的位数超过预设位数时,则解码失败,无法解码出认证信息。认证信息进行BCH编码之后,得到的编码原始信息可以是一段由“0”和“1”组成的二进制比 特流。In the embodiment of the present invention, the second coding mode may be BCH (Bose, Ray-Chaudhuri Hocquenghem) coding, and the BCH coding is multi-level, cyclic, error correction, variable length digital coding for correcting multiple random error modes. BCH coding can also be used for multi-level phase shift keying at the power level or prime level. Compared with RS coding, the anti-interference and anti-noise ability of BCH coding is weaker, and the error correction capability of BCH coding is worse than that of RS coding. When BCH is decoded, when the number of occurrences of the error exceeds the preset number of bits, the decoding fails and the authentication information cannot be decoded. After the BCH encoding of the authentication information, the obtained encoded original information may be a binary ratio consisting of “0” and “1”. Special flow.
一般而言,认证信息的容量要小于二维码的纠错容量。二维码的纠错容量与二维码的编码方式有关,例如,对于QS而言,其纠错容量能够达到原始信息容量的30%。在一些示例中,可选地,认证信息的容量小于原始信息的容量的30%。In general, the capacity of the authentication information is smaller than the error correction capacity of the two-dimensional code. The error correction capacity of the two-dimensional code is related to the coding mode of the two-dimensional code. For example, for QS, the error correction capacity can reach 30% of the original information capacity. In some examples, optionally, the capacity of the authentication information is less than 30% of the capacity of the original information.
本发明实施例中,当认证信息的容量小于原始信息的容量的30%时,在扫描二维码图像中,认证信息对原始信息的影响较小,在二维码的自动纠错范围之内,不会出现无法从二维码中读取原始信息的情况。当认证信息的容量大于原始信息的容量的30%时,认证信息对原始信息的影响较大,超出了二维码的自动纠错范围,可能会出现无法从二维码中读取原始信息的情况。In the embodiment of the present invention, when the capacity of the authentication information is less than 30% of the capacity of the original information, in the scanned two-dimensional code image, the authentication information has little influence on the original information, and is within the automatic error correction range of the two-dimensional code. There is no case where the original information cannot be read from the QR code. When the capacity of the authentication information is greater than 30% of the capacity of the original information, the authentication information has a greater impact on the original information, which is beyond the automatic error correction range of the two-dimensional code, and may not be able to read the original information from the two-dimensional code. Happening.
在一种可行的实施方式中,认证信息也可以无需编码,当认证信息本身为“0”和“1”组成的二进制比特流时,则无需进行编码。此时,第二编码方式就是将认证信息中的“0”变为“0”,“1”变为“1”,即相当于没有进行编码。In a feasible implementation manner, the authentication information may not need to be encoded. When the authentication information itself is a binary bit stream composed of “0” and “1”, no encoding is needed. At this time, the second encoding method is to change "0" in the authentication information to "0", and "1" to "1", that is, equivalent to no encoding.
步骤204,终端将编码认证信息进行调制,得到认证比特流。Step 204: The terminal modulates the encoded authentication information to obtain an authentication bitstream.
本发明实施例中,终端可以采用正交相移键控(Quadrature Phase Shift Keying,QPSK)调制方式对编码认证信息进行调制,得到认证比特流。对于QPSK调制来说,认证比特流可以是由“0”、“1”“-1”组成的一段比特流。对编码认证信息调制后,得到适合信道传输的认证比特流,以便认证比特流在信道中进行传输。In the embodiment of the present invention, the terminal may modulate the encoded authentication information by using a Quadrature Phase Shift Keying (QPSK) modulation method to obtain an authentication bit stream. For QPSK modulation, the authentication bitstream may be a bitstream consisting of "0", "1", "-1". After modulating the encoded authentication information, an authentication bitstream suitable for channel transmission is obtained to authenticate the bitstream for transmission in the channel.
需要说明的是,本发明实施例中,步骤201、步骤202与步骤203、步骤204的执行顺序可以调换,例如,可以先执行步骤203、步骤204,再执行步骤201、步骤202。或者,步骤201、步骤202与步骤203、步骤204同时执行。It should be noted that, in the embodiment of the present invention, the execution order of step 201, step 202, and step 203 and step 204 may be reversed. For example, step 203 and step 204 may be performed first, and then step 201 and step 202 may be performed. Alternatively, step 201 and step 202 are performed simultaneously with steps 203 and 204.
步骤205,终端将认证比特流嵌入原始比特流中,得到目标比特流。Step 205: The terminal embeds the authentication bit stream into the original bit stream to obtain a target bit stream.
本发明实施例中,终端可以将认证比特流嵌入到原始比特流中。认证比特流和原始比特流都是二进制比特流。一般而言,认证比特流要远小于原始 比特流,比如,认证比特流小于原始比特流的30%。例如,认证比特流为100比特,原始比特流为1000比特,最终得到的目标比特流的大小为1000~1100比特之间。In the embodiment of the present invention, the terminal may embed the authentication bit stream into the original bit stream. Both the authentication bit stream and the original bit stream are binary bit streams. In general, the authentication bit stream is much smaller than the original The bitstream, for example, the authentication bitstream is less than 30% of the original bitstream. For example, the authentication bit stream is 100 bits, the original bit stream is 1000 bits, and the resulting target bit stream has a size between 1000 and 1100 bits.
在一种可行的实施方式中,终端将认证比特流随机嵌入原始比特流中,得到目标比特流。In a feasible implementation manner, the terminal randomly embeds the authentication bit stream into the original bit stream to obtain a target bit stream.
本发明实施例中,终端可以将认证比特流随机的插入原始比特流中。例如,终端可以将认证比特流中的每个比特位随机的插入原始比特流中,得到目标比特流。又例如,终端可以将认证比特流整体随机插入原始比特流中。如果认证比特流为100比特,原始比特流为1000比特,最终得到的目标比特流的大小为1100比特。In the embodiment of the present invention, the terminal may randomly insert the authentication bit stream into the original bit stream. For example, the terminal can randomly insert each bit in the authentication bitstream into the original bitstream to obtain a target bitstream. As another example, the terminal can randomly insert the authentication bit stream into the original bit stream as a whole. If the authentication bit stream is 100 bits and the original bit stream is 1000 bits, the resulting target bit stream has a size of 1100 bits.
在另一种可行的实施方式中,终端将原始比特流中的部分信息用认证比特流进行替换,得到目标比特流。In another possible implementation manner, the terminal replaces part of the information in the original bitstream with the authentication bitstream to obtain a target bitstream.
本发明实施例中,终端可以在原始比特流中选择与认证比特流大小相等的比特位数,将选择的比特位数用认证比特流进行替换,得到目标比特流。例如,如果认证比特流为100比特,原始比特流为1000比特,终端可以从原始比特流中选择100比特,将这100比特用认证比特流进行替代,得到1000比特的目标比特流。In the embodiment of the present invention, the terminal may select a bit number equal to the size of the authentication bit stream in the original bit stream, and replace the selected bit number with the authentication bit stream to obtain a target bit stream. For example, if the authentication bit stream is 100 bits and the original bit stream is 1000 bits, the terminal can select 100 bits from the original bit stream, and replace the 100 bits with the authentication bit stream to obtain a 1000 bit target bit stream.
步骤206,终端按照预设的二维码生成算法将目标比特流转换为二维码图像。Step 206: The terminal converts the target bit stream into a two-dimensional code image according to a preset two-dimensional code generation algorithm.
本发明实施例中,终端将认证比特流嵌入原始比特流中,得到目标比特流之后,可以按照预设的二维码生成算法将目标比特流转换为二维码图像。具体的,终端可以将目标比特流中的“0”、“1”“-1”分别对应不同的灰度图像像素,并根据目标比特流中的“0”、“1”“-1”在目标比特流中的位置对应二维码图像中的像素位置。In the embodiment of the present invention, the terminal embeds the authentication bit stream into the original bit stream, and after obtaining the target bit stream, the target bit stream may be converted into the two-dimensional code image according to a preset two-dimensional code generation algorithm. Specifically, the terminal may respectively correspond to “0”, “1”, “-1” in the target bitstream to different grayscale image pixels, and according to “0”, “1”, “-1” in the target bitstream. The position in the target bitstream corresponds to the pixel location in the two-dimensional code image.
本发明实施例中,二维码图像中携带有认证信息,由于认证信息较小,当二维码图像被扫描复制时,认证信息产生的噪声相对较大,导致复制的二 维码图像中的认证信息容易丢失,进而导致复制的二维码图像不能使用,因此实施本发明实施例,可以防止二维码被非法复制,提高二维码使用的安全性。In the embodiment of the present invention, the two-dimensional code image carries the authentication information. Since the authentication information is small, when the two-dimensional code image is scanned and copied, the noise generated by the authentication information is relatively large, resulting in duplicated two. The authentication information in the code image is easily lost, and the copied two-dimensional code image cannot be used. Therefore, the embodiment of the present invention can prevent the two-dimensional code from being illegally copied and improve the security of the use of the two-dimensional code.
参见图3,图3是本发明实施例公开的一种二维码解码方法的流程示意图。图3所示的二维码解码方法与图1所示的二维码生成方法相对应。如图3所示,该二维码解码方法包括如下步骤。Referring to FIG. 3, FIG. 3 is a schematic flowchart diagram of a two-dimensional code decoding method according to an embodiment of the present invention. The two-dimensional code decoding method shown in FIG. 3 corresponds to the two-dimensional code generating method shown in FIG. 1. As shown in FIG. 3, the two-dimensional code decoding method includes the following steps.
步骤301,终端扫描二维码图像,对二维码图像进行图像恢复,得到还原后的二维码图像。Step 301: The terminal scans the two-dimensional code image, and performs image recovery on the two-dimensional code image to obtain a restored two-dimensional code image.
本发明实施例中,终端扫描二维码图像,对二维码图像进行图像恢复,得到还原后的二维码图像。此时,还原后的二维码图像与(初始)二维码图像相比,会出现少量噪声。例如,二维码图像本身携带的信息为P,还原后的二维码图像携带的信息为P+P1,其中,P1为终端在扫描二维码图像的过程中出现的噪声,P1相对与P来说较小,P1小于二维码在容错能力范围内允许的最大噪声T(T与P的大小相关,一般来说,P越大,T越大),即P1<T。一般而言,P1带来的噪声不足以对二维码图像本身携带的信息P造成影响,由于二维码本身具备一定的容错能力,终端依然可以从还原后的二维码图像中扫描得到需要的信息(原始信息和认证信息)。In the embodiment of the present invention, the terminal scans the two-dimensional code image, performs image recovery on the two-dimensional code image, and obtains the restored two-dimensional code image. At this time, a small amount of noise appears in the restored two-dimensional code image compared to the (initial) two-dimensional code image. For example, the information carried by the two-dimensional code image itself is P, and the information carried by the restored two-dimensional code image is P+P1, wherein P1 is the noise that occurs when the terminal scans the two-dimensional code image, and P1 is relative to P. Smaller, P1 is smaller than the maximum noise T allowed by the two-dimensional code in the range of fault tolerance (T is related to the size of P, generally, the larger P is, the larger T is), that is, P1 < T. In general, the noise caused by P1 is not enough to affect the information P carried by the two-dimensional code image itself. Since the two-dimensional code itself has a certain fault tolerance, the terminal can still scan from the restored two-dimensional code image to obtain the need. Information (original information and authentication information).
步骤302,终端按照预设的比特流生成算法将还原后的二维码图像转换为目标比特流。Step 302: The terminal converts the restored two-dimensional code image into a target bit stream according to a preset bit stream generation algorithm.
本发明实施例中,终端扫描二维码图像,对二维码图像进行图像恢复,得到还原后的二维码图像之后,可以按照预设的比特流生成算法将还原后的二维码图像转换为目标比特流。具体的,终端可以将还原后的二维码图像中不同位置的像素点的灰度值对应不同的比特位,得到由“0”、“1”“-1”组成的目标比特流。In the embodiment of the present invention, the terminal scans the two-dimensional code image, performs image recovery on the two-dimensional code image, and obtains the restored two-dimensional code image, and then converts the restored two-dimensional code image according to a preset bit stream generation algorithm. For the target bit stream. Specifically, the terminal may correspond the gray values of the pixels at different positions in the restored two-dimensional code image to different bits, and obtain a target bit stream composed of “0”, “1” “-1”.
步骤303,终端对目标比特流进行解调,得到目标编码信息。Step 303: The terminal demodulates the target bit stream to obtain target coding information.
本发明实施例中,终端可以采用正交相移键控(Quadrature Phase Shift  Keying,QPSK)调制方式对目标比特流进行解调,得到标编码信息。对于QPSK调制来说,可以将目标比特流中由“0”、“1”“-1”组成的一段比特流解调为由“0”、“1”组成的二进制比特流的目标编码信息。In the embodiment of the present invention, the terminal can adopt quadrature phase shift keying (Quadrature Phase Shift) The Keying, QPSK) modulation method demodulates the target bit stream to obtain the coded information. For QPSK modulation, a bit stream composed of "0", "1", "-1" in the target bit stream can be demodulated into target coded information of a binary bit stream composed of "0" and "1".
步骤304,终端从目标编码信息中提取编码原始信息,使用第一解码方式将编码原始信息进行解码,得到原始信息。Step 304: The terminal extracts the original encoding information from the target encoding information, and decodes the encoded original information by using the first decoding manner to obtain the original information.
本发明实施例中,终端可以从目标编码信息中提取编码原始信息,并使用第一解码方式将编码原始信息进行解码,得到原始信息。由于在生成二维码图像的过程中,采用第一编码方式将原始信息进行编码,得到编码原始信息。在二维码解码的过程中,第一解码方式与第一编码方式相对应。例如,若第一编码方式为RS编码,则第一解码方式为RS解码。编码原始信息通过第一解码方式解码后,可以得到原始信息,原始信息可以是用户输入的信息,例如,字符串,网址等。In the embodiment of the present invention, the terminal may extract the original encoding information from the target encoding information, and decode the encoded original information by using the first decoding manner to obtain the original information. Since the original information is encoded by the first encoding method in the process of generating the two-dimensional code image, the encoded original information is obtained. In the process of decoding the two-dimensional code, the first decoding mode corresponds to the first encoding mode. For example, if the first coding mode is RS coding, the first decoding mode is RS decoding. After the original information is decoded by the first decoding method, the original information can be obtained, and the original information can be information input by the user, for example, a character string, a web address, and the like.
步骤305,终端从目标编码信息中提取编码认证信息,使用第二解码方式将编码认证信息进行解码,得到认证信息。Step 305: The terminal extracts the encoded authentication information from the target encoding information, and decodes the encoded authentication information by using the second decoding manner to obtain the authentication information.
本发明实施例中,终端可以从目标编码信息中提取编码认证信息,并使用第二解码方式将编码认证信息进行解码,得到认证信息。由于在生成二维码图像的过程中,采用第二编码方式将认证信息进行编码,得到编码认证信息。在二维码解码的过程中,第二解码方式与第二编码方式相对应。例如,若第二编码方式为BCH编码,则第二解码方式为BCH解码。认证信息可以是字符串、二进制比特流等,认证信息可以用于对二维码的真伪进行认证。举例来说,认证信息可以是商品上的二维码中的防伪验证信息。In the embodiment of the present invention, the terminal may extract the encoded authentication information from the target encoding information, and decode the encoded authentication information by using the second decoding manner to obtain the authentication information. Since the authentication information is encoded by the second encoding method in the process of generating the two-dimensional code image, the encoded authentication information is obtained. In the process of decoding the two-dimensional code, the second decoding mode corresponds to the second encoding mode. For example, if the second coding mode is BCH coding, the second decoding mode is BCH decoding. The authentication information may be a character string, a binary bit stream, or the like, and the authentication information may be used to authenticate the authenticity of the two-dimensional code. For example, the authentication information may be anti-counterfeiting verification information in a two-dimensional code on the commodity.
步骤306,终端将认证信息发往认证平台进行认证。Step 306: The terminal sends the authentication information to the authentication platform for authentication.
本发明实施例中,终端获取认证信息后,可以将认证信息发往认证平台进行认证。例如,用户可以通过扫描商品上的二维码,获取其中的认证信息,并发往认证平台验证该商品的真伪。In the embodiment of the present invention, after obtaining the authentication information, the terminal may send the authentication information to the authentication platform for authentication. For example, the user can obtain the authentication information by scanning the two-dimensional code on the product, and send it to the authentication platform to verify the authenticity of the product.
下面以具体的应用场景来阐述本发明实施例的有益效果。 The beneficial effects of the embodiments of the present invention are described below in a specific application scenario.
在一个具体应用场景中,二维码图像可以打印在各种商品上。用户可以通过终端扫描商品上(例如,商品外包装上)的二维码图像,终端在扫描二维码图像的过程中出现的噪声P1,但是P1小于二维码在容错能力范围内允许的最大噪声T,即P1<T。因而,终端可以获取二维码图像中包含的原始信息(例如,生产商品的公司的网址、商品原产地、商品物流信息、商品原料信息、商品制造日期等商品信息)和认证信息(例如,商品防伪码)。如果二维码图像被非法分子盗用(例如,非法复制),并将正品商品上的二维码图像非法扫描复制并打印到假冒伪劣商品的外包装上,二维码图像在非法扫描复制并打印的过程中会出现噪声P2,P2远大于P1,用户通过终端扫描假冒伪劣商品的外包装上的经过非法复制的二维码图像时,终端在扫描非法复制的二维码图像的过程中会出现的噪声P3,P3与P1差不多大小,此时二维码图像的噪声变为P2+P3,会导致P2+P3>T,已经超出了二维码在容错能力范围内允许的最大噪声T,则用户无法通过终端扫描假冒伪劣商品的外包装上的经过非法复制的二维码图像获取正确的认证信息,导致用户获取的经过非法复制的二维码图像中的认证信息容易出错或丢失,导致非法复制的二维码图像中的认证信息无法通过认证,从而达到防止二维码被非法复制的目的,可以提高二维码使用的安全性。In a specific application scenario, QR code images can be printed on a variety of products. The user can scan the two-dimensional code image on the commodity (for example, on the outer packaging of the commodity) through the terminal, and the noise P1 appearing in the process of scanning the two-dimensional code image by the terminal, but P1 is smaller than the maximum allowed in the range of the fault tolerance capability of the two-dimensional code. Noise T, ie P1 < T. Therefore, the terminal can acquire the original information (for example, the website of the company producing the product, the origin of the product, the product logistics information, the product material information, the product manufacturing date, and the like) and the authentication information (for example, the product) included in the two-dimensional code image. Security code). If the QR code image is stolen by illegal molecules (for example, illegal copying), and the QR code image on the genuine product is illegally scanned and printed and printed on the outer packaging of the counterfeit and shoddy goods, the QR code image is illegally scanned and copied. During the process, noise P2 will appear, and P2 is much larger than P1. When the user scans the illegally copied two-dimensional code image on the outer package of the counterfeit and shoddy goods through the terminal, the terminal will appear in the process of scanning the illegally copied two-dimensional code image. The noise P3, P3 and P1 are about the same size. At this time, the noise of the QR code image becomes P2+P3, which will cause P2+P3>T, which has exceeded the maximum noise T allowed by the QR code in the fault tolerance range. The user cannot obtain the correct authentication information by scanning the illegally copied two-dimensional code image on the outer package of the counterfeit and shoddy goods, so that the authentication information in the illegally copied two-dimensional code image acquired by the user is easily mistaken or lost, resulting in illegality. The authentication information in the copied QR code image cannot be authenticated, thereby preventing the two-dimensional code from being illegally copied, and the use of the two-dimensional code can be improved. safety.
本发明实施例中,当终端扫描经过非法复制的二维码图像时,经过非法复制的二维码图像中的认证信息容易出错或丢失,导致非法复制的二维码图像中的认证信息无法通过认证,从而达到防止二维码被非法复制的目的,可以提高二维码使用的安全性。In the embodiment of the present invention, when the terminal scans the illegally copied two-dimensional code image, the authentication information in the illegally copied two-dimensional code image is prone to error or loss, and the authentication information in the illegally copied two-dimensional code image cannot pass. The purpose of authentication is to prevent the two-dimensional code from being illegally copied, and the security of the use of the two-dimensional code can be improved.
参见图4,图4是本发明实施例公开的一种二维码解码方法的流程示意图。图4所示的二维码解码方法与图2所示的二维码生成方法相对应。如图4所示,该二维码解码方法包括如下步骤。Referring to FIG. 4, FIG. 4 is a schematic flowchart diagram of a two-dimensional code decoding method according to an embodiment of the present invention. The two-dimensional code decoding method shown in FIG. 4 corresponds to the two-dimensional code generating method shown in FIG. 2. As shown in FIG. 4, the two-dimensional code decoding method includes the following steps.
步骤401,终端扫描二维码图像,对二维码图像进行图像恢复,得到还原后的二维码图像。 Step 401: The terminal scans the two-dimensional code image, and performs image recovery on the two-dimensional code image to obtain a restored two-dimensional code image.
本发明实施例中,终端扫描二维码图像,对二维码图像进行图像恢复,得到还原后的二维码图像。此时,还原后的二维码图像与(初始)二维码图像相比,会出现少量噪声。例如,二维码图像本身携带的信息为P,还原后的二维码图像携带的信息为P+P1,其中,P1为终端在扫描二维码图像的过程中出现的噪声,P1相对与P来说较小,P1小于二维码在容错能力范围内允许的最大噪声T(T与P的大小相关,一般来说,P越大,T越大),即P1<T。一般而言,P1带来的噪声不足以对二维码图像本身携带的信息P造成影响,由于二维码本身具备一定的容错能力,终端依然可以从还原后的二维码图像中扫描得到需要的信息(原始信息和认证信息)。In the embodiment of the present invention, the terminal scans the two-dimensional code image, performs image recovery on the two-dimensional code image, and obtains the restored two-dimensional code image. At this time, a small amount of noise appears in the restored two-dimensional code image compared to the (initial) two-dimensional code image. For example, the information carried by the two-dimensional code image itself is P, and the information carried by the restored two-dimensional code image is P+P1, wherein P1 is the noise that occurs when the terminal scans the two-dimensional code image, and P1 is relative to P. Smaller, P1 is smaller than the maximum noise T allowed by the two-dimensional code in the range of fault tolerance (T is related to the size of P, generally, the larger P is, the larger T is), that is, P1 < T. In general, the noise caused by P1 is not enough to affect the information P carried by the two-dimensional code image itself. Since the two-dimensional code itself has a certain fault tolerance, the terminal can still scan from the restored two-dimensional code image to obtain the need. Information (original information and authentication information).
步骤402,终端按照预设的比特流生成算法将还原后的二维码图像转换为目标比特流。Step 402: The terminal converts the restored two-dimensional code image into a target bit stream according to a preset bit stream generation algorithm.
本发明实施例中,终端扫描二维码图像,对二维码图像进行图像恢复,得到还原后的二维码图像之后,可以按照预设的比特流生成算法将还原后的二维码图像转换为目标比特流。具体的,终端可以将还原后的二维码图像中不同位置的像素点的灰度值对应不同的比特位,得到由“0”、“1”“-1”组成的目标比特流。In the embodiment of the present invention, the terminal scans the two-dimensional code image, performs image recovery on the two-dimensional code image, and obtains the restored two-dimensional code image, and then converts the restored two-dimensional code image according to a preset bit stream generation algorithm. For the target bit stream. Specifically, the terminal may correspond the gray values of the pixels at different positions in the restored two-dimensional code image to different bits, and obtain a target bit stream composed of “0”, “1” “-1”.
步骤403,终端从目标比特流中提取原始比特流和认证比特流。In step 403, the terminal extracts the original bit stream and the authentication bit stream from the target bit stream.
步骤404,终端对原始比特流进行解调,得到编码原始信息;使用第一解码方式将编码原始信息进行解码,得到原始信息。Step 404: The terminal demodulates the original bit stream to obtain encoded original information, and decodes the original information by using the first decoding manner to obtain original information.
本发明实施例中,终端可以对原始比特流进行解调,得到编码原始信息,并使用第一解码方式将编码原始信息进行解码,得到原始信息。由于在生成二维码图像的过程中,采用第一编码方式将原始信息进行编码,得到编码原始信息。在二维码解码的过程中,第一解码方式与第一编码方式相对应。例如,若第一编码方式为RS编码,则第一解码方式为RS解码。编码原始信息通过第一解码方式解码后,可以得到原始信息,原始信息可以是用户输入的信息,例如,字符串,网址等。 In the embodiment of the present invention, the terminal may demodulate the original bit stream to obtain the original information, and decode the original information by using the first decoding manner to obtain original information. Since the original information is encoded by the first encoding method in the process of generating the two-dimensional code image, the encoded original information is obtained. In the process of decoding the two-dimensional code, the first decoding mode corresponds to the first encoding mode. For example, if the first coding mode is RS coding, the first decoding mode is RS decoding. After the original information is decoded by the first decoding method, the original information can be obtained, and the original information can be information input by the user, for example, a character string, a web address, and the like.
步骤405,终端对认证比特流进行解调,得到编码认证信息;使用第二解码方式将编码认证信息进行解码,得到认证信息。Step 405: The terminal demodulates the authentication bit stream to obtain coded authentication information, and decodes the coded authentication information by using a second decoding mode to obtain authentication information.
本发明实施例中,终端可以对认证比特流进行解调,得到编码认证信息,并使用第二解码方式将编码认证信息进行解码,得到认证信息。由于在生成二维码图像的过程中,采用第二编码方式将认证信息进行编码,得到编码认证信息。在二维码解码的过程中,第二解码方式与第二编码方式相对应。例如,若第二编码方式为BCH编码,则第二解码方式为BCH解码。认证信息可以是字符串、二进制比特流等,认证信息可以用于对二维码的真伪进行认证。举例来说,认证信息可以是商品上的二维码中的防伪验证信息。In the embodiment of the present invention, the terminal may demodulate the authentication bitstream to obtain the encoded authentication information, and decode the encoded authentication information by using the second decoding manner to obtain the authentication information. Since the authentication information is encoded by the second encoding method in the process of generating the two-dimensional code image, the encoded authentication information is obtained. In the process of decoding the two-dimensional code, the second decoding mode corresponds to the second encoding mode. For example, if the second coding mode is BCH coding, the second decoding mode is BCH decoding. The authentication information may be a character string, a binary bit stream, or the like, and the authentication information may be used to authenticate the authenticity of the two-dimensional code. For example, the authentication information may be anti-counterfeiting verification information in a two-dimensional code on the commodity.
步骤406,终端将认证信息发往认证平台进行认证。Step 406: The terminal sends the authentication information to the authentication platform for authentication.
本发明实施例中,终端获取认证信息后,可以将认证信息发往认证平台进行认证。例如,用户可以通过扫描商品上的二维码,获取其中的认证信息,并发往认证平台验证该商品的真伪。In the embodiment of the present invention, after obtaining the authentication information, the terminal may send the authentication information to the authentication platform for authentication. For example, the user can obtain the authentication information by scanning the two-dimensional code on the product, and send it to the authentication platform to verify the authenticity of the product.
本发明实施例中,当终端扫描经过非法复制的二维码图像时,经过非法复制的二维码图像中的认证信息容易出错或丢失,导致非法复制的二维码图像中的认证信息无法通过认证,从而达到防止二维码被非法复制的目的,可以提高二维码使用的安全性。In the embodiment of the present invention, when the terminal scans the illegally copied two-dimensional code image, the authentication information in the illegally copied two-dimensional code image is prone to error or loss, and the authentication information in the illegally copied two-dimensional code image cannot pass. The purpose of authentication is to prevent the two-dimensional code from being illegally copied, and the security of the use of the two-dimensional code can be improved.
参见图5,图5是本发明实施例公开的一种终端的结构示意图。如图5所示,该终端包括第一编码单元501、第二编码单元502、嵌入单元503、调制单元504和转换单元505,其中:第一编码单元501,用于使用第一编码方式将原始信息进行编码,得到编码原始信息。Referring to FIG. 5, FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present invention. As shown in FIG. 5, the terminal includes a first encoding unit 501, a second encoding unit 502, an embedding unit 503, a modulating unit 504, and a converting unit 505, wherein: a first encoding unit 501 is configured to use the first encoding method to The information is encoded to obtain the encoded original information.
第二编码单元502,用于使用第二编码方式将认证信息进行编码,得到编码认证信息,第一编码方式与第二编码方式不相同。The second encoding unit 502 is configured to encode the authentication information by using the second encoding method to obtain the encoded authentication information, where the first encoding mode is different from the second encoding mode.
嵌入单元503,用于将编码认证信息嵌入编码原始信息中,得到目标编码信息。The embedding unit 503 is configured to embed the encoding authentication information into the encoding original information to obtain the target encoding information.
调制单元504,用于对目标编码信息进行调制,得到目标比特流。 The modulating unit 504 is configured to modulate the target coding information to obtain a target bit stream.
转换单元505,用于按照预设的二维码生成算法将目标比特流转换为二维码。The converting unit 505 is configured to convert the target bit stream into a two-dimensional code according to a preset two-dimensional code generation algorithm.
本发明实施例中,二维码图像中携带有认证信息,由于认证信息较小,当二维码图像被扫描复制时,认证信息产生的噪声相对较大,导致复制的二维码图像中的认证信息容易丢失,进而导致复制的二维码图像不能使用,因此实施本发明实施例,可以防止二维码被非法复制,提高二维码使用的安全性。In the embodiment of the present invention, the two-dimensional code image carries the authentication information. Since the authentication information is small, when the two-dimensional code image is scanned and copied, the noise generated by the authentication information is relatively large, resulting in the copied two-dimensional code image. The authentication information is easily lost, and the copied two-dimensional code image cannot be used. Therefore, the embodiment of the present invention can prevent the two-dimensional code from being illegally copied and improve the security of the use of the two-dimensional code.
图5所示的终端的实施可以参见图1所示的方法实施例,重复之处不再赘述。For the implementation of the terminal shown in Figure 5, reference may be made to the method embodiment shown in Figure 1, and the repeated description is omitted.
参见图6,图6是本发明实施例公开的另一种终端的结构示意图。如图6所示,该终端包括扫描恢复单元601、转换单元602、解调单元603、第一解码单元604、第二解码单元605和发送单元606,其中:Referring to FIG. 6, FIG. 6 is a schematic structural diagram of another terminal according to an embodiment of the present invention. As shown in FIG. 6, the terminal includes a scan recovery unit 601, a conversion unit 602, a demodulation unit 603, a first decoding unit 604, a second decoding unit 605, and a transmission unit 606, where:
扫描恢复单元601,用于扫描二维码图像,对二维码图像进行图像恢复,得到还原后的二维码图像。The scan recovery unit 601 is configured to scan a two-dimensional code image, perform image restoration on the two-dimensional code image, and obtain a restored two-dimensional code image.
转换单元602,用于按照预设的比特流生成算法将还原后的二维码图像转换为目标比特流。The converting unit 602 is configured to convert the restored two-dimensional code image into a target bit stream according to a preset bit stream generation algorithm.
解调单元603,用于对目标比特流进行解调,得到目标编码信息。The demodulation unit 603 is configured to demodulate the target bit stream to obtain target coding information.
第一解码单元604,用于从目标编码信息中提取编码原始信息,使用第一解码方式将编码原始信息进行解码,得到原始信息。The first decoding unit 604 is configured to extract the encoded original information from the target encoding information, and decode the encoded original information by using the first decoding manner to obtain original information.
第二解码单元605,用于从目标编码信息中提取编码认证信息,使用第二解码方式将编码认证信息进行解码,得到认证信息。The second decoding unit 605 is configured to extract the encoded authentication information from the target encoding information, and decode the encoded authentication information by using the second decoding method to obtain the authentication information.
发送单元606,用于将认证信息发往认证平台进行认证。The sending unit 606 is configured to send the authentication information to the authentication platform for authentication.
本发明实施例中,当终端扫描经过非法复制的二维码图像时,经过非法复制的二维码图像中的认证信息容易出错或丢失,导致非法复制的二维码图像中的认证信息无法通过认证,从而达到防止二维码被非法复制的目的,可以提高二维码使用的安全性。 In the embodiment of the present invention, when the terminal scans the illegally copied two-dimensional code image, the authentication information in the illegally copied two-dimensional code image is prone to error or loss, and the authentication information in the illegally copied two-dimensional code image cannot pass. The purpose of authentication is to prevent the two-dimensional code from being illegally copied, and the security of the use of the two-dimensional code can be improved.
本发明实施例中,当终端扫描经过非法复制的二维码图像时,经过非法复制的二维码图像中的认证信息容易出错或丢失,导致非法复制的二维码图像中的认证信息无法通过认证,从而达到防止二维码被非法复制的目的,可以提高二维码使用的安全性。In the embodiment of the present invention, when the terminal scans the illegally copied two-dimensional code image, the authentication information in the illegally copied two-dimensional code image is prone to error or loss, and the authentication information in the illegally copied two-dimensional code image cannot pass. The purpose of authentication is to prevent the two-dimensional code from being illegally copied, and the security of the use of the two-dimensional code can be improved.
图6所示的终端的实施可以参见图3所示的方法实施例,重复之处不再赘述。For the implementation of the terminal shown in Figure 6, reference may be made to the method embodiment shown in Figure 3, and the repeated description is omitted.
参见图7,图7是本发明实施例公开的又一种终端的结构示意图,如图7所示,该终端710包括:处理器712、通信接口713、存储器711。可选地,终端710还可以包括总线715。其中,通信接口713、处理器712以及存储器711可以通过总线715相互连接;总线715可以是外设部件互连标准(Peripheral Component Interconnect,简称PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,简称EISA)总线等。所述总线715可以分为地址总线、数据总线、控制总线等。为便于表示,图7中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。Referring to FIG. 7, FIG. 7 is a schematic structural diagram of another terminal according to an embodiment of the present invention. As shown in FIG. 7, the terminal 710 includes a processor 712, a communication interface 713, and a memory 711. Optionally, terminal 710 can also include a bus 715. The communication interface 713, the processor 712, and the memory 711 may be connected to each other through a bus 715. The bus 715 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (abbreviated). EISA) bus and so on. The bus 715 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 7, but it does not mean that there is only one bus or one type of bus.
参见图8,图8是本发明实施例公开的一种移动终端的结构示意图。如图8所示,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。该移动终端可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑等任意终端设备,以移动终端为手机为例:Referring to FIG. 8, FIG. 8 is a schematic structural diagram of a mobile terminal according to an embodiment of the present invention. As shown in FIG. 8 , for the convenience of description, only parts related to the embodiment of the present invention are shown. If the specific technical details are not disclosed, please refer to the method part of the embodiment of the present invention. The mobile terminal can be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, and the mobile terminal is used as a mobile phone as an example:
图8示出的是与本发明实施例提供的移动终端相关的手机的部分结构的框图。参考图8,手机包括:射频(Radio Frequency,RF)电路910、存储器920、输入单元930、显示单元940、传感器950、音频电路960、无线保真(Wireless Fidelity,WiFi)模块970、处理器980、电源990以及摄像头9110等部件。本领域技术人员可以理解,图8中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。下面结合图8对手机的各个构成部件进行具体的介绍: FIG. 8 is a block diagram showing a partial structure of a mobile phone related to a mobile terminal provided by an embodiment of the present invention. Referring to FIG. 8 , the mobile phone includes: a radio frequency (RF) circuit 910 , a memory 920 , an input unit 930 , a display unit 940 , a sensor 950 , an audio circuit 960 , a wireless fidelity (WiFi) module 970 , and a processor 980 . , power supply 990 and camera 9110 and other components. It will be understood by those skilled in the art that the structure of the handset shown in FIG. 8 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different component arrangements. The following describes the components of the mobile phone in detail with reference to FIG. 8:
RF电路910可用于信息的接收和发送。通常,RF电路910包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路910还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE)、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF circuit 910 can be used for receiving and transmitting information. Generally, RF circuit 910 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuitry 910 can also communicate with the network and other devices via wireless communication. The above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), E-mail, Short Messaging Service (SMS), and the like.
存储器920可用于存储软件程序以及模块,处理器980通过运行存储在存储器920的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器920可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据手机的使用所创建的数据等。此外,存储器920可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 920 can be used to store software programs and modules, and the processor 980 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 920. The memory 920 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function, and the like; the storage data area may store data created according to usage of the mobile phone, and the like. Moreover, memory 920 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
输入单元930可用于接收输入的数字或字符信息,以及产生与手机的用户设置以及功能控制有关的键信号输入。具体地,输入单元930可包括指纹识别模组931以及其他输入设备932。指纹识别模组931,可采集用户在其上的指纹数据。除了指纹识别模组931,输入单元930还可以包括其他输入设备932。具体地,其他输入设备932可以包括但不限于触控屏、物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 930 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function controls of the handset. Specifically, the input unit 930 can include a fingerprint identification module 931 and other input devices 932. The fingerprint identification module 931 can collect fingerprint data of the user. In addition to the fingerprint recognition module 931, the input unit 930 may also include other input devices 932. Specifically, other input devices 932 may include, but are not limited to, one or more of a touch screen, a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
显示单元940可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元940可包括显示屏941,可选地,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting  Diode,OLED)等形式来配置显示屏941。虽然在图8中,指纹识别模组931与显示屏941是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将指纹识别模组931与显示屏941集成而实现手机的输入和播放功能。The display unit 940 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone. The display unit 940 can include a display screen 941. Alternatively, a liquid crystal display (LCD) or an organic light emitting diode (Organic Light-Emitting) can be used. The display screen 941 is configured in the form of Diode, OLED, or the like. Although in FIG. 8, the fingerprint recognition module 931 and the display screen 941 function as two separate components to implement the input and input functions of the mobile phone, in some embodiments, the fingerprint recognition module 931 and the display screen 941 can be implemented. Integrated to achieve the input and playback functions of the phone.
手机还可包括至少一种传感器950,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示屏941的亮度,接近传感器可在手机移动到耳边时,关闭显示屏941和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The handset may also include at least one type of sensor 950, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen 941 according to the brightness of the ambient light, and the proximity sensor may turn off the display screen 941 and/or when the mobile phone moves to the ear. Or backlight. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity. It can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the mobile phone can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, no longer Narration.
音频电路960、扬声器961,传声器962可提供用户与手机之间的音频接口。音频电路960可将接收到的音频数据转换后的电信号,传输到扬声器961,由扬声器961转换为声音信号播放;另一方面,传声器962将收集的声音信号转换为电信号,由音频电路960接收后转换为音频数据,再将音频数据播放处理器980处理后,经RF电路910以发送给比如另一手机,或者将音频数据播放至存储器920以便进一步处理。An audio circuit 960, a speaker 961, and a microphone 962 can provide an audio interface between the user and the handset. The audio circuit 960 can transmit the converted electrical data of the received audio data to the speaker 961 for conversion to the sound signal by the speaker 961; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal by the audio circuit 960. After receiving, it is converted into audio data, and then processed by the audio data playback processor 980, sent to the other mobile phone via the RF circuit 910, or played back to the memory 920 for further processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块970可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图8示出了WiFi模块970,但是可以理解的是,其并不属于手机的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-range wireless transmission technology, and the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 970, which provides users with wireless broadband Internet access. Although FIG. 8 shows the WiFi module 970, it can be understood that it does not belong to the essential configuration of the mobile phone, and may be omitted as needed within the scope of not changing the essence of the invention.
处理器980是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器920内的软件程序和/或模块,以及调用存储在存储器920内的数据,执行手机的各种功能和处理数据,从而对手 机进行整体监控。可选地,处理器980可包括一个或多个处理单元;优选的,处理器980可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器980中。The processor 980 is the control center of the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 920, and invoking data stored in the memory 920, executing Mobile phone's various functions and processing data to rival The machine performs overall monitoring. Optionally, the processor 980 may include one or more processing units; preferably, the processor 980 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like. The modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 980.
手机还包括给各个部件供电的电源990(比如电池),优选的,电源可以通过电源管理系统与处理器980逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The handset also includes a power source 990 (such as a battery) that supplies power to the various components. Preferably, the power source can be logically coupled to the processor 980 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
摄像头9110可以进行拍照和摄像等,在扫描二维码图像时,摄像头9110开启并扫描二维码图像。The camera 9110 can perform photographing, photographing, and the like. When scanning the two-dimensional code image, the camera 9110 turns on and scans the two-dimensional code image.
尽管未示出,手机还可以包括蓝牙模块等,在此不再赘述。Although not shown, the mobile phone may further include a Bluetooth module and the like, and details are not described herein again.
前述图1~图4所示的实施例中,各步骤方法流程可以基于该手机的结构实现。In the foregoing embodiments shown in FIG. 1 to FIG. 4, each step method flow can be implemented based on the structure of the mobile phone.
前述图5和图6所示的实施例中,各单元功能可以基于该手机的结构实现。In the foregoing embodiments shown in FIG. 5 and FIG. 6, each unit function can be implemented based on the structure of the mobile phone.
本发明实施例还提供一种计算机存储介质,其中,该计算机存储介质可存储有程序,该程序执行时包括上述方法实施例中记载的任何一种二维码生成方法、二维码解码方法的部分或全部步骤。The embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes any one of the two-dimensional code generation method and the two-dimensional code decoding method described in the foregoing method embodiments. Some or all of the steps.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should understand that the present invention is not limited by the described action sequence. Because certain steps may be performed in other sequences or concurrently in accordance with the present invention. In addition, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above embodiments, the descriptions of the various embodiments are different, and the details that are not detailed in a certain embodiment can be referred to the related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所 述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided herein, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the device embodiments described above are merely illustrative, such as The division of the elements is only a logical function division, and the actual implementation may have another division manner. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present invention may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a memory. A number of instructions are included to cause a computer device (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing memory includes: a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and the like, which can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取器(英文:Random Access Memory,简 称:RAM)、磁盘或光盘等。A person skilled in the art can understand that all or part of the steps of the foregoing embodiments can be completed by a program to instruct related hardware, and the program can be stored in a computer readable memory, and the memory can include: a flash drive , read-only memory (English: Read-Only Memory, referred to as: ROM), random accessor (English: Random Access Memory, Jane Called: RAM), disk or CD.
以上对本发明实施例进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The embodiments of the present invention have been described in detail above, and the principles and implementations of the present invention are described in detail herein. The description of the above embodiments is only for helping to understand the method of the present invention and its core ideas; It should be understood by those skilled in the art that the present invention is not limited by the scope of the present invention.
以下将参照根据本发明实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述本发明。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机程序指令实现。这些计算机程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些计算机程序指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。The invention will be described below with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or FIG. The computer program instructions may be provided to a general purpose computer, a special purpose computer or a processor of other programmable data processing apparatus to produce a machine such that when executed by a processor of a computer or other programmable data processing apparatus Means for implementing the functions/acts specified in one or more of the blocks of the flowcharts and/or block diagrams.
也可以把这些计算机程序指令存储在计算机可读介质中,这些指令使得计算机、其它可编程数据处理装置、或其他设备以特定方式工作,从而,存储在计算机可读介质中的指令就产生出包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的指令的制造品(article of manufacture)。The computer program instructions can also be stored in a computer readable medium that causes a computer, other programmable data processing device, or other device to operate in a particular manner, such that instructions stored in the computer readable medium are An article of manufacture that implements the instructions of the functions/actions specified in one or more of the blocks of the flowcharts and/or block diagrams.
计算机程序指令也可以被加载到计算机、其它可编程数据处理装置或其它设备上以使得一系列操作步骤得以在计算机、其它可编程数据处理装置或其它设备上执行,以产生计算机实现的处理,从而使得在计算机或其它可编程装置上执行的指令提供处理以便实施流程图和/或框图中的一个或多个方框中所指定的功能/动作。The computer program instructions can also be loaded onto a computer, other programmable data processing device, or other device to cause a series of operational steps to be performed on a computer, other programmable data processing device or other device to produce computer-implemented processing, thereby The instructions executed on a computer or other programmable device are provided for processing to implement the functions/acts specified in one or more of the blocks of the flowcharts and/or block diagrams.
附图中的流程图和框图显示了根据本发明的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指 令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the invention. In this regard, each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable make. It should also be noted that in some alternative implementations, the functions noted in the blocks may also occur in a different order than that illustrated in the drawings. For example, two consecutive blocks may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts, can be implemented in a dedicated hardware-based system that performs the specified function or function. Or it can be implemented by a combination of dedicated hardware and computer instructions.
这里所使用的术语仅是出于描述特定实施例的目的使用,而并非意在对本发明进行限制。如这里所使用的,除非上下文中另外明确指出,否则单数形式“一个”或者“该”意在也包括复数形式。将要进一步理解的是,当在该说明书中使用时,术语“包括”和/或“包括了”表明存在所指出的特征、整数、步骤、操作、要素和/或组件,而并不排除存在或增加一个或多个其它特征、整数、步骤、操作、要素、组件和/或其群组。 The terminology used herein is for the purpose of describing particular embodiments, and is not intended to limit the invention. As used herein, the sing " It will be further understood that the terms "comprising" and "comprising", "the"," One or more other features, integers, steps, operations, elements, components, and/or groups thereof are added.

Claims (13)

  1. 一种二维码生成方法,其特征在于,包括:A two-dimensional code generation method, comprising:
    准备原始信息和与所述原始信息不同的认证信息,其中所述认证信息的容量小于所述原始信息的容量的规定比例;Preparing original information and authentication information different from the original information, wherein the capacity of the authentication information is less than a prescribed ratio of the capacity of the original information;
    将所述认证信息嵌入于所述原始信息,得到目标信息;Embedding the authentication information in the original information to obtain target information;
    对所述目标信息进行调制以得到目标比特流;并且Modulating the target information to obtain a target bitstream; and
    按照预设的生成算法将所述目标比特流转换为二维码图像。The target bit stream is converted into a two-dimensional code image according to a preset generation algorithm.
  2. 根据权利要求1所述的方法,其特征在于,The method of claim 1 wherein
    将所述编码认证信息按某种嵌入策略嵌入所述编码原始信息中,得到目标编码信息。Embedding the encoded authentication information into the encoded original information according to an embedding strategy to obtain target encoding information.
  3. 根据权利要求1所述的方法,其特征在于,The method of claim 1 wherein
    将所述编码原始信息中的部分信息用所述编码认证信息进行替换,得到目标编码信息。The partial information in the encoded original information is replaced with the encoded authentication information to obtain target encoded information.
  4. 根据权利要求1至3中的任一项所述的方法,其特征在于,A method according to any one of claims 1 to 3, characterized in that
    所述认证信息的容量小于所述原始信息的容量的规定比例。The capacity of the authentication information is less than a prescribed ratio of the capacity of the original information.
  5. 一种二维码解码方法,其特征在于,包括:A two-dimensional code decoding method, comprising:
    拍摄二维码图像,对所述二维码图像进行图像恢复,得到还原后的二维码图像;Taking a two-dimensional code image, performing image restoration on the two-dimensional code image, and obtaining a restored two-dimensional code image;
    按照预设的比特流生成算法将所述还原后的二维码图像转换为目标比特流;Converting the restored two-dimensional code image into a target bit stream according to a preset bitstream generation algorithm;
    对所述目标比特流进行解调,得到目标编码信息;Demodulating the target bit stream to obtain target coding information;
    从所述目标编码信息中提取编码原始信息,使用第一解码方式将所述编码原始信息进行解码,得到原始信息; Extracting original information from the target encoding information, and decoding the encoded original information by using a first decoding manner to obtain original information;
    从所述目标编码信息中提取编码认证信息,使用第二解码方式将所述编码认证信息进行解码,得到认证信息。The encoded authentication information is extracted from the target encoding information, and the encoded authentication information is decoded using a second decoding method to obtain authentication information.
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:The method of claim 5, wherein the method further comprises:
    将所述认证信息发往认证平台进行认证。The authentication information is sent to the authentication platform for authentication.
  7. 一种终端,其特征在于,包括:A terminal, comprising:
    第一编码单元,用于使用第一编码方式将原始信息进行编码,得到编码原始信息;a first coding unit, configured to encode the original information by using a first coding manner to obtain coded original information;
    第二编码单元,用于使用第二编码方式将认证信息进行编码,得到编码认证信息,所述第一编码方式与所述第二编码方式不相同;a second coding unit, configured to encode the authentication information by using a second coding manner, to obtain coded authentication information, where the first coding mode is different from the second coding mode;
    嵌入单元,用于将所述编码认证信息嵌入所述编码原始信息中,得到目标编码信息;An embedding unit, configured to embed the encoded authentication information into the encoded original information to obtain target encoding information;
    调制单元,用于对所述目标编码信息进行调制,得到目标比特流;a modulating unit, configured to modulate the target coding information to obtain a target bitstream;
    转换单元,用于按照预设的二维码生成算法将所述目标比特流转换为二维码。And a converting unit, configured to convert the target bit stream into a two-dimensional code according to a preset two-dimensional code generation algorithm.
  8. 根据权利要求7所述的终端,其特征在于,所述嵌入单元将所述编码认证信息嵌入所述编码原始信息中,得到目标编码信息的方式具体为:The terminal according to claim 7, wherein the embedding unit embeds the encoded authentication information into the encoded original information, and the manner of obtaining the target encoding information is specifically:
    所述嵌入单元将所述编码认证信息按某种嵌入策略嵌入所述编码原始信息中,得到目标编码信息。The embedding unit embeds the encoded authentication information into the encoded original information according to a certain embedding strategy to obtain target encoding information.
  9. 根据权利要求7所述的终端,其特征在于,所述嵌入单元将所述编码认证信息嵌入所述编码原始信息中,得到目标编码信息的方式具体为:The terminal according to claim 7, wherein the embedding unit embeds the encoded authentication information into the encoded original information, and the manner of obtaining the target encoding information is specifically:
    所述嵌入单元将所述编码原始信息中的部分信息用所述编码认证信息进行替换,得到目标编码信息。 The embedding unit replaces part of the information in the original encoding information with the encoding authentication information to obtain target encoding information.
  10. 根据权利要求7-9任一项所述的终端,其特征在于,所述认证信息的容量小于二维码的纠错容量。The terminal according to any one of claims 7 to 9, characterized in that the capacity of the authentication information is smaller than the error correction capacity of the two-dimensional code.
  11. 一种终端,其特征在于,包括:A terminal, comprising:
    扫描恢复单元,用于扫描二维码图像,对所述二维码图像进行图像恢复,得到还原后的二维码图像;a scan recovery unit, configured to scan a two-dimensional code image, perform image restoration on the two-dimensional code image, and obtain a restored two-dimensional code image;
    转换单元,用于按照预设的比特流生成算法将所述还原后的二维码图像转换为目标比特流;a converting unit, configured to convert the restored two-dimensional code image into a target bit stream according to a preset bitstream generation algorithm;
    解调单元,用于对所述目标比特流进行解调,得到目标编码信息;a demodulation unit, configured to demodulate the target bit stream to obtain target coding information;
    第一解码单元,用于从所述目标编码信息中提取编码原始信息,使用第一解码方式将所述编码原始信息进行解码,得到原始信息;a first decoding unit, configured to extract encoded original information from the target encoding information, and decode the encoded original information by using a first decoding manner to obtain original information;
    第二解码单元,用于从所述目标编码信息中提取编码认证信息,使用第二解码方式将所述编码认证信息进行解码,得到认证信息。And a second decoding unit, configured to extract the encoded authentication information from the target encoding information, and decode the encoded authentication information by using a second decoding manner to obtain the authentication information.
  12. 根据权利要求11所述的终端,其特征在于,所述终端还包括:The terminal according to claim 11, wherein the terminal further comprises:
    发送单元,用于将所述认证信息发往认证平台进行认证。And a sending unit, configured to send the authentication information to the authentication platform for authentication.
  13. 一种二维码生成方法,其特征在于,包括:A two-dimensional code generation method, comprising:
    使用第一编码方式将原始信息进行编码,得到编码原始信息;Encoding the original information using the first encoding method to obtain the encoded original information;
    使用第二编码方式将认证信息进行编码,得到编码认证信息,所述第一编码方式与所述第二编码方式不相同;Encoding the authentication information by using the second encoding manner to obtain encoding authentication information, where the first encoding manner is different from the second encoding manner;
    将所述编码认证信息嵌入所述编码原始信息中,得到目标编码信息;Embedding the encoded authentication information into the encoded original information to obtain target encoded information;
    将所述目标编码信息进行调制,得到目标比特流;Modulating the target coding information to obtain a target bitstream;
    按照预设的二维码生成算法将所述目标比特流转换为二维码图像。 The target bit stream is converted into a two-dimensional code image according to a preset two-dimensional code generation algorithm.
PCT/CN2017/111211 2017-11-15 2017-11-15 Two-dimensional code generation method, two-dimensional code decoding method, and terminal WO2019095170A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/111211 WO2019095170A1 (en) 2017-11-15 2017-11-15 Two-dimensional code generation method, two-dimensional code decoding method, and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/111211 WO2019095170A1 (en) 2017-11-15 2017-11-15 Two-dimensional code generation method, two-dimensional code decoding method, and terminal

Publications (1)

Publication Number Publication Date
WO2019095170A1 true WO2019095170A1 (en) 2019-05-23

Family

ID=66539200

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/111211 WO2019095170A1 (en) 2017-11-15 2017-11-15 Two-dimensional code generation method, two-dimensional code decoding method, and terminal

Country Status (1)

Country Link
WO (1) WO2019095170A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923701A (en) * 2010-07-19 2010-12-22 西安建筑科技大学 Anti-counterfeiting authentication method of anti-counterfeiting image of printed matter based on digital watermarking technology
CN102799989A (en) * 2012-06-19 2012-11-28 袁开国 Product source tracing scheme based on PKI (Public Key Infrastructure) and two-dimensional codes
US20140115708A1 (en) * 2012-10-18 2014-04-24 Dell Products L.P. Secure information handling system matrix bar code
CN106452756A (en) * 2016-11-08 2017-02-22 王栋 Construction verification method and device capable of verifying security two-dimensional code offline

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923701A (en) * 2010-07-19 2010-12-22 西安建筑科技大学 Anti-counterfeiting authentication method of anti-counterfeiting image of printed matter based on digital watermarking technology
CN102799989A (en) * 2012-06-19 2012-11-28 袁开国 Product source tracing scheme based on PKI (Public Key Infrastructure) and two-dimensional codes
US20140115708A1 (en) * 2012-10-18 2014-04-24 Dell Products L.P. Secure information handling system matrix bar code
CN106452756A (en) * 2016-11-08 2017-02-22 王栋 Construction verification method and device capable of verifying security two-dimensional code offline

Similar Documents

Publication Publication Date Title
CN107909133B (en) Two-dimensional code generation method, two-dimensional code decoding method and terminal
US9143936B2 (en) Mobile device digital communication and authentication methods
Saxena et al. Secure device pairing based on a visual channel
US8572375B2 (en) Device pairing based on graphically encoded data
KR102056576B1 (en) Invisible optical label for transmitting information between computing devices
CN204965434U (en) A strong authentication token for generating safe value of developments
EP2678799B1 (en) Method and apparatus for encoding and decoding data transmitted to an authentication token
CN108769027B (en) Secure communication method, device, mobile terminal and storage medium
KR101608184B1 (en) Authentication server, authentication system, authentication method, and program
CN104202745B (en) A kind of shared method, terminal and communication system of radio network configuration information
JP2008544710A (en) Method and apparatus for implementing encryption
JP5973808B2 (en) Information processing device, terminal device, information processing system, information processing method, and computer program
CN104702437A (en) Device for using two-dimensional code to perform network configuration for equipment
CN111432218B (en) Video encoding and decoding method, device, terminal and storage medium
WO2015117352A1 (en) Data processing method, data sending and receiving terminal, and data transmission system
Apau et al. Design of image steganography based on RSA algorithm and LSB insertion for android smartphones
JP6229667B2 (en) Information code reading system and information code reading device
CN103188068A (en) Digital content sending method, digital content sending device, digital content receiving method and digital content receiving device
WO2019095170A1 (en) Two-dimensional code generation method, two-dimensional code decoding method, and terminal
CN109785218B (en) QR code-based physical domain image steganography method and device
Shin et al. A survey of image hashing technique for data authentication in WMSNs
CN109840574B (en) Two-dimensional code information hiding method and device, electronic equipment and storage medium
KR20180005578A (en) Apparatus and method for detecting leakage of information
CN109391616B (en) Information management method and terminal
CN111090894B (en) Method and device for reconstructing data of lock card

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17932077

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 19/08/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17932077

Country of ref document: EP

Kind code of ref document: A1