Movatterモバイル変換


[0]ホーム

URL:


CN106530206B - Image encryption and decryption method and device based on optical encryption and decryption technology - Google Patents

Image encryption and decryption method and device based on optical encryption and decryption technology
Download PDF

Info

Publication number
CN106530206B
CN106530206BCN201611036562.7ACN201611036562ACN106530206BCN 106530206 BCN106530206 BCN 106530206BCN 201611036562 ACN201611036562 ACN 201611036562ACN 106530206 BCN106530206 BCN 106530206B
Authority
CN
China
Prior art keywords
decimal
sequence
code
binary
segment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201611036562.7A
Other languages
Chinese (zh)
Other versions
CN106530206A (en
Inventor
邹文斌
焦述铭
庄兆永
李霞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen University
Original Assignee
Shenzhen University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen UniversityfiledCriticalShenzhen University
Priority to CN201611036562.7ApriorityCriticalpatent/CN106530206B/en
Publication of CN106530206ApublicationCriticalpatent/CN106530206A/en
Application grantedgrantedCritical
Publication of CN106530206BpublicationCriticalpatent/CN106530206B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种基于光学加密和解密技术的图像加密和解密方法及装置,该方法包括:将待加密图像转换成二进制序列码,按照预置的转换序列规则,将该二进制序列码转换成十进制序列码,按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量,将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像,这样将二维码作为图像的载体,再对该二维码进行光学加密,可以防止通过光学解密还原出的图像受到斑点噪声的干扰,进而使得解密出的图像更加清晰完整。

Figure 201611036562

The invention discloses an image encryption and decryption method and device based on optical encryption and decryption technology. The method comprises: converting an image to be encrypted into a binary sequence code, and converting the binary sequence code into a binary sequence code according to a preset conversion sequence rule Decimal serial code, divide the decimal serial code into multiple segments according to the order of the first to last digits in the decimal serial code, and set the capacity of each segment in the multiple segments to be less than or equal to the maximum size of a single QR code. capacity, convert the segment into a two-dimensional code corresponding to the segment, and perform optical encryption on the two-dimensional code, so that the encrypted two-dimensional code can be restored to the image to be encrypted through optical decryption, so that the two-dimensional code is used as the image to be encrypted. The carrier of the image, and then optically encrypting the two-dimensional code can prevent the image restored by optical decryption from being disturbed by speckle noise, thereby making the decrypted image clearer and more complete.

Figure 201611036562

Description

Translated fromChinese
基于光学加密和解密技术的图像加密和解密方法及装置Image encryption and decryption method and device based on optical encryption and decryption technology

技术领域technical field

本发明属于光学加密和解密技术领域,尤其涉及一种基于光学加密和解密技术的图像加密和解密方法及装置。The invention belongs to the technical field of optical encryption and decryption, and in particular relates to an image encryption and decryption method and device based on the optical encryption and decryption technology.

背景技术Background technique

信息加密技术可以对电子信息在传输和储存过程中进行保护,防止泄露给非法使用者。其中光学加密技术具有高并行性、高速度和多加密参数等优点,有望在未来的加密技术领域占据一席之地。对于一幅图像,常见的光学加密技术包括:双随机相位加密(DRPE,Double Random Phase Encoding),基于分数傅里叶变换(FFT,fractional Fouriertransform)的双随机相位加密,波长多路复用加密和基于相位截断的非对称加密等。Information encryption technology can protect electronic information during transmission and storage and prevent it from being leaked to illegal users. Among them, optical encryption technology has the advantages of high parallelism, high speed and multiple encryption parameters, and is expected to occupy a place in the field of encryption technology in the future. For an image, common optical encryption techniques include: double random phase encryption (DRPE, Double Random Phase Encoding), double random phase encryption based on fractional Fourier transform (FFT, fractional Fourier transform), wavelength multiplexing encryption and Asymmetric encryption based on phase truncation, etc.

但是现有技术中的光学加密技术均有一个缺点:通过上述的光学加密技术之后,再解密出原图像均会受到斑点噪声的严重干扰,进而影响解密出的图像的清晰度。However, the optical encryption technology in the prior art has a disadvantage: after the above-mentioned optical encryption technology is used, the decrypted original image will be seriously disturbed by speckle noise, thereby affecting the clarity of the decrypted image.

发明内容SUMMARY OF THE INVENTION

本发明提供一种基于光学加密和解密技术的图像加密和解密方法及装置,旨在解决因通过现有的光学加密技术解密出的图像受到斑点噪声的严重干扰,进而影响解密出的图像的清晰度的问题。The present invention provides an image encryption and decryption method and device based on optical encryption and decryption technology, aiming at solving the problem that the image decrypted by the existing optical encryption technology is seriously disturbed by speckle noise, thereby affecting the clarity of the decrypted image. degree issue.

本发明提供的一种基于光学加密和解密技术的图像加密方法,包括:将待加密图像转换成二进制序列码;按照预置的转换序列规则,将所述二进制序列码转换成十进制序列码;按照所述十进制序列码中首位到末位的顺序,将所述十进制序列码划分为多个片段,并设置所述多个片段中每一片段的容量均小于或者等于单个二维码的最大容量;将所述片段转换成与所述片段对应的二维码,并将所述二维码进行光学加密,以使已加密的二维码通过光学解密还原为所述待加密图像。An image encryption method based on optical encryption and decryption technology provided by the present invention includes: converting an image to be encrypted into a binary sequence code; converting the binary sequence code into a decimal sequence code according to a preset conversion sequence rule; In the order of the first to the last digit in the decimal sequence code, the decimal sequence code is divided into multiple segments, and the capacity of each segment in the multiple segments is set to be less than or equal to the maximum capacity of a single two-dimensional code; The segment is converted into a two-dimensional code corresponding to the segment, and the two-dimensional code is optically encrypted, so that the encrypted two-dimensional code can be restored to the to-be-encrypted image through optical decryption.

本发明提供的一种基于光学加密和解密技术的图像解密方法,包括:将待解密二维码进行光学解密,得到已解密的二维码,并将所述已解密的二维码转换为包含有十进制数码的片段;按照所述已解密的二维码中预置的片段序号,将转换后的片段进行排列,以生成十进制序列码;按照预置的转换序列规则,将所述十进制序列码转换成二进制序列码;并将已转换的二进制序列码还原为图像。An image decryption method based on optical encryption and decryption technology provided by the present invention includes: optically decrypting a two-dimensional code to be decrypted to obtain a decrypted two-dimensional code, and converting the decrypted two-dimensional code into a There are segments with decimal numbers; according to the preset segment sequence numbers in the decrypted two-dimensional code, the converted segments are arranged to generate decimal sequence codes; according to the preset conversion sequence rules, the decimal sequence codes are Convert to binary sequence code; and restore the converted binary sequence code to an image.

本发明提供的一种基于光学加密和解密技术的图像加密装置,包括:转换模块用于将待加密图像转换成二进制序列码;所述转换模块,还用于按照预置的转换序列规则,将所述二进制序列码转换成十进制序列码;划分模块用于按照所述十进制序列码中首位到末位的顺序,将所述十进制序列码划分为多个片段,并设置所述多个片段中每一片段的容量均小于或者等于单个二维码的最大容量;所述转换模块还用于将所述片段转换成与所述片段对应的二维码,并将所述二维码进行光学加密,以使已加密的二维码通过光学解密还原为所述待加密图像。An image encryption device based on optical encryption and decryption technology provided by the present invention includes: a conversion module for converting an image to be encrypted into a binary sequence code; the conversion module is also used for converting the The binary sequence code is converted into a decimal sequence code; the division module is used to divide the decimal sequence code into multiple segments according to the order of the first to the last digit in the decimal sequence code, and set each segment in the multiple segments. The capacity of a segment is smaller than or equal to the maximum capacity of a single two-dimensional code; the conversion module is further configured to convert the segment into a two-dimensional code corresponding to the segment, and perform optical encryption on the two-dimensional code, So that the encrypted two-dimensional code can be restored to the to-be-encrypted image through optical decryption.

本发明提供的一种基于光学加密和解密技术的图像解密装置,包括:转换模块用于将待解密二维码进行光学解密,得到已解密的二维码,并将所述已解密的二维码转换为包含有十进制数码的片段;生成模块用于按照所述已解密的二维码中预置的片段序号,将转换后的片段进行排列,以生成十进制序列码;所述转换模块用于按照预置的转换序列规则,将所述十进制序列码转换成二进制序列码;还原模块用于将已转换的二进制序列码还原为图像。The present invention provides an image decryption device based on optical encryption and decryption technology, comprising: a conversion module used for optically decrypting a two-dimensional code to be decrypted to obtain a decrypted two-dimensional code, and converting the decrypted two-dimensional code The code is converted into a segment containing decimal numbers; the generating module is used for arranging the converted segments according to the segment sequence number preset in the decrypted two-dimensional code to generate a decimal sequence code; the conversion module is used for According to a preset conversion sequence rule, the decimal sequence code is converted into a binary sequence code; the restoration module is used to restore the converted binary sequence code into an image.

本发明提供的基于光学加密和解密技术的图像加密和解密方法及装置,将待加密图像转换成二进制序列码,按照预置的转换序列规则,将该二进制序列码转换成十进制序列码,按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量,将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像,这样将二维码作为图像的载体,再对该二维码进行光学加密,可以防止通过光学解密还原出的图像受到斑点噪声的干扰,进而使得解密出的图像更加清晰完整。The image encryption and decryption method and device based on optical encryption and decryption technology provided by the present invention convert the to-be-encrypted image into a binary sequence code, and convert the binary sequence code into a decimal sequence code according to a preset conversion sequence rule. Divide the decimal sequence code into multiple segments, and set the capacity of each segment in the multiple segments to be less than or equal to the maximum capacity of a single QR code, convert the segment form a two-dimensional code corresponding to the segment, and optically encrypt the two-dimensional code, so that the encrypted two-dimensional code can be restored to the to-be-encrypted image through optical decryption, so that the two-dimensional code is used as the carrier of the image, and then the The two-dimensional code is optically encrypted, which can prevent the image restored by optical decryption from being disturbed by speckle noise, thereby making the decrypted image clearer and more complete.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only are some embodiments of the present invention.

图1是本发明第一实施例提供的基于光学加密和解密技术的图像加密方法的实现流程示意图;Fig. 1 is the realization flow schematic diagram of the image encryption method based on optical encryption and decryption technology provided by the first embodiment of the present invention;

图2是本发明第二实施例提供的基于光学加密和解密技术的图像加密方法的实现流程示意图;Fig. 2 is the realization flow schematic diagram of the image encryption method based on optical encryption and decryption technology provided by the second embodiment of the present invention;

图3是由图像转换为二维码过程的示意图;Fig. 3 is a schematic diagram of the process of converting an image into a two-dimensional code;

图4是本发明第三实施例提供的基于光学加密和解密技术的图像解密方法的实现流程示意图;Fig. 4 is the realization flow schematic diagram of the image decryption method based on optical encryption and decryption technology provided by the third embodiment of the present invention;

图5是图3中图像加密方法对应的图像解密方法的示意图;Fig. 5 is the schematic diagram of the image decryption method corresponding to the image encryption method in Fig. 3;

图6是本发明第四实施例提供的基于光学加密和解密技术的图像加密装置的结构示意图;6 is a schematic structural diagram of an image encryption device based on optical encryption and decryption technology provided by a fourth embodiment of the present invention;

图7是本发明第五实施例提供的基于光学加密和解密技术的图像加密装置的结构示意图;7 is a schematic structural diagram of an image encryption device based on optical encryption and decryption technology provided by a fifth embodiment of the present invention;

图8是本发明第六实施例提供的基于光学加密和解密技术的图像解密装置的结构示意图。FIG. 8 is a schematic structural diagram of an image decryption device based on an optical encryption and decryption technology provided by a sixth embodiment of the present invention.

具体实施方式Detailed ways

为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而非全部实施例。基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. The embodiments described above are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.

请参阅图1,图1为本发明第一实施例提供基于光学加密和解密技术的图像加密方法的实现流程示意图,可应用于光学加密和解密系统中,图1所示的图像加密方法,主要包括以下步骤:Please refer to FIG. 1. FIG. 1 is a schematic flowchart of the implementation of an image encryption method based on optical encryption and decryption technology according to the first embodiment of the present invention, which can be applied to an optical encryption and decryption system. The image encryption method shown in FIG. Include the following steps:

S101、将待加密图像转换成二进制序列码。S101. Convert the to-be-encrypted image into a binary sequence code.

该待加密图像为灰度图像,也可以为彩色图像。在计算机中,任何存储格式的待加密图像均可以转换为二进制序列码,该待加密图像的存储格式可以为位图文件(BMP,Bitmap)格式,也可以为个人电脑交换(PCX,Personal Computer Exchange)格式,也可以为图形交换格式(GIF,Graphics Interchange Format)格式,还可以为联合照片专家组(JPEG,Joint Photographic Expert Group)格式,还可以为其他存储格式,此处不做赘述。The to-be-encrypted image is a grayscale image or a color image. In a computer, any image to be encrypted in any storage format can be converted into a binary sequence code, and the storage format of the image to be encrypted can be either a bitmap file (BMP, Bitmap) format, or a personal computer exchange (PCX, Personal Computer Exchange) format. ) format, may also be a Graphics Interchange Format (GIF, Graphics Interchange Format) format, may also be a Joint Photographic Expert Group (JPEG, Joint Photographic Expert Group) format, or may be other storage formats, which will not be described here.

S102、按照预置的转换序列规则,将该二进制序列码转换成十进制序列码。S102. Convert the binary sequence code into a decimal sequence code according to a preset conversion sequence rule.

S103、按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量。S103: Divide the decimal sequence code into multiple segments according to the sequence of the first to the last digit in the decimal sequence code, and set the capacity of each segment in the multiple segments to be less than or equal to the maximum capacity of a single two-dimensional code.

每个片段均包含有多个十进制数码。该最大容量为固有参数,不同种类的二维码具有不同的最大容量。例如,单个传统二维码的最大容量为1167数字,单个微小二维码(Micro QR Code)的最大容量为35个数字。Each segment contains multiple decimal digits. The maximum capacity is an inherent parameter, and different types of two-dimensional codes have different maximum capacities. For example, the maximum capacity of a single traditional QR code is 1167 digits, and the maximum capacity of a single Micro QR Code is 35 digits.

S104、将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像。S104. Convert the segment into a two-dimensional code corresponding to the segment, and perform optical encryption on the two-dimensional code, so that the encrypted two-dimensional code can be restored to the image to be encrypted through optical decryption.

一个片段对应转换成一个二维码。生成的二维码均需要进行光学加密,以得到已加密的二维码。A fragment corresponds to a QR code. The generated QR code needs to be optically encrypted to obtain an encrypted QR code.

本发明实施例中,将待加密图像转换成二进制序列码;按照预置的转换序列规则,将该二进制序列码转换成十进制序列码,按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量,将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像,这样将二维码作为图像的载体,再对该二维码进行光学加密,可以防止通过光学解密还原出的图像受到斑点噪声的干扰,进而使得解密出的图像更加清晰完整。In this embodiment of the present invention, the to-be-encrypted image is converted into a binary sequence code; the binary sequence code is converted into a decimal sequence code according to a preset conversion sequence rule, and the binary sequence code is converted into a decimal sequence code according to the order of the first to the last digit in the decimal sequence code. The decimal sequence code is divided into multiple segments, and the capacity of each segment in the multiple segments is set to be less than or equal to the maximum capacity of a single QR code, the segment is converted into a QR code corresponding to the segment, and the The two-dimensional code is optically encrypted, so that the encrypted two-dimensional code can be restored to the image to be encrypted through optical decryption. In this way, the two-dimensional code is used as the carrier of the image, and then the two-dimensional code is optically encrypted to prevent optical decryption. The restored image is disturbed by speckle noise, which makes the decrypted image clearer and more complete.

请参阅图2,图2为本发明第二实施例提供的基于光学加密和解密技术的图像加密方法的实现流程示意图,可应用于光学加密和解密系统中,图2所示的基于光学加密和解密技术的图像加密方法,主要包括以下步骤:Please refer to FIG. 2. FIG. 2 is a schematic diagram of the implementation flow of the image encryption method based on the optical encryption and decryption technology provided by the second embodiment of the present invention, which can be applied to the optical encryption and decryption system. The image encryption method of decryption technology mainly includes the following steps:

S201、将待加密图像转换成二进制序列码。S201. Convert the to-be-encrypted image into a binary sequence code.

该待加密图像为灰度图像。在计算机中,任何存储格式的待加密图像均可以转换为二进制序列码,该待加密图像的存储格式可以为BMP格式,也可以为PCX格式,也可以为GIF格式,还可以为JPEG格式,还可以为其他存储格式,此处不做赘述。The to-be-encrypted image is a grayscale image. In a computer, any image to be encrypted in any storage format can be converted into a binary sequence code, and the storage format of the image to be encrypted can be BMP format, PCX format, GIF format, JPEG format, or JPEG format. Other storage formats can be used, which will not be described here.

S202、按照预置顺序从该二进制序列码中未转换成十进制数码的二进制数码开始提取四个比特。S202, extracting four bits from the binary numbers that are not converted into decimal numbers in the binary sequence code according to a preset sequence.

该预置顺序为该二进制序列码中首位到末位的排列顺序。例如,S201中由图像转换成的二进制序列码为10010101111000,则该二进制序列码的首位为位于整个序列最左侧的二进制数码1,该二进制序列码的末位为位于整个序列最右侧的二进制数码0,从该二进制序列码中提取的四个比特为1001。The preset order is the arrangement order of the first bit to the last bit in the binary sequence code. For example, the binary sequence code converted from the image in S201 is 10010101111000, then the first bit of the binary sequence code is the binary number 1 located at the leftmost of the whole sequence, and the last bit of the binary sequence code is the binary number located at the rightmost side of the whole sequence Digital 0, the four bits extracted from this binary sequence code are 1001.

S203、通过该四个比特的数值确定将二进制数码转换成十进制数码的方式。S203. Determine the method of converting the binary number into the decimal number according to the value of the four bits.

可选地,通过该四个比特的数值确定将二进制数码转换成十进制数码的方式具体为:Optionally, the method of converting the binary number into the decimal number determined by the numerical value of the four bits is specifically:

若该四个比特为1000或1001,则依据预置的二进制转十进制规则,将为1000的该四个比特转换为十进制数码8,或将为1001的该四个比特转换为十进制数码9;If the four bits are 1000 or 1001, according to the preset binary-to-decimal rules, the four bits for 1000 are converted into decimal number 8, or the four bits for 1001 are converted into decimal number 9;

若该四个比特既非1000也非1001,则重新按照该预置顺序从该二进制序列码中未转换成十进制数码的二进制数码开始提取三个比特,并依据该二进制转十进制规则将该三个比特转换为十进制数码。If the four bits are neither 1000 nor 1001, then re-extract three bits from the binary numbers that are not converted into decimal numbers in the binary sequence code according to the preset sequence, and convert the three bits according to the binary-to-decimal rule. Convert bits to decimal numbers.

预置的二进制转十进制规则为:二进制数码1000转换为十进制数码8、二进制数码1001转换为十进制数码9,二进制数码000转换为十进制数码0,二进制数码001转换为十进制数码1,二进制数码010转换为十进制数码2,二进制数码011转换为十进制数码3,二进制数码100转换为十进制数码4,二进制数码101转换为十进制数码5,二进制数码110转换为十进制数码6,二进制数码111转换为十进制数码7。The preset binary to decimal rules are: binary number 1000 is converted to decimal number 8, binary number 1001 is converted to decimal number 9, binary number 000 is converted to decimal number 0, binary number 001 is converted to decimal number 1, and binary number 010 is converted to decimal number 1. Decimal number 2, binary number 011 is converted to decimal number 3, binary number 100 is converted to decimal number 4, binary number 101 is converted to decimal number 5, binary number 110 is converted to decimal number 6, binary number 111 is converted to decimal number 7.

S204、继续执行提取四个比特的过程,直至该二进制序列码中所有二进制数码均转换成十进制数码。S204. Continue to perform the process of extracting four bits until all binary numbers in the binary sequence code are converted into decimal numbers.

以二进制序列码10010101111000为例进行说明步骤S202-步骤S203,首先按照预置顺序从序列中提取未转换的四个比特1001,并直接将1001转换成十进制数码9;继续按照预置顺序提取未转换的四个比特0101,该四个比特既不是1000也不是1001,那么按照预置顺序重新提取未转换的三个比特010,并将010转换为十进制数码2;然后继续按照预置顺序从序列中提取未转换的四个比特1111,该四个比特既不是1000也不是1001,那么按照预置顺序重新提取未转换的三个比特111,并将111转换为十进制数码7;再继续按照预置顺序从序列中提取未转换的四个比特1000,并直接将1000转换为十进制数码8。Taking the binary sequence code 10010101111000 as an example to illustrate steps S202-S203, first extract the unconverted four bits 1001 from the sequence according to the preset order, and directly convert the 1001 into the decimal number 9; continue to extract the unconverted bits according to the preset order The four bits are 0101, which are neither 1000 nor 1001, then re-extract the unconverted three bits 010 according to the preset order, and convert 010 to decimal number 2; then continue to follow the preset order from the sequence Extract the unconverted four bits 1111, which are neither 1000 nor 1001, then re-extract the unconverted three bits 111 according to the preset order, and convert 111 to the decimal number 7; continue to follow the preset order Extract the unconverted four bits 1000 from the sequence and directly convert 1000 to decimal digit 8.

S205、按照转换的前后顺序对得到的十进制数码进行排列,得到该十进制序列码。S205, arranging the obtained decimal numbers according to the sequence before and after the conversion to obtain the decimal serial code.

按照转换的前后顺序是将先转换得到的十进制数码排列在前面,后转换得到的十进制数码排列在后面,例如,以上述步骤S204中转换得到的十进制数码为例,按照转换的前后顺序进行排列得到的十进制序列码为:9278。According to the order of conversion, the first converted decimal number is arranged in the front, and the latter converted decimal number is arranged in the back. For example, taking the converted decimal number in the above step S204 as an example, according to the conversion order The decimal serial code is: 9278.

S206、按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量。S206: Divide the decimal sequence code into multiple segments according to the sequence of the first to the last digit in the decimal sequence code, and set the capacity of each segment in the multiple segments to be less than or equal to the maximum capacity of a single two-dimensional code.

每个片段包含多个十进制数码。十进制序列码中首位到末位的顺序与二进制序列码中首位到末位的顺序两者之间的方向是一致的,例如,十进制序列码为9278,则十进制序列码的首位为9,末位为8。每个片段的容量必须小于或者等于单个二维码的最大容量,例如,假设单个二维码的最大容量为2个数字,十进制序列码为9278,则划分的两个片段分别为:片段A中包括9和2,片段B中包括7和8;假设单个二维码的最大容量是3个数字,则共有两种划分方式,第一种划分方式为:片段A中包括9和2,片段B中包括7和8;第二种划分方式为:片段A中包括9、2和7,片段B中包括8。Each segment contains multiple decimal digits. The order of the first to last digit in the decimal sequence code is consistent with the order of the first to the last digit in the binary sequence code. For example, if the decimal sequence code is 9278, the first digit of the decimal sequence code is 9, and the last digit is 8. The capacity of each segment must be less than or equal to the maximum capacity of a single QR code. For example, assuming that the maximum capacity of a single QR code is 2 digits and the decimal serial code is 9278, the two divided segments are: segment A It includes 9 and 2, and segment B includes 7 and 8; assuming that the maximum capacity of a single QR code is 3 numbers, there are two division methods. The first division method is: segment A includes 9 and 2, and segment B includes Including 7 and 8; the second division method is: segment A includes 9, 2 and 7, and segment B includes 8.

S207、将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像。S207: Convert the segment into a two-dimensional code corresponding to the segment, and perform optical encryption on the two-dimensional code, so that the encrypted two-dimensional code can be restored to the to-be-encrypted image through optical decryption.

S208、按照该十进制序列码中各十进制数码的排列顺序,对每个片段对应的二维码插入预置的片段序号,以使在解密时将划分的片段按照该片段序号还原十进制序列码。S208. Insert a preset segment sequence number into the two-dimensional code corresponding to each segment according to the arrangement order of the decimal numbers in the decimal sequence code, so that the divided segments are restored to the decimal sequence code according to the segment sequence number during decryption.

一个片段对应转换为一个二维码。片段序号是用于表示片段排列的前后顺序。该片段序号可以是以数字的形式表示,如1、2、3….N,数字越小,排列越往前,该片段序号也可以使用罗马数字,还可以自定义带有排列顺序的字符。例如,十进制序列码为9278,片段A中包括9和2,片段B中包括7和8,则片段A的片段序号为1,片段B的片段序号为2,那么片段A排列在前面,片段B排列在后面。通过片段序号可以确保在解密时由片段生成的十进制序列码中各数码的顺序与加密时的十进制序列码中各数码的顺序一致。A fragment corresponds to a QR code. The segment number is used to indicate the sequence in which the segments are arranged. The segment serial number can be represented in the form of numbers, such as 1, 2, 3....N. The smaller the number, the more advanced the arrangement is. The segment serial number can also use Roman numerals, and you can also customize the characters with the arrangement order. For example, if the decimal sequence code is 9278, segment A includes 9 and 2, and segment B includes 7 and 8, then the segment number of segment A is 1, and the segment number of segment B is 2, then segment A is arranged first, segment B Arranged at the back. The sequence number of the segment can ensure that the sequence of the digits in the decimal sequence code generated by the segment during decryption is consistent with the sequence of the digits in the decimal sequence code during encryption.

图3为由图像转换为二维码过程的示意图。如图3所示,下面以一个实际例子对上述步骤S201-步骤S208进行说明,具体如下:FIG. 3 is a schematic diagram of the process of converting an image into a two-dimensional code. As shown in FIG. 3 , the above steps S201 to S208 are described below with an actual example, and the details are as follows:

步骤1:将待加密图像转换为001110100010011110110010010001000的二进制序列码;Step 1: Convert the image to be encrypted into a binary sequence code of 001110100010011110110010010001000;

步骤2:按照预置顺序从该二进制序列码中未转换成十进制数码的二进制数码开始提取四个比特0011;Step 2: start to extract four bits 0011 from the binary number that is not converted into decimal number in this binary sequence code according to the preset order;

步骤3:该四个比特既非1000也非1001,则重新按照该预置顺序从该二进制序列码中未转换成十进制数码的二进制数码开始提取三个比特001,并依据该进制转十进制规则将该个比特转换为十进制数码1;Step 3: If the four bits are neither 1000 nor 1001, then extract three bits of 001 from the binary number that has not been converted into a decimal number in the binary sequence code according to the preset sequence, and according to the decimal conversion rule. Convert this bit to decimal digit 1;

步骤4:继续执行步骤1,提取到的四个比特为1101,然后执行步骤3,重新提取到的三个比特为110,并将110转换为十进制数码6;Step 4: Continue to perform step 1, the extracted four bits are 1101, and then perform step 3, the three re-extracted bits are 110, and 110 is converted into decimal number 6;

步骤5:继续执行步骤1,提取到的四个比特为1000,并直接将1000转换为十进制数码8;Step 5: Continue to perform step 1, the extracted four bits are 1000, and directly convert 1000 to decimal number 8;

步骤6:继续执行步骤1,提取到的四个比特为1001,并直接将1001转换为十进制数码9;Step 6: Continue to perform step 1, the extracted four bits are 1001, and directly convert 1001 to decimal number 9;

按照上述的过程将步骤1的二进制序列码转换为十进制序列码1689731108;Convert the binary sequence code of step 1 to thedecimal sequence code 1689731108 according to the above process;

假设二维码的最大容量为4个数字,则将该十进制序列码划分成的三个片段分别为片段1、片段2和片段3,其中片段1中包括1689,片段2中包括7311,片段3中包括08,满足每个片段均小于单个二维码的最大容量;Assuming that the maximum capacity of the two-dimensional code is 4 digits, the three segments that the decimal sequence code is divided into are segment 1, segment 2 and segment 3, where segment 1 includes 1689, segment 2 includes 7311, and segment 3 08 is included, which satisfies that each segment is smaller than the maximum capacity of a single QR code;

然后将片段1转换为二维码A,将片段2转换为二维码B,将片段3转换为二维码C,其中数字1、2和3为片段序号。Then convert segment 1 into QR code A, segment 2 into QR code B, and convert segment 3 into QR code C, where the numbers 1, 2, and 3 are segment serial numbers.

需要说明的是,上述划分片段的方式仅仅是一个举例,在满足划分出的每一片段均小于单个二维码的最大容量的情况下,可以选择其他划分方式。It should be noted that the above method of dividing segments is only an example, and other dividing methods may be selected under the condition that each segment is smaller than the maximum capacity of a single two-dimensional code.

本发明实施例中,将待加密图像转换成二进制序列码,按照预置顺序从该二进制序列码中未转换成十进制数码的二进制数码开始提取四个比特,通过该四个比特的数值确定将二进制数码转换成十进制数码的方式,继续执行提取四个比特的过程,直至该二进制序列码中所有二进制数码均转换成十进制数码,按照转换的前后顺序对得到的十进制数码进行排列,得到该十进制序列码,按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量,将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像,按照该十进制序列码中各十进制数码的排列顺序,对每个片段对应的二维码插入预置的片段序号,以使在解密时将划分的片段按照该片段序号还原十进制序列码,这样将二维码作为图像的载体,再对该二维码进行光学加密,可以防止通过光学解密还原出的图像受到斑点噪声的干扰,进而使得解密出的图像更加清晰完整。In the embodiment of the present invention, the image to be encrypted is converted into a binary sequence code, and four bits are extracted from the binary code that is not converted into a decimal number in the binary sequence code according to a preset sequence, and the binary code is determined by the value of the four bits. The method of converting the numbers into decimal numbers, continue to perform the process of extracting four bits, until all the binary numbers in the binary sequence code are converted into decimal numbers, and arrange the obtained decimal numbers in the order before and after the conversion to obtain the decimal sequence code. , divide the decimal sequence code into multiple segments in the order of the first to the last digit in the decimal sequence code, and set the capacity of each segment in the multiple segments to be less than or equal to the maximum capacity of a single QR code, and set the The fragment is converted into a two-dimensional code corresponding to the fragment, and the two-dimensional code is optically encrypted, so that the encrypted two-dimensional code can be restored to the to-be-encrypted image through optical decryption. Insert the preset segment sequence number into the corresponding QR code of each segment, so that when decrypting, the divided segments are restored to the decimal sequence code according to the segment sequence number, so that the QR code is used as the carrier of the image, and then the The two-dimensional code is optically encrypted, which can prevent the image restored by optical decryption from being disturbed by speckle noise, thereby making the decrypted image clearer and more complete.

请参阅图4,图4为本发明第三实施例提供基于光学加密和解密技术的图像解密方法的实现流程示意图,可应用于光学加密和解密系统中,图4所示的基于光学加密和解密技术的图像解密方法,主要包括以下步骤:Please refer to FIG. 4. FIG. 4 is a schematic diagram of the implementation flow of the image decryption method based on the optical encryption and decryption technology provided by the third embodiment of the present invention, which can be applied to the optical encryption and decryption system. The technical image decryption method mainly includes the following steps:

S401、将待解密二维码进行光学解密,得到已解密的二维码,并将该已解密的二维码转换为包含有十进制数码的片段。S401. Perform optical decryption on the to-be-decrypted two-dimensional code to obtain a decrypted two-dimensional code, and convert the decrypted two-dimensional code into a segment containing decimal numbers.

S402、按照该已解密的二维码中预置的片段序号,将转换后的片段进行排列,以生成十进制序列码。S402. Arrange the converted segments according to the segment sequence numbers preset in the decrypted two-dimensional code to generate a decimal sequence code.

S403、按照预置的转换序列规则,将该十进制序列码转换成二进制序列码;S403, converting the decimal sequence code into a binary sequence code according to a preset conversion sequence rule;

S404、将已转换的二进制序列码还原为图像。S404, restore the converted binary sequence code to an image.

该步骤S401-步骤S404的解密方法与上述图1和图2所示的实施例中图像加密方法对应,相关内容请参照上述的图1和图2实施例的描述,此处不再赘述。The decryption method in steps S401 to S404 corresponds to the image encryption method in the embodiment shown in FIG. 1 and FIG. 2 . For related content, please refer to the description of the embodiment in FIG. 1 and FIG. 2 , which will not be repeated here.

图5为与图3中图像加密方法对应的图像解密方法的示意图。FIG. 5 is a schematic diagram of an image decryption method corresponding to the image encryption method in FIG. 3 .

本发明实施例中,将待解密二维码进行光学解密,得到已解密的二维码,并将该已解密的二维码转换为包含有十进制数码的片段,按照该已解密的二维码中预置的片段序号,将转换后的片段进行排列,以生成十进制序列码,按照预置的转换序列规则,将该十进制序列码转换成二进制序列码,将已转换的二进制序列码还原为图像,这样先对二维码进行光学解密,再将已解密的二维码还原出图像可以防止斑点噪声的干扰,进而使得解密出的图像更加清晰完整,同时利用片段序号可以更加准确的将片段还原成加密时的十进制序列码。In the embodiment of the present invention, the two-dimensional code to be decrypted is optically decrypted to obtain a decrypted two-dimensional code, and the decrypted two-dimensional code is converted into a fragment containing decimal numbers. According to the decrypted two-dimensional code Arrange the converted segments to generate a decimal sequence code, convert the decimal sequence code into a binary sequence code according to the preset conversion sequence rules, and restore the converted binary sequence code to an image In this way, the QR code is optically decrypted first, and then the decrypted QR code is restored to the image to prevent the interference of speckle noise, thereby making the decrypted image clearer and more complete. At the same time, the fragment sequence number can be used to restore the fragment more accurately. into a decimal sequence code for encryption.

请参阅图6,图6是本发明第四实施例提供的基于光学加密和解密技术的图像加密装置的结构示意图,为了便于说明,仅示出了与本发明实施例相关的部分。图6示例的基于光学加密和解密技术的图像加密装置可以是前述图1和图2所示实施例提供的基于光学加密和解密技术的图像加密方法的执行主体。图6示例的基于光学加密和解密技术的图像加密装置,主要包括:转换模块601和划分模块602。以上各功能模块详细说明如下:Please refer to FIG. 6. FIG. 6 is a schematic structural diagram of an image encryption device based on optical encryption and decryption technology provided by a fourth embodiment of the present invention. For convenience of description, only parts related to the embodiment of the present invention are shown. The image encryption device based on the optical encryption and decryption technology exemplified in FIG. 6 may be the execution body of the image encryption method based on the optical encryption and decryption technology provided by the embodiments shown in FIG. 1 and FIG. 2 . The image encryption device based on optical encryption and decryption technology illustrated in FIG. 6 mainly includes aconversion module 601 and adivision module 602 . The above functional modules are described in detail as follows:

转换模块601,用于将待加密图像转换成二进制序列码;Theconversion module 601 is used to convert the to-be-encrypted image into a binary sequence code;

转换模块601,还用于按照预置的转换序列规则,将该二进制序列码转换成十进制序列码;Theconversion module 601 is further configured to convert the binary sequence code into a decimal sequence code according to a preset conversion sequence rule;

划分模块602,用于按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量;Thedivision module 602 is used to divide the decimal sequence code into multiple segments according to the order of the first to the last digit in the decimal sequence code, and set the capacity of each segment in the multiple segments to be less than or equal to a single two-dimensional code the maximum capacity;

转换模块601,还用于将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像。Theconversion module 601 is further configured to convert the segment into a two-dimensional code corresponding to the segment, and perform optical encryption on the two-dimensional code, so that the encrypted two-dimensional code can be restored to the to-be-encrypted image through optical decryption.

本实施例未尽之细节,请参阅前述图1所示实施例的描述,此处不再赘述。For details that are not exhausted in this embodiment, please refer to the description of the embodiment shown in FIG. 1 above, which will not be repeated here.

本发明实施例中,转换模块601将待加密图像转换成二进制序列码,并按照预置的转换序列规则,将该二进制序列码转换成十进制序列码,划分模块602按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量,然后转换模块601将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像,这样将二维码作为图像的载体,再对该二维码进行光学加密,可以防止通过光学解密还原出的图像受到斑点噪声的干扰,进而使得解密出的图像更加清晰完整。In this embodiment of the present invention, theconversion module 601 converts the to-be-encrypted image into a binary sequence code, and converts the binary sequence code into a decimal sequence code according to a preset conversion sequence rule, and thedividing module 602 converts the binary sequence code into a decimal sequence code according to the first to the decimal sequence code. In the order of the last digits, the decimal sequence code is divided into multiple segments, and the capacity of each segment in the multiple segments is set to be less than or equal to the maximum capacity of a single two-dimensional code, and then theconversion module 601 converts the segment into a The two-dimensional code corresponding to the segment is optically encrypted, so that the encrypted two-dimensional code can be restored to the to-be-encrypted image through optical decryption, so that the two-dimensional code is used as the carrier of the image, and then the two The optical encryption of the dimensional code can prevent the image restored by optical decryption from being disturbed by speckle noise, thereby making the decrypted image clearer and more complete.

需要说明的是,以上图6示例的基于光学加密和解密技术的图像加密装置的实施方式中,各功能模块的划分仅是举例说明,实际应用中可以根据需要,例如相应硬件的配置要求或者软件的实现的便利考虑,而将上述功能分配由不同的功能模块完成,即将基于光学加密和解密技术的图像加密装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。而且,实际应用中,本实施例中的相应的功能模块可以是由相应的硬件实现,也可以由相应的硬件执行相应的软件完成。本说明书提供的各个实施例都可应用上述描述原则,以下不再赘述。It should be noted that in the embodiment of the image encryption device based on the optical encryption and decryption technology illustrated in FIG. 6 above, the division of each functional module is only an example, and in practical applications, it can be required, such as the configuration requirements of the corresponding hardware or software. For the convenience of realization, the above-mentioned function distribution is completed by different functional modules, that is, the internal structure of the image encryption device based on optical encryption and decryption technology is divided into different functional modules to complete all or part of the functions described above. Moreover, in practical applications, the corresponding functional modules in this embodiment may be implemented by corresponding hardware, or may be implemented by corresponding hardware executing corresponding software. The above description principles can be applied to each of the embodiments provided in this specification, which will not be repeated below.

请参阅图7,图7为本发明第五实施例提供的基于光学加密和解密技术的图像加密装置的结构示意图,为了便于说明,仅示出了与本发明实施例相关的部分。图7示例的基于光学加密和解密技术的图像加密装置可以是前述图1和图2所示实施例提供的基于光学加密和解密技术的图像加密方法的执行主体。图7示例的基于光学加密和解密技术的图像加密装置,主要包括:转换模块701、划分模块702和设置模块703,其中转换模块701包括:提取模块7011、确定模块7012、执行模块7013和排列模块7014;确定模块7012包括:转换子模块70121。以上各功能模块详细说明如下:Please refer to FIG. 7 . FIG. 7 is a schematic structural diagram of an image encryption device based on an optical encryption and decryption technology provided by a fifth embodiment of the present invention. For convenience of description, only parts related to the embodiment of the present invention are shown. The image encryption device based on the optical encryption and decryption technology exemplified in FIG. 7 may be the executive body of the image encryption method based on the optical encryption and decryption technology provided by the embodiments shown in FIG. 1 and FIG. 2 . The image encryption device based on optical encryption and decryption technology illustrated in FIG. 7 mainly includes: aconversion module 701, adivision module 702 and asetting module 703, wherein theconversion module 701 includes: anextraction module 7011, adetermination module 7012, anexecution module 7013 and anarrangement module 7014; the determiningmodule 7012 includes: a convertingsub-module 70121. The above functional modules are described in detail as follows:

转换模块701,用于将待加密图像转换成二进制序列码。Theconversion module 701 is used to convert the to-be-encrypted image into a binary sequence code.

该待加密图像为灰度图像。在计算机中,任何存储格式的待加密图像均可以转换为二进制序列码,该待加密图像的存储格式可以为BMP格式,也可以为PCX格式,也可以为GIF格式,还可以为JPEG格式,还可以为其他存储格式,此处不做赘述。The to-be-encrypted image is a grayscale image. In a computer, any image to be encrypted in any storage format can be converted into a binary sequence code, and the storage format of the image to be encrypted can be BMP format, PCX format, GIF format, JPEG format, or JPEG format. Other storage formats can be used, which will not be described here.

转换模块701包括:提取模块7011、确定模块7012、执行模块7013和排列模块7014;确定模块7012包括:转换子模块70121。Theconversion module 701 includes: anextraction module 7011 , adetermination module 7012 , anexecution module 7013 and anarrangement module 7014 ; thedetermination module 7012 includes aconversion sub-module 70121 .

提取模块7011,用于按照预置顺序从该二进制序列码中未转换成十进制数码的二进制数码开始提取四个比特。The extractingmodule 7011 is configured to extract four bits from the binary numbers that are not converted into decimal numbers in the binary sequence code according to a preset sequence.

该预置顺序为该二进制序列码中首位到末位的排列顺序。例如,S201中由图像转换成的二进制序列码为10010101111000,则该二进制序列码的首位为位于整个序列最左侧的二进制数码1,该二进制序列码的末位为位于整个序列最右侧的二进制数码0,从该二进制序列码中提取的四个比特为1001。The preset order is the arrangement order of the first bit to the last bit in the binary sequence code. For example, the binary sequence code converted from the image in S201 is 10010101111000, then the first bit of the binary sequence code is the binary number 1 located at the leftmost of the whole sequence, and the last bit of the binary sequence code is the binary number located at the rightmost side of the whole sequence Digital 0, the four bits extracted from this binary sequence code are 1001.

确定模块7012,用于通过该四个比特的数值确定将二进制数码转换成十进制数码的方式。The determiningmodule 7012 is configured to determine the manner of converting the binary number into the decimal number by the value of the four bits.

可选地,确定模块7012包括:转换子模块70121。Optionally, the determiningmodule 7012 includes: a convertingsub-module 70121.

转换子模块70121,用于若该四个比特为1000或1001,则依据预置的二进制转十进制规则,将为1000的该四个比特转换为十进制数码8,或将为1001的该四个比特转换为十进制数码9;Theconversion sub-module 70121 is used to convert the four bits that are 1000 into decimal number 8, or the four bits that are 1001, if the four bits are 1000 or 1001, according to the preset binary-to-decimal rule Convert to decimal number 9;

转换子模块70121,还用于若该四个比特既非1000也非1001,则重新按照该预置顺序从该二进制序列码中未转换成十进制数码的二进制数码开始提取三个比特,并依据该二进制转十进制规则将该三个比特转换为十进制数码。Theconversion sub-module 70121 is also used to extract three bits from the binary code that is not converted into a decimal code in the binary sequence code according to the preset sequence again if the four bits are neither 1000 nor 1001, and according to the The binary-to-decimal rule converts the three bits to a decimal number.

预置的二进制转十进制规则为:二进制数码1000转换为十进制数码8、二进制数码1001转换为十进制数码9,二进制数码000转换为十进制数码0,二进制数码001转换为十进制数码1,二进制数码010转换为十进制数码2,二进制数码011转换为十进制数码3,二进制数码100转换为十进制数码4,二进制数码101转换为十进制数码5,二进制数码110转换为十进制数码6,二进制数码111转换为十进制数码7。The preset binary to decimal rules are: binary number 1000 is converted to decimal number 8, binary number 1001 is converted to decimal number 9, binary number 000 is converted to decimal number 0, binary number 001 is converted to decimal number 1, and binary number 010 is converted to decimal number 1. Decimal number 2, binary number 011 is converted to decimal number 3, binary number 100 is converted to decimal number 4, binary number 101 is converted to decimal number 5, binary number 110 is converted to decimal number 6, binary number 111 is converted to decimal number 7.

执行模块7013,用于继续执行提取四个比特的过程,直至该二进制序列码中所有二进制数码均转换成十进制数码。Theexecution module 7013 is configured to continue to execute the process of extracting four bits until all binary numbers in the binary sequence code are converted into decimal numbers.

以二进制序列码10010101111000为例进行说明步骤S202-步骤S203,首先按照预置顺序从序列中提取未转换的四个比特1001,并直接将1001转换成十进制数码9;继续按照预置顺序提取未转换的四个比特0101,该四个比特既不是1000也不是1001,那么按照预置顺序重新提取未转换的三个比特010,并将010转换为十进制数码2;然后继续按照预置顺序从序列中提取未转换的四个比特1111,该四个比特既不是1000也不是1001,那么按照预置顺序重新提取未转换的三个比特111,并将111转换为十进制数码7;再继续按照预置顺序从序列中提取未转换的四个比特1000,并直接将1000转换为十进制数码8。Taking the binary sequence code 10010101111000 as an example to illustrate steps S202-S203, first extract the unconverted four bits 1001 from the sequence according to the preset order, and directly convert the 1001 into the decimal number 9; continue to extract the unconverted bits according to the preset order The four bits are 0101, which are neither 1000 nor 1001, then re-extract the unconverted three bits 010 according to the preset order, and convert 010 to decimal number 2; then continue to follow the preset order from the sequence Extract the unconverted four bits 1111, which are neither 1000 nor 1001, then re-extract the unconverted three bits 111 according to the preset order, and convert 111 to the decimal number 7; continue to follow the preset order Extract the unconverted four bits 1000 from the sequence and directly convert 1000 to decimal digit 8.

排列模块7014,用于按照转换的前后顺序对得到的十进制数码进行排列,得到该十进制序列码。The arrangingmodule 7014 is used for arranging the obtained decimal numbers according to the sequence before and after the conversion, so as to obtain the decimal sequence code.

按照转换的前后顺序是将先转换得到的十进制数码排列在前面,后转换得到的十进制数码排列在后面,例如,以上述步骤S204中转换得到的十进制数码为例,按照转换的前后顺序进行排列得到的十进制序列码为:9278。According to the order of conversion, the first converted decimal number is arranged in the front, and the latter converted decimal number is arranged in the back. For example, taking the converted decimal number in the above step S204 as an example, according to the conversion order The decimal serial code is: 9278.

划分模块702,用于按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量。Thedivision module 702 is used to divide the decimal sequence code into multiple segments according to the order of the first to the last digit in the decimal sequence code, and set the capacity of each segment in the multiple segments to be less than or equal to a single two-dimensional code maximum capacity.

每个片段包含多个十进制数码。十进制序列码中首位到末位的顺序与二进制序列码中首位到末位的顺序两者之间的方向是一致的,例如,十进制序列码为9278,则十进制序列码的首位为9,末位为8。每个片段的容量必须小于或者等于单个二维码的最大容量,例如,假设单个二维码的最大容量为2个数字,十进制序列码为9278,则划分的两个片段分别为:片段A中包括9和2,片段B中包括7和8;假设单个二维码的最大容量是3个数字,则共有两种划分方式,第一种划分方式为:片段A中包括9和2,片段B中包括7和8;第二种划分方式为:片段A中包括9、2和7,片段B中包括8。Each segment contains multiple decimal digits. The order of the first to last digit in the decimal sequence code is consistent with the order of the first to the last digit in the binary sequence code. For example, if the decimal sequence code is 9278, the first digit of the decimal sequence code is 9, and the last digit is 8. The capacity of each segment must be less than or equal to the maximum capacity of a single QR code. For example, assuming that the maximum capacity of a single QR code is 2 digits and the decimal serial code is 9278, the two divided segments are: segment A It includes 9 and 2, and segment B includes 7 and 8; assuming that the maximum capacity of a single QR code is 3 numbers, there are two division methods. The first division method is: segment A includes 9 and 2, and segment B includes Including 7 and 8; the second division method is: segment A includes 9, 2 and 7, and segment B includes 8.

转换模块701,用于将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像。Theconversion module 701 is configured to convert the segment into a two-dimensional code corresponding to the segment, and perform optical encryption on the two-dimensional code, so that the encrypted two-dimensional code can be restored to the to-be-encrypted image through optical decryption.

设置模块703,用于按照该十进制序列码中各十进制数码的排列顺序,对每个片段对应的二维码插入预置的片段序号,以使在解密时将划分的片段按照该片段序号还原十进制序列码。Thesetting module 703 is used for inserting a preset segment sequence number into the two-dimensional code corresponding to each segment according to the arrangement order of the decimal numbers in the decimal sequence code, so that the divided segments are restored to decimal according to the segment sequence number during decryption serial code.

一个片段对应转换为一个二维码。片段序号是用于表示片段排列的前后顺序。该片段序号可以是以数字的形式表示,如1、2、3….N,数字越小,排列越往前,该片段序号也可以使用罗马数字,还可以自定义带有排列顺序的字符。例如,十进制序列码为9278,片段A中包括9和2,片段B中包括7和8,则片段A的片段序号为1,片段B的片段序号为2,那么片段A排列在前面,片段B排列在后面。通过片段序号可以确保在解密时由片段生成的十进制序列码中各数码的顺序与加密时的十进制序列码中各数码的顺序一致。A fragment corresponds to a QR code. The segment number is used to indicate the sequence in which the segments are arranged. The segment serial number can be represented in the form of numbers, such as 1, 2, 3....N. The smaller the number, the more advanced the arrangement is. The segment serial number can also use Roman numerals, and you can also customize the characters with the arrangement order. For example, if the decimal sequence code is 9278, segment A includes 9 and 2, and segment B includes 7 and 8, then the segment number of segment A is 1, and the segment number of segment B is 2, then segment A is arranged first, segment B Arranged at the back. The sequence number of the segment can ensure that the sequence of the digits in the decimal sequence code generated by the segment during decryption is consistent with the sequence of the digits in the decimal sequence code during encryption.

本实施例未尽之细节,请参阅前述图1和图2所示实施例的描述,此处不再赘述。For details that are not exhausted in this embodiment, please refer to the descriptions of the embodiments shown in FIG. 1 and FIG. 2 above, which will not be repeated here.

本发明实施例中,转换模块701将待加密图像转换成二进制序列码,提取模块7011按照预置顺序从该二进制序列码中未转换成十进制数码的二进制数码开始提取四个比特,确定模块7012通过该四个比特的数值确定将二进制数码转换成十进制数码的方式,执行模块7013继续执行提取四个比特的过程,直至该二进制序列码中所有二进制数码均转换成十进制数码,排列模块7014按照转换的前后顺序对得到的十进制数码进行排列,得到该十进制序列码,划分模块702按照该十进制序列码中首位到末位的顺序,将该十进制序列码划分为多个片段,并设置该多个片段中每一片段的容量均小于或者等于单个二维码的最大容量,转换模块701将该片段转换成与该片段对应的二维码,并将该二维码进行光学加密,以使已加密的二维码通过光学解密还原为该待加密图像,设置模块703按照该十进制序列码中各十进制数码的排列顺序,对每个片段对应的二维码插入预置的片段序号,以使在解密时将划分的片段按照该片段序号还原十进制序列码,这样将二维码作为图像的载体,再对该二维码进行光学加密,可以防止通过光学解密还原出的图像受到斑点噪声的干扰,进而使得解密出的图像更加清晰完整。In this embodiment of the present invention, theconversion module 701 converts the to-be-encrypted image into a binary sequence code, theextraction module 7011 extracts four bits from the binary sequence code that is not converted into a decimal number in the binary sequence code in a preset sequence, and thedetermination module 7012 passes the The value of the four bits determines the method of converting binary numbers into decimal numbers. Theexecution module 7013 continues to perform the process of extracting four bits until all the binary numbers in the binary sequence code are converted into decimal numbers. Thearrangement module 7014 follows the converted numbers. Arrange the obtained decimal numbers in front and back order to obtain the decimal sequence code. Thedividing module 702 divides the decimal sequence code into multiple segments according to the order of the first to the last digit in the decimal sequence code, and sets the number of segments in the multiple segments. The capacity of each segment is less than or equal to the maximum capacity of a single two-dimensional code, theconversion module 701 converts the segment into a two-dimensional code corresponding to the segment, and optically encrypts the two-dimensional code, so that the encrypted two-dimensional code is encrypted. The dimensional code is restored to the to-be-encrypted image through optical decryption, and thesetting module 703 inserts a preset segment sequence number into the QR code corresponding to each segment according to the arrangement order of the decimal numbers in the decimal sequence code, so that when decrypting, The divided segments restore the decimal sequence code according to the segment serial number, so that the two-dimensional code is used as the carrier of the image, and then the two-dimensional code is optically encrypted, which can prevent the image restored by optical decryption from being disturbed by speckle noise, thereby making decryption possible. The resulting image is clearer and more complete.

请参阅图8,图8是本发明第六实施例提供的基于光学加密和解密技术的图像解密装置的结构示意图,为了便于说明,仅示出了与本发明实施例相关的部分。图8示例的基于光学加密和解密技术的图像解密装置可以是前述图3所示实施例提供的基于光学加密和解密技术的图像解密方法的执行主体。图8示例的基于光学加密和解密技术的图像解密装置,主要包括:转换模块801、生成模块802和还原模块803。以上各功能模块详细说明如下:Please refer to FIG. 8 . FIG. 8 is a schematic structural diagram of an image decryption apparatus based on an optical encryption and decryption technology provided by a sixth embodiment of the present invention. For convenience of description, only parts related to the embodiments of the present invention are shown. The image decryption device based on the optical encryption and decryption technology illustrated in FIG. 8 may be the execution body of the image decryption method based on the optical encryption and decryption technology provided by the embodiment shown in FIG. 3 . The image decryption device based on the optical encryption and decryption technology illustrated in FIG. 8 mainly includes: a conversion module 801 , a generation module 802 and a restoration module 803 . The above functional modules are described in detail as follows:

转换模块801,用于将待解密二维码进行光学解密,得到已解密的二维码,并将该已解密的二维码转换为包含有十进制数码的片段;The conversion module 801 is used to optically decrypt the two-dimensional code to be decrypted to obtain a decrypted two-dimensional code, and convert the decrypted two-dimensional code into a fragment containing decimal numbers;

生成模块802,用于按照该已解密的二维码中预置的片段序号,将转换后的片段进行排列,以生成十进制序列码;The generating module 802 is used for arranging the converted segments according to the segment sequence numbers preset in the decrypted two-dimensional code to generate a decimal sequence code;

转换模块801,用于按照预置的转换序列规则,将该十进制序列码转换成二进制序列码;A conversion module 801, configured to convert the decimal sequence code into a binary sequence code according to a preset conversion sequence rule;

还原模块803,用于并将已转换的二进制序列码还原为图像。The restoration module 803 is used for restoring the converted binary sequence code into an image.

本实施例未尽之细节,请参阅前述图1、图2和图3所示实施例的描述,此处不再赘述。For details not exhausted in this embodiment, please refer to the descriptions of the embodiments shown in FIG. 1 , FIG. 2 , and FIG. 3 , which will not be repeated here.

需要说明的是,本发明实施例中的基于光学加密和解密技术的图像解密装置与上述图6和图7所示的基于光学加密和解密技术的图像加密装置可以位于一个终端中,也可以位于不同的终端中。It should be noted that the image decryption device based on the optical encryption and decryption technology in the embodiment of the present invention and the image encryption device based on the optical encryption and decryption technology shown in FIG. 6 and FIG. 7 may be located in a terminal, or may be located in a terminal. in different terminals.

本发明实施例中,转换模块801将待解密二维码进行光学解密,得到已解密的二维码,并将该已解密的二维码转换为包含有十进制数码的片段,生成模块802按照该已解密的二维码中预置的片段序号,将转换后的片段进行排列,以生成十进制序列码,转换模块801按照预置的转换序列规则,将该十进制序列码转换成二进制序列码,还原模块803将已转换的二进制序列码还原为图像,这样先对二维码进行光学解密,再将已解密的二维码还原出图像可以防止斑点噪声的干扰,进而使得解密出的图像更加清晰完整,同时利用片段序号可以更加准确的将片段还原成加密时的十进制序列码。In the embodiment of the present invention, the conversion module 801 optically decrypts the two-dimensional code to be decrypted to obtain a decrypted two-dimensional code, and converts the decrypted two-dimensional code into a fragment containing decimal numbers. The segment sequence number preset in the decrypted two-dimensional code, arranges the converted segments to generate a decimal sequence code, the conversion module 801 converts the decimal sequence code into a binary sequence code according to the preset conversion sequence rules, and restores The module 803 restores the converted binary sequence code to an image, so that the optical decryption of the two-dimensional code is performed first, and then the decrypted two-dimensional code is restored to an image, which can prevent the interference of speckle noise, thereby making the decrypted image clearer and more complete. , and at the same time, the fragment sequence number can be used to more accurately restore the fragment to the decimal sequence code during encryption.

在本申请所提供的多个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信链接可以是通过一些接口,装置或模块的间接耦合或通信链接,可以是电性,机械或其它的形式。In the various embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication link may be through some interfaces, indirect coupling or communication link of devices or modules, which may be in electrical, mechanical or other forms.

所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, may be located in one place, or may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically alone, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules.

所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, removable hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes.

需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本发明所必须的。It should be noted that, for the convenience of description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence. As in accordance with the present invention, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily all necessary to the present invention.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

以上为对本发明所提供的基于光学加密和解密技术的图像加密和解密方法及装置的描述,对于本领域的技术人员,依据本发明实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本发明的限制。The above is a description of the image encryption and decryption method and device based on the optical encryption and decryption technology provided by the present invention. For those skilled in the art, according to the idea of the embodiment of the present invention, there will be a specific implementation and application range. Changes, in conclusion, the content of this specification should not be construed as a limitation to the present invention.

Claims (6)

CN201611036562.7A2016-11-152016-11-15Image encryption and decryption method and device based on optical encryption and decryption technologyExpired - Fee RelatedCN106530206B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201611036562.7ACN106530206B (en)2016-11-152016-11-15Image encryption and decryption method and device based on optical encryption and decryption technology

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201611036562.7ACN106530206B (en)2016-11-152016-11-15Image encryption and decryption method and device based on optical encryption and decryption technology

Publications (2)

Publication NumberPublication Date
CN106530206A CN106530206A (en)2017-03-22
CN106530206Btrue CN106530206B (en)2020-01-10

Family

ID=58356159

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201611036562.7AExpired - Fee RelatedCN106530206B (en)2016-11-152016-11-15Image encryption and decryption method and device based on optical encryption and decryption technology

Country Status (1)

CountryLink
CN (1)CN106530206B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107509080B (en)*2017-08-182021-01-15北京奇艺世纪科技有限公司Method and device for displaying coded image and electronic equipment
CN107947919B (en)*2017-11-142020-06-23上海理工大学 Compressed Sensing Correlation Imaging Encryption Method for Large Information Image Based on QR Code
WO2019095173A1 (en)*2017-11-152019-05-23深圳大学Method and device for generating two-dimensional code superimposed with artificial noise information
WO2019205357A1 (en)*2018-04-262019-10-31上海德必创新科技发展有限公司Two-dimensional code encryption method, two-dimensional code transmission system and storage medium
CN112529586B (en)*2020-12-152023-07-28深圳市快付通金融网络科技服务有限公司 Transaction information management method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1818935A (en)*2006-03-172006-08-16北京紫光捷通科技有限公司Two-dimensional code construction based on hexadecimal coding
CN101702240A (en)*2009-11-262010-05-05大连大学Image encryption method based on DNA sub-sequence operation
CN103093411A (en)*2013-01-102013-05-08华南师范大学Encryption-decryption method based on random binary image
CN103414839A (en)*2013-07-252013-11-27太原科技大学Graded-and-grouped secret image sharing method
CN103473733A (en)*2013-09-122013-12-25东北林业大学Image encryption algorithm based on DNA encoding and chaotic mapping
CN104424498A (en)*2013-09-102015-03-18王越Method and device for transforming two-dimensional codes at high speed

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1818935A (en)*2006-03-172006-08-16北京紫光捷通科技有限公司Two-dimensional code construction based on hexadecimal coding
CN101702240A (en)*2009-11-262010-05-05大连大学Image encryption method based on DNA sub-sequence operation
CN103093411A (en)*2013-01-102013-05-08华南师范大学Encryption-decryption method based on random binary image
CN103414839A (en)*2013-07-252013-11-27太原科技大学Graded-and-grouped secret image sharing method
CN104424498A (en)*2013-09-102015-03-18王越Method and device for transforming two-dimensional codes at high speed
CN103473733A (en)*2013-09-122013-12-25东北林业大学Image encryption algorithm based on DNA encoding and chaotic mapping

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
WAVELET PACKETS-BASED ROBUST BLIND DIGITAL WATERMARK SCHEME;CONG JIN等;《Proceedings of the 2008 International Conference on Wavelet Analysis and Pattern Recognition》;20080831;第724-728页*
基于Zxing的彩色QR码生成与识别方法;陈元枝;《桂林电子科技大学学报》;20160831;第36卷(第4期);第333-337页*
基于计算鬼成像的光学加密和数字水印方法研究;梁文强;《中国优秀硕士学位论文全文数据库 基础科学辑》;20160615;第2016年卷(第05期);第A005-36页的摘要、第2.2节和第3.1.2节*

Also Published As

Publication numberPublication date
CN106530206A (en)2017-03-22

Similar Documents

PublicationPublication DateTitle
CN106530206B (en)Image encryption and decryption method and device based on optical encryption and decryption technology
US9736142B2 (en)Tokenization using multiple reversible transformations
CN111191255B (en)Information encryption processing method, server, terminal, device and storage medium
CN110457873A (en) A watermark embedding and detection method and device
CN110061840A (en)Data ciphering method, device, computer equipment and storage medium
CN107733904A (en)A kind of method, apparatus and platform of virtual-machine data encryption and decryption
CN102224704A (en)Content decoding apparatus, content decoding method and integrated circuit
CN105281894B (en)Plaintext encryption method and system based on seven-order magic cube
CN105959098A (en)Format-reserved encryption algorithm based on multi-segmented Feistel network
CN115941304B (en) Data encryption method, device, terminal device and computer-readable storage medium
CN103345609A (en)Method and device for text encryption and decryption
CN111798236B (en)Transaction data encryption and decryption methods, devices and equipment
CN107534549B (en)Readable storage medium, method and system for encrypting data stream block
CN105893857A (en)File encryption method, device and equipment
CN107248972B (en)Data encryption and decryption method and device and electronic equipment
CN115834163B (en)Method, device, equipment and storage medium for generating secret key of encrypted data
CN112182512A (en)Information processing method, device and storage medium
CN116484443B (en)Trusted security storage method and device based on hong Monte-go system
CN106130717A (en)A kind of file storage decryption method and device
JP2018061171A (en)Encryption system, encryption method, encryption device and encryption program
CN116455570A (en)Data processing method, device, computer equipment and storage medium
CN115757535A (en)Data query method, data storage method and device and electronic equipment
CN115801271A (en) Realization method, device and storage medium of a dynamic password
US11989325B1 (en)Protecting membership in a secure multi-party computation and/or communication
CN114254366B (en) Encryption method, decryption method, device and electronic device

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20200110

CF01Termination of patent right due to non-payment of annual fee

[8]ページ先頭

©2009-2025 Movatter.jp