CN112887075B - Encryption method of similar full-connection network image based on plaintext correlation - Google Patents
Encryption method of similar full-connection network image based on plaintext correlation Download PDFInfo
- Publication number
- CN112887075B CN112887075B CN202110107767.4A CN202110107767A CN112887075B CN 112887075 B CN112887075 B CN 112887075B CN 202110107767 A CN202110107767 A CN 202110107767A CN 112887075 B CN112887075 B CN 112887075B
- Authority
- CN
- China
- Prior art keywords
- matrix
- sequence
- image
- value
- chaotic
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/001—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using chaotic signals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/065—Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
- H04L9/0656—Pseudorandom key sequence combined element-for-element with data sequence, e.g. one-time-pad [OTP] or Vernam's cipher
- H04L9/0662—Pseudorandom key sequence combined element-for-element with data sequence, e.g. one-time-pad [OTP] or Vernam's cipher with particular pseudorandom sequence generator
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/32—Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
- H04N1/32101—Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
- H04N1/32144—Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
- H04N1/32149—Methods relating to embedding, encoding, decoding, detection or retrieval operations
- H04N1/32267—Methods relating to embedding, encoding, decoding, detection or retrieval operations combined with processing of the image
- H04N1/32272—Encryption or ciphering
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Computer Security & Cryptography (AREA)
- Theoretical Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Biomedical Technology (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Multimedia (AREA)
- Complex Calculations (AREA)
Abstract
基于明文相关的类全连接网络图像的加密方法,涉及图像加密技术领域,解决现有图像加密方法存在加密效果差的问题,本发明提出的基于明文相关的类全连接网络图像加密方法。由logistic混沌系统生成卷积核,将原图进行卷积运算、池化和激活后得到明文相关的矩阵,使用该矩阵获得密钥。使用得到的密钥迭代非线性交叉耦合超混沌系统,得到伪随机数列。然后使用伪随机对原图进行置乱,置乱包括行循环移位和列循环移位。然后使用类全连接网络对置乱后的图像进行比特级的扩散。最后把扩散后的图像与伪随机数列进行异或得到最终的密码图像。
An encryption method for a fully connected network image based on plaintext correlation, relates to the technical field of image encryption, and solves the problem of poor encryption effect in existing image encryption methods. The convolution kernel is generated by the logistic chaotic system, and the original image is convolved, pooled and activated to obtain a matrix related to the plaintext, and the key is obtained by using this matrix. Using the obtained key, the nonlinear cross-coupled hyperchaotic system is iterated to obtain a pseudo-random number sequence. Then the original image is scrambled using pseudo-random, and the scrambling includes row cyclic shift and column cyclic shift. The scrambled image is then bit-level diffused using a fully connected-like network. Finally, XOR the diffused image with the pseudo-random number sequence to obtain the final password image.
Description
技术领域technical field
本发明涉及图像加密技术领域,具体涉及一种基于明文相关的类全连接网络的图像加密方法。The invention relates to the technical field of image encryption, in particular to an image encryption method based on a plaintext correlation-like fully connected network.
背景技术Background technique
随着图像信息获取和处理技术的发展,图像信息安全受到广泛关注。它已成为信息安全和密码学的热门话题。在过去的几十年里,加密方法在隐藏通过无线或有线网络传输的敏感信息方面发挥着至关重要的作用。未经授权的人无法从加密数据中泄露秘密信息。加密方法已广泛应用于医疗、军事、遥感等各种工程领域。目前,图像信息安全主要分为两个分支。一种是通过光学技术实现的光学图像加密,在图像采集过程中对图像进行加密。其核心技术是光学傅里叶变换。另一种是数字计算机实现的数字图像加密,在图像存储过程中对图像进行加密。它的核心方法被称为置乱和扩散。传统的方法如RSA、AES、DES等,也用于加密过程。但是由于图像数据中存在高度冗余和相关性,它们不能产生最佳加密结果。混沌系统被用来加密图像以解决上述问题。在基于混沌的图像加密中,通常使用混沌系统生成一个类随机的混沌序列,作为加密算法中置乱和扩散的密钥流。在这种机制中,混沌系统初始值和控制参数是加密方法安全性与复杂性的决定性要素之一。With the development of image information acquisition and processing technology, image information security has received extensive attention. It has become a hot topic in information security and cryptography. Over the past few decades, encryption methods have played a vital role in hiding sensitive information transmitted over wireless or wired networks. Unauthorized people cannot reveal secret information from encrypted data. Encryption methods have been widely used in medical, military, remote sensing and other engineering fields. At present, image information security is mainly divided into two branches. One is the optical image encryption realized by optical technology, which encrypts the image during the image acquisition process. Its core technology is optical Fourier transform. The other is digital image encryption implemented by digital computers, which encrypts images during image storage. Its core method is called scrambling and diffusion. Traditional methods such as RSA, AES, DES, etc., are also used in the encryption process. But they do not produce optimal encryption results due to the high degree of redundancy and correlation in the image data. Chaotic systems are used to encrypt images to solve the above problems. In chaos-based image encryption, a chaotic system is usually used to generate a quasi-random chaotic sequence as the key stream for scrambling and diffusion in the encryption algorithm. In this mechanism, the initial value and control parameters of the chaotic system are one of the decisive factors for the security and complexity of the encryption method.
近几十年来,基于混沌系统的图像加密算法大量出现。这些加密方案可以分为许多类别,例如基于脱氧核糖核酸(DNA)的方案,基于块的方案,基于复杂混沌系统的方案,基于特殊算法的方案,基于新的加扰扩散结构的方案等。In recent decades, image encryption algorithms based on chaotic systems have appeared in large numbers. These encryption schemes can be classified into many categories, such as deoxyribonucleic acid (DNA)-based schemes, block-based schemes, schemes based on complex chaotic systems, schemes based on special algorithms, schemes based on new scrambled diffusion structures, etc.
发明内容SUMMARY OF THE INVENTION
本发明为解决现有图像加密方法存在加密效果差的问题,提供一种基于明文相关的类全连接网络图像加密方法。In order to solve the problem of poor encryption effect in existing image encryption methods, the present invention provides a quasi-full-connection network image encryption method based on plaintext correlation.
基于明文相关的类全连接网络图像加密方法,该方法由以下步骤实现:A fully connected network image encryption method based on plaintext correlation, the method is realized by the following steps:
步骤一、选择大小为M×N的灰度图像作为原始明文图像Image,计算所述原始明文图像Image的平均像素值a,并对所述平均像素值a进行精度处理,获得处理后的像素值 Step 1: Select a grayscale image with a size of M×N as the original plaintext image Image, calculate the average pixel value a of the original plaintext image Image, and perform precision processing on the average pixel value a to obtain the processed pixel value.
步骤二、将所述像素值作为初值迭代混沌系统,生成长度为m的混沌序列X,X={x1x2x3......xm-1xm};Step 2, convert the pixel value As an initial value iterative chaotic system, a chaotic sequence X with length m is generated, X={x 1 x 2 x 3 ...... x m-1 x m };
采用混沌序列X计算序列Y={y1,y2,y3,y4,......yn},Y中的每个元素作为卷积核,与原始明文图像Image进行卷积核运算;The chaotic sequence X is used to calculate the sequence Y= { y 1 , y 2 , y 3 , y 4 ,... nuclear operation;
对原始明文图像Image进行n次卷积和池化后最终生成大小为的矩阵,MCNN;并将生成的矩阵MCNN的每个值映射到0到的整数中,映射矩阵MCNN2的每个元素记为 After performing n convolution and pooling on the original plaintext image Image, the final generated size is matrix, MCNN; and map each value of the resulting matrix MCNN to 0 to In the integers of , each element of the mapping matrix MCNN2 is denoted as
步骤三、对步骤二获得映射矩阵MCNN2进行计算,通过计算后获得中间变量h1,h2,h3,h4,通过所述中间变量h1,h2,h3,h4计算混沌系统参数μ和λ,以及混沌系统的初始值x0和y0,计算规则如下式所示:Step 3. Calculate the mapping matrix MCNN2 obtained in step 2, and calculate After obtaining the intermediate variables h 1 , h 2 , h 3 , h 4 , the chaotic system parameters μ and λ are calculated through the intermediate variables h 1 , h 2 , h 3 , h 4 , and the initial values of the chaotic system x 0 and y 0 , the calculation rule is as follows:
其中μ′0,λ′0,x′0,y′0是给定的初始值;Where μ′ 0 , λ′ 0 , x′ 0 , y′ 0 are the given initial values;
步骤四、采用非线性交叉耦合超混沌系统获得混沌序列,所述非线性交叉耦合超混沌系统由下式表示:Step 4: Obtain a chaotic sequence by adopting a nonlinear cross-coupling hyper-chaotic system, and the nonlinear cross-coupling hyper-chaotic system is represented by the following formula:
式中,xj和yj表示非线性交叉耦合超混沌系统的第j个状态变量的值,xj-1和yj-1为第j-1个状态变量的值,δ为混沌系统控制参数;In the formula, x j and y j represent the value of the j-th state variable of the nonlinear cross-coupled hyperchaotic system, x j-1 and y j-1 are the values of the j-1-th state variable, and δ is the chaotic system control parameter;
步骤五、采用步骤三中的μ,λ作为非线性交叉耦合超混沌系统的控制参数,x0,y0作为非线性交叉耦合超混沌系统的初值,迭代M×N次,生成长度为M×N的混沌序列X′和Y′,如下式:Step 5. Use μ and λ in step 3 as the control parameters of the nonlinear cross-coupled hyperchaotic system, x 0 , y 0 as the initial values of the nonlinear cross-coupled hyper-chaotic system, iterate M×N times, and the generation length is M The chaotic sequences X′ and Y′ of ×N are as follows:
步骤六、从步骤五生成的混沌序列X′的第td个元素开始,截取长度为M的M′序列,从步骤五生成的混沌序列Y′的第td个元素开始,截取长度为N的N′序列,分别对M′和N′序列进行从小到大排序,分别获得M′和N′的索引序列INDM和INDN;Step 6: Starting from the td-th element of the chaotic sequence X' generated in step 5, intercept the M' sequence with a length of M, starting from the td-th element of the chaotic sequence Y' generated in step 5, intercept N with a length of N ' sequence, sort the M' and N' sequences from small to large respectively, and obtain the index sequences INDM and INDN of M' and N' respectively;
步骤七、采用索引序列INDM对原始明文图像Image进行行循环移位,如果索引序列INDM第g个元素值为奇数,则将对应第g行进行循环左移该奇数值位,如果索引序列INDM第g个元素值为偶数,则将对应第g行进行循环右移该偶数值位,行循环移位结束后,获得矩阵Image1;Step 7. Use the index sequence INDM to perform row cyclic shift on the original plaintext image Image, if the gth element of the index sequence INDM is odd, then the gth row corresponding to the gth row is shifted to the left by the odd value, if the index sequence INDM has an odd value If the value of g elements is even, then the corresponding g-th row will be cyclically shifted to the right by the even-valued bit, and after the row cyclic shift is completed, the matrix Image1 will be obtained;
采用索引序列INDN对矩阵Image1进行列循环移位,如果索引序列INDN序列第h个元素值为奇数,将对应第h列进行循环上移该奇数值位,如果索引序列INDN序列第h个元素值为偶数,将对应第h列进行循环下移该偶数值位,列循环移位结束后,获得矩阵Image2;Use the index sequence INDN to perform a column cyclic shift on the matrix Image1. If the value of the h-th element of the index sequence INDN sequence is odd, the odd-valued bit will be cyclically shifted up corresponding to the h-th column. If the value of the h-th element of the index sequence INDN sequence is an odd number If it is an even number, the even value bit is cyclically shifted down corresponding to the hth column, and after the column cyclic shift is completed, the matrix Image2 is obtained;
步骤八、采用步骤五生成的长度为M×N的混沌序列X′,将X′序列的每个元素值映射到0到7之间,生成序列XR,将所述序列XR分割成l块,每块8个元素,用下式表示为:Step 8: Using the chaotic sequence X' with a length of M×N generated in step 5, map each element value of the X' sequence to between 0 and 7, generate a sequence XR, and divide the sequence XR into 1 blocks, Each block has 8 elements, expressed as:
XR=XR1XR2XR3......XRb-1XRb XR=XR 1 XR 2 XR 3 ......XR b-1 XR b
其中,b表示块号,b=1,2,...l;Among them, b represents the block number, b=1, 2, ... l;
步骤九、对单层全连接神经网络进行改造,生成单层类全连接网络,所述单层类全连接网络八个输入和八个输出,生成一个每行元素均是1到8随机排列的矩阵W,采用矩阵W和步骤八所述的XR序列生成八位的新序列作为改造后的网络的权值;Step 9. Transform the single-layer fully-connected neural network to generate a single-layer fully-connected network. The single-layer fully-connected network has eight inputs and eight outputs to generate a random arrangement of elements in each row from 1 to 8. Matrix W, adopts matrix W and the XR sequence described in step 8 to generate a new sequence of eight bits as the weight of the transformed network;
步骤十、将步骤七获得的Image2转换为一维矩阵P,将一维矩阵P分割为l块,每块8个元素,P=P1P2P3P4......Pb-1Pb;Step 10. Convert the Image2 obtained in Step 7 into a one-dimensional matrix P, and divide the one-dimensional matrix P into l blocks, each with 8 elements, P=P 1 P 2 P 3 P 4 ......P b -1 P b ;
将所述Pi采用八位的二进制表示,由下式为:The eight-bit binary representation is used for the Pi , which is represented by the following formula:
依次把Pb作为类全连接网络的输入,依次使用XRb序列对步骤九的矩阵W循环移位;XRb序列第e个元素值为s,如果s为奇数就把W矩阵对应的第e行循环左移s个元素,如果s为偶数就把W矩阵对应的第e行循环右移s个元素,把此操作后得到的矩阵,作为类全连接网络的权值;Take P b as the input of the fully connected network in turn, and use the XR b sequence to cyclically shift the matrix W in step 9; the value of the e-th element of the XR b sequence is s, and if s is an odd number, set the e-th element corresponding to the W matrix The row is shifted to the left by s elements. If s is an even number, the e-th row corresponding to the W matrix is circularly shifted to the right by s elements, and the matrix obtained after this operation is used as the weight of the fully connected network;
根据每行wc序列上的值依次选取输入的Pb每一位二进制数,然后把选取的每一位二进制数放到要输出的每个元素上;According to the value on the w c sequence of each row, select each binary number of the input P b in turn, and then put each selected binary number on each element to be output;
最后把每个输出元素的八位的二进制数用十进制数表示,然后把每个十进制数通过激活函数s-box计算后获得的值作为类全连接网络的输出值;每次输入一个Pb就输出一个PCb,把矩阵P的所有元素经过类全连接网络处理后得到一维矩阵PC;Finally, the eight-bit binary number of each output element is represented by a decimal number, and then the value obtained by each decimal number calculated by the activation function s-box is used as the output value of the fully connected network; each time a P b is input, it is A PC b is output, and all elements of the matrix P are processed by a fully connected network to obtain a one-dimensional matrix PC;
步骤十一、将步骤五生成的混沌序列Y′,映射到0到之间;生成长度为M×N的序列YR,将序列YR分割为长度分别为M×N/2的序列YR1和YR2;Step 11. Map the chaotic sequence Y′ generated in step 5 to 0 to between; generate a sequence YR with a length of M×N, and divide the sequence YR into sequences YR 1 and YR 2 with a length of M×N/2 respectively;
将步骤十生成的一维矩阵PC={pct}与YR1={yr1t}和YR2={yr2t}序列进行异或,用下式表示为:The one-dimensional matrix PC={pc t } generated in step 10 is XORed with the sequence of YR 1 ={yr 1t } and YR 2 ={yr 2t }, which is expressed as:
式中XOR为异或函数,异或后获得矩阵PC1;In the formula, XOR is the XOR function, and the matrix PC1 is obtained after the XOR;
步骤十二、将所述矩阵PC1转换成M×N大小的矩阵,生成的矩阵PC2为最终的加密图像。Step 12: Convert the matrix PC1 into an M×N matrix, and the generated matrix PC2 is the final encrypted image.
本发明的有益效果:本发明提出的基于明文相关的类全连接网络图像加密方法。由logistic混沌系统生成卷积核,将原图进行卷积运算、池化和激活后得到明文相关的矩阵,使用该矩阵获得密钥。使用得到的密钥迭代非线性交叉耦合超混沌系统,得到伪随机数列。然后使用伪随机对原图进行置乱,置乱包括行循环移位和列循环移位。然后使用类全连接网络对置乱后的图像进行比特级的扩散。最后把扩散后的图像与伪随机数列进行异或得到最终的密码图像。Beneficial effects of the present invention: the plaintext correlation-based fully connected network image encryption method proposed by the present invention. The convolution kernel is generated by the logistic chaotic system, and the original image is convolved, pooled and activated to obtain a matrix related to the plaintext, and the key is obtained by using this matrix. Using the obtained key, the nonlinear cross-coupled hyperchaotic system is iterated to obtain a pseudo-random number sequence. Then the original image is scrambled using pseudo-random, and the scrambling includes row cyclic shift and column cyclic shift. The scrambled image is then bit-level diffused using a fully connected-like network. Finally, XOR the diffused image with the pseudo-random number sequence to obtain the final password image.
仿真实验表明,本发明具有更大的密钥空间,可以抵抗各种攻击并具有更好的安全性,可以应用于实际的图像通信中。Simulation experiments show that the invention has a larger key space, can resist various attacks and has better security, and can be applied to actual image communication.
附图说明Description of drawings
图1本发明所述的基于明文相关的类全连接网络图像加密方法中加密过程流程图;Fig. 1 is a flow chart of encryption process in the method for encrypting network image based on plaintext correlation in full connection according to the present invention;
图2本发明所述的基于明文相关的类全连接网络图像加密方法中解密过程流程图;Fig. 2 is a flow chart of decryption process in the method for encrypting a network image based on a plaintext correlation-like fully connected network according to the present invention;
图3为采用本发明所述的基于明文相关的类全连接网络图像加密方法进行加密解密的效果图:其中图3(a)为“船只”原始图像;其中图3(b)为图3(a)的加密图像;其中图3(c)为图3(a)的解密图像。Fig. 3 is an effect diagram of encryption and decryption using the plaintext correlation-like fully-connected network image encryption method of the present invention: Fig. 3(a) is the original image of the "ship"; Fig. 3(b) is Fig. 3(b) The encrypted image of a); wherein Fig. 3(c) is the decrypted image of Fig. 3(a).
图4为采用本发明所述的基于明文相关的类全连接网络图像加密解密方法直方图分析:其中图4(a)为图3(a)的直方图;其中图4(b)为图3(c)的直方图。Fig. 4 is the histogram analysis of the method for encrypting and decrypting images based on the plaintext correlation-like fully connected network according to the present invention: Fig. 4(a) is the histogram of Fig. 3(a); Fig. 4(b) is the histogram of Fig. 3 (c) Histogram.
具体实施方式Detailed ways
具体实施方式一、结合图1和图2说明本实施方式,基于明文相关的类全连接网络图像加密方法,该方法由以下步骤实现:DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS First, the present embodiment will be described in conjunction with FIG. 1 and FIG. 2 . Based on a method for encrypting a fully connected network image related to plaintext, the method is implemented by the following steps:
步骤一、选择大小为M×N的灰度图像作为原始明文图像Image。Step 1. Select a grayscale image with a size of M×N as the original plaintext image Image.
步骤二、计算步骤一所述明文图像Image的平均像素值a,方法如下公式(1)所示:Step 2: Calculate the average pixel value a of the plaintext image Image described in Step 1, as shown in the following formula (1):
式中的sum()为求和函数,Image(:)为原始图像Image的全部像素,代表灰度等级,M和N分别代表原始图像的高和宽。The sum() in the formula is the summation function, Image(:) is all the pixels of the original image Image, represents the gray level, and M and N represent the height and width of the original image, respectively.
步骤三、对步骤二获得的平均像素值a进行精度处理得到由公式(2)所示:Step 3: Perform precision processing on the average pixel value a obtained in Step 2 to obtain It is shown by formula (2):
式中floor()为向下取整函数。where floor() is a rounding down function.
步骤四、将步骤三获得的作为初值迭代混沌系统,生成长度为m的混沌序列X,X={x1x2x3......xm-1xm}。Step 4. The obtained step 3 As the initial value iterative chaotic system, a chaotic sequence X of length m is generated, X={x 1 x 2 x 3 ...... x m-1 x m }.
步骤五、使用步骤四生成的混沌序列X计算出序列Y={y1,y2,y3,y4,......yn},Y中的每个元素作为卷积核,与原图Image进行卷积运算,卷积核的计算方法由公式(3)所示:Step 5. Use the chaotic sequence X generated in step 4 to calculate the sequence Y={y 1 , y 2 , y 3 , y 4 , ...... y n }, each element in Y is used as a convolution kernel, The convolution operation is performed with the original image, and the calculation method of the convolution kernel is shown in formula (3):
其中,为卷积核的大小。reshape函数是把截取的X的序列,转换成行和列。in, is the size of the convolution kernel. The reshape function converts the intercepted sequence of X into line and List.
首先使用Y中的元素y1与原图Image进行卷积运算,如公式(4)所示:First, use the element y 1 in Y to perform a convolution operation with the original image Image, as shown in formula (4):
I1,1=conv2(Image,y1) (4)I 1,1 =conv2(Image,y 1 ) (4)
式中conv2()为卷积函数。where conv2() is the convolution function.
使用平均池化函数对卷积后的矩阵进行池化:Pool the convolutional matrix using the average pooling function:
I1,2=averagePooling(I1,1) (5)I 1,2 =averagePooling(I 1,1 ) (5)
其中,averagePooling()为平均池化函数。Among them, averagePooling() is the average pooling function.
依次循环执行公式(4),(5)对卷积池化的结果再进行计算。如公式(6)所示:Execute formulas (4) and (5) in turn in a loop to calculate the result of convolution pooling. As shown in formula (6):
其中i=2,3...n,where i=2,3...n,
每次进行卷积和池化后生成矩阵大小的计算公式为分别为(7)和(8):The formulas for calculating the size of the generated matrix after each convolution and pooling are (7) and (8), respectively:
其中,和分别为第i次卷积和池化后的矩阵的高和宽;in, and are the height and width of the matrix after the i-th convolution and pooling, respectively;
对输入的原始明文Image进行n次卷积、池化后最终生成大小为的矩阵,记为MCNN。并将生成的MCNN矩阵的每个值映射到0到的整数,映射函数由公式(9)所示:After performing n convolutions and pooling on the input original plaintext Image, the final generated size is The matrix of , denoted as MCNN. and map each value of the resulting MCNN matrix to 0 to , the mapping function is given by equation (9):
把MCNN1转为一维矩阵,如公式(10)所示:Convert MCNN1 to a one-dimensional matrix, as shown in formula (10):
把MCNN2每个元素记为 Record each element of MCNN2 as
步骤六、对步骤五获得的MCNN2矩阵进行计算,通过计算后获得中间变量h1,h2,h3,h4,计算过程由公式(11)所示:Step 6. Calculate the MCNN2 matrix obtained in step 5. By calculating After obtaining intermediate variables h 1 , h 2 , h 3 , h 4 , the calculation process is shown by formula (11):
步骤七、通过步骤六的h1,h2,h3,h4计算混沌系统参数μ和λ,以及混沌系统的初始值x0和y0,计算规则如公式(12)所示:Step 7: Calculate the parameters μ and λ of the chaotic system, and the initial values x 0 and y 0 of the chaotic system through h 1 , h 2 , h 3 , and h 4 in step 6. The calculation rules are shown in formula (12):
其中μ′0,λ′0,x′0,y′0是给定的初始值。Where μ′ 0 , λ′ 0 , x′ 0 , y′ 0 are given initial values.
步骤八、使用非线性交叉耦合超混沌系统获得混沌序列,混沌系统由公式(13)表示:Step 8. Use the nonlinear cross-coupling hyper-chaotic system to obtain the chaotic sequence. The chaotic system is represented by formula (13):
其中,xj和yj表示非线性交叉耦合超混沌系统的第j个状态变量的值。xj-1和yj-1为第j-1个状态变量的值。δ为混沌系统控制参数。Among them, x j and y j represent the value of the jth state variable of the nonlinear cross-coupled hyperchaotic system. x j-1 and y j-1 are the values of the j-1 th state variable. δ is the control parameter of the chaotic system.
步骤九、使用步骤七中的μ,λ作为非线性交叉耦合超混沌系统的控制参数,x0,y0作为非线性交叉耦合超混沌系统的初值,迭代M×N次,生成长度为M×N的混沌序列X′和Y′,如公式(14)所示:Step 9. Use μ and λ in Step 7 as the control parameters of the nonlinear cross-coupled hyperchaotic system, x 0 , y 0 as the initial values of the nonlinear cross-coupled hyper-chaotic system, iterate M×N times, and the generation length is M The chaotic sequences X′ and Y′ of ×N are shown in formula (14):
步骤十、从步骤九生成的X′序列的第td个元素开始,截取长度为M的M′序列,由公式(15)表示:Step 10. Starting from the td-th element of the X' sequence generated in Step 9, intercept the M' sequence of length M, which is represented by formula (15):
M′=X′(td:td+M-1) (15)M'=X'(td:td+M-1) (15)
从步骤九生成的Y′序列的第td个元素开始,截取长度为N的N′序列,由公式(16)表示:Starting from the td-th element of the Y' sequence generated in step 9, the N' sequence of length N is intercepted, which is represented by formula (16):
N′=Y′(td:td+N-1) (16)N'=Y'(td:td+N-1) (16)
分别对M′和N′序列进行从小到大排序,得到M′和N′的索引序列INDM和INDN,排序由公式(17)表示:Sort the M' and N' sequences from small to large, respectively, to obtain the index sequences INDM and INDN of M' and N', and the sorting is represented by formula (17):
步骤十一、使用INDM序列对原图Image进行行循环移位,如果INDM序列第g个元素值为奇数则将对应第g行进行循环左移该奇数值位,如果INDM序列第g个元素值为偶数则将对应第g行进行循环右移该偶数值位,行循环移位结束后得到矩阵Image1。Step 11. Use the INDM sequence to perform a row cyclic shift on the original image. If the value of the gth element of the INDM sequence is an odd number, the odd value position will be cyclically shifted to the left corresponding to the gth row. If the value of the gth element of the INDM sequence is an odd number If it is an even number, the corresponding g-th row will be shifted to the right by the even-valued bits, and the matrix Image1 will be obtained after the row cyclic shift is completed.
步骤十二、使用INDN序列对矩阵Image1进列行循环移位,如果INDN序列第h个元素值为奇数将对应第h列进行循环上移该奇数值位,如果INDN序列第h个元素值为偶数将对应第h列进行循环下移该偶数值位,列循环移位结束后得到矩阵Image2。h=1,2,3,4,……N;Step 12. Use the INDN sequence to cyclically shift the columns and rows of the matrix Image1. If the value of the hth element of the INDN sequence is an odd number, the odd value will be shifted up corresponding to the hth column. If the value of the hth element of the INDN sequence is an odd number, The even number will be cyclically shifted down corresponding to the hth column, and the matrix Image2 will be obtained after the column cyclic shift is completed. h=1,2,3,4,...N;
步骤十三、使用步骤九生成的长度为M×N的混沌序列X′。将X′序列的每个元素值映射到0到7之间,由公式(18)所示:Step 13: Use the chaotic sequence X′ with a length of M×N generated in step 9. Map each element value of the X' sequence to a value between 0 and 7, as shown by Equation (18):
XR=mod(floor(X′×10x,8) (18)XR=mod(floor(X′×10 x , 8) (18)
把序列XR分割成l块,每块8个元素,由公式(19)表示:Divide the sequence XR into l blocks, each with 8 elements, expressed by formula (19):
XR=XR1XR2XR3......XRb-1XRb (19)XR=XR 1 XR 2 XR 3 ......XR b-1 XR b (19)
其中,b表示块号,b=1,2,...l;Among them, b represents the block number, b=1, 2, ... l;
步骤十四、对单层全连接神经网络进行改造,全连接神经网络是一种最基本的神经网络结构,神经网络中除输入层之外的每个节点都和上一层的所有节点有连接。改造后的网络有8个输入和有8个输出,生成一个每行元素都是1到8随机排列的矩阵W,W的第c行wc由公式(20)所示:Step 14. Transform the single-layer fully-connected neural network. The fully-connected neural network is the most basic neural network structure. Every node in the neural network except the input layer is connected to all nodes in the previous layer. . The transformed network has 8 inputs and 8 outputs, and generates a matrix W whose elements in each row are randomly arranged from 1 to 8. The c-th row w c of W is shown by formula (20):
wc=randperm(8) (20)w c = randperm(8) (20)
式中randperm(8)为生成一个1到8的随机排列的数列。where randperm(8) is to generate a random sequence of 1 to 8.
使用W和步骤十三描述的XR序列生成8位的新序列作为该网络的权值,使用一种改进的s-box算法作为该网络的激活函数。通过对单层全连接神经网络进行改造生成单层类全连接网络,使用该网络对图像进行比特级的扩散;Use W and the XR sequence described in step 13 to generate a new sequence of 8 bits as the weight of the network, and use an improved s-box algorithm as the activation function of the network. A single-layer fully-connected network is generated by transforming the single-layer fully-connected neural network, and the network is used to diffuse the image at the bit level;
步骤十五、将步骤十二获得的Image2转换为一维矩阵,转换公式为(21):Step 15: Convert the Image2 obtained in step 12 into a one-dimensional matrix, and the conversion formula is (21):
P=reshape(Image2,1,M*N) (21)P=reshape(Image2, 1, M*N) (21)
将P分割为l块,每块8个元素,由公式(22)表示:Divide P into l blocks, each with 8 elements, represented by formula (22):
P=P1P2P3P4......Pb-1Pb (22)P=P 1 P 2 P 3 P 4 ......P b-1 P b (22)
步骤十六、把步骤十五描述的Pi使用8位的二进制表示,由公式(23)所示:Step 16: Use the 8-bit binary representation of Pi described in Step 15, as shown by formula (23):
依次把Pb作为类全连接网络的输入。依次使用XRb序列对步骤十四的矩阵W循环移位。XRb序列第e个元素值为s,如果s为奇数就把W矩阵对应的第e行循环左移s个元素,如果s为偶数就把W矩阵对应的第j行循环右移s个元素,把此操作后得到的矩阵,作为类全连接网络的权值。Take P b as the input of the fully connected network in turn. The matrix W of step fourteen is cyclically shifted using the XR b sequence in turn. The value of the e-th element of the XR b sequence is s. If s is an odd number, the e-th row corresponding to the W matrix is shifted to the left by s elements. If s is an even number, the j-th row corresponding to the W matrix is rotated to the right by s elements. , and use the matrix obtained after this operation as the weight of the fully connected network.
根据每行wc序列上的值依次选取输入的Pb每一位二进制数,然后把选取的每一位数放到要输出的每个元素上。最后把每个输出元素的8位的二进制数用十进制数表示,然后把每个十进制数通过激活函数s-box计算后得到值作为类全连接网络的输出值。每次输入一个P就输出一个PCb,把P的所有元素经过类全连接网络处理后得到一维矩阵PC。According to the value of each row w c sequence, select each binary digit of input P b in turn, and then put each selected digit on each element to be output. Finally, the 8-bit binary number of each output element is represented by a decimal number, and then each decimal number is calculated by the activation function s-box to obtain the value as the output value of the fully connected network. Each time a P is input, a PC b is output, and all elements of P are processed by a fully connected network to obtain a one-dimensional matrix PC.
步骤十七、把步骤八生成的Y′序列,映射到0到之间。由公式(24)表示:Step seventeen, map the Y' sequence generated in step eight to 0 to between. It is represented by formula (24):
步骤十八、把步骤十七中长度为M×N的序列YR分割为长度为M×N/2的序列YR1和YR2,由公式(25)表示:Step 18: Divide the sequence YR of length M×N in step 17 into sequences YR 1 and YR 2 of length M×N/2, which are represented by formula (25):
步骤十九、使用步骤十六生成的一维矩阵PC={pct}与步骤十八生成的YR1={yr1t}和YR2={yr2t}序列进行异或,由公式(26)所示:Step 19, use the one-dimensional matrix PC={pc t } generated in step 16 and the sequence of YR 1 ={yr 1t } and YR 2 ={yr 2t } generated in step 18 to perform XOR, according to formula (26) shown:
式中XOR为异或函数。异或后得到的PC1矩阵。where XOR is the exclusive OR function. The PC1 matrix obtained after XORing.
步骤二十、将步骤十九生成的PC1矩阵,转换成M×N大小的矩阵,由公式(27)所示:Step 20: Convert the PC1 matrix generated in Step 19 into a matrix of size M×N, as shown by formula (27):
PC2=reshape(PC1,M,N) (27)PC2=reshape(PC1, M, N) (27)
转换后生成的矩阵PC2为最终的加密图。The converted matrix PC2 is the final encrypted image.
本实施方式中,还包括解密步骤,具体为:In this embodiment, it also includes a decryption step, specifically:
步骤二十一、解密时使用步骤七中的μ,λ,x0,y0和给定初始值的δ以步骤十、十三和十八相同的方法得到伪随机序列INDM、INDN、XR、YR1和YR2。Step 21: Use μ, λ, x 0 , y 0 in step 7 and δ of the given initial value to obtain pseudo-random sequences INDM, INDN, XR, YR 1 and YR 2 .
步骤二十二、使用步骤十四生成的矩阵W。Step 22, use the matrix W generated in step 14.
步骤二十三、将步骤二十中得到的加密图像PC2转换成一维矩阵,方法如公式(28):Step 23: Convert the encrypted image PC2 obtained in step 20 into a one-dimensional matrix, the method is as formula (28):
PC1=reshape(PC2,1,M×N) (28)PC1=reshape(PC2, 1, M×N) (28)
步骤二十四、将步骤二十三得到的一维矩阵PC1={PC1jt}与步骤二十一生成的YR1={yr1t}和YR2={yr2t}序列进行异或操作,方法如公式(29)所示:Step 24: Perform XOR operation on the one-dimensional matrix PC1={PC1 jt } obtained in step 23 and the sequence of YR 1 ={yr 1t } and YR 2 ={yr 2t } generated in step 21, method As shown in formula (29):
异或后得到PC矩阵。The PC matrix is obtained after XORing.
步骤二十五、将步骤二十四得到PC矩阵分成l块,每块8个元素,由公式(30)表示:Step 25: Divide the PC matrix obtained in step 24 into l blocks, each of which has 8 elements, represented by formula (30):
PC=PC1PC2PC3PC4...,...PCt-1PCt (30)PC = PC 1 PC 2 PC 3 PC 4 ..., ... PC t-1 PC t (30)
其中,t表示块号,t=1,2,...l。Wherein, t represents the block number, t=1, 2, . . . l.
步骤二十六、依次将步骤二十五得到的PCt输入到步骤十四描述的类全连接网络,进行逆的操作。依次将PCt的每个元素输入逆的类全连接网络,先把PCt的每个值使用成8位二进制表示,使用XRi序列修改W矩阵每行wc的值,根据wc的值选取输入的PCt的对应位置的数,最后生成8个元素的Pb序列。将PC所有元素经过逆的类全连接网络处理后得到P矩阵。In step 26, the PC t obtained in step 25 is sequentially input into the fully connected network described in step 14, and the inverse operation is performed. Input each element of PC t into the inverse fully connected network in turn, first use each value of PC t as an 8-bit binary representation, and use the XR i sequence to modify the value of w c in each row of the W matrix, according to the value of w c The number of corresponding positions of the input PC t is selected, and finally a Pb sequence of 8 elements is generated. The P matrix is obtained by processing all elements of the PC through an inverse fully connected network.
步骤二十七、将步骤二十四得到的P矩阵转换成M×N大小的矩阵,由公式(31)所示:Step 27: Convert the P matrix obtained in step 24 into a matrix of M×N size, as shown by formula (31):
Image2=reshape(P,M,N) (31)Image2=reshape(P, M, N) (31)
步骤二十八、将步骤二十七得到的Image2矩阵和INDM、INDN序列进行逆的循环移位操作。首先进行逆的列循环移位得到Image1矩阵,然后经过逆的行循环移位得到Image矩阵。Image矩阵就是得到的解密图像。Step 28: Perform an inverse cyclic shift operation on the Image2 matrix and the INDM and INDN sequences obtained in step 27. First perform the inverse column cyclic shift to obtain the Image1 matrix, and then obtain the Image matrix through the inverse row cyclic shift. The Image matrix is the resulting decrypted image.
具体实施方式二、结合图1至图4说明本实施方式,本实施方式为具体实施方式一所述的基于明文相关的类全连接网络图像的加密方法的实施例:1 to 4, this embodiment is an example of the encryption method based on the plaintext correlation-like fully connected network image described in the specific embodiment 1:
步骤一、选择大小为512×512的灰度图像作为原始明文图像Image。如附图3(a)。Step 1. Select a grayscale image with a size of 512×512 as the original plaintext image Image. As shown in Figure 3(a).
步骤二、计算步骤一所述明文图像Image的平均像素值a,方法如下公式(1)所示:Step 2: Calculate the average pixel value a of the plaintext image Image described in Step 1, as shown in the following formula (1):
a=sum(Image(:))/((28-1)×512×512) (1)a=sum(Image(:))/((2 8 -1)×512×512) (1)
式中的sum()为求和函数,Image(:)为原始图像Image的全部像素,n代表灰度等级,M和N分别代表原始图像的高和宽。In the formula, sum() is the summation function, Image(:) is all the pixels of the original image Image, n represents the gray level, and M and N represent the height and width of the original image, respectively.
步骤三、对步骤二获得的平均像素值a进行精度处理得到由公式(2)所示:Step 3: Perform precision processing on the average pixel value a obtained in Step 2 to obtain It is shown by formula (2):
式中floor()为向下取整函数。where floor() is a rounding down function.
步骤四、将步骤三获得的作为初值迭代混沌系统,生成长度为1000的混沌序列X,X={x1x2x3......x999x1000}。混沌系统由公式(3)所示:Step 4. The obtained step 3 As an initial value iterative chaotic system, a chaotic sequence X with a length of 1000 is generated, X={x 1 x 2 x 3 ...... x 999 x 1000 }. The chaotic system is represented by formula (3):
x(i+1)=u×x(i)×(1-x(i)) (3)x(i+1)=u×x(i)×(1-x(i)) (3)
其中u为控制参数,本实施方式中u=3.99。xi为混沌系统的第i个混沌系统的混沌状态变量值,xi+1为混沌系统的第i+1个混沌状态变量值。Among them, u is a control parameter, and in this embodiment, u=3.99. x i is the chaotic state variable value of the i-th chaotic system of the chaotic system, and x i+1 is the i+1-th chaotic state variable value of the chaotic system.
步骤五、使用步骤四生成的混沌序列X计算出序列Y={y1,y2,y3,y4,......yn},Y中的每个元素作为卷积核,与原图Image进行卷积运算,卷积核的计算方法由公式(4)所示:Step 5. Use the chaotic sequence X generated in step 4 to calculate the sequence Y={y 1 , y 2 , y 3 , y 4 , ...... y n }, each element in Y is used as a convolution kernel, The convolution operation is performed with the original image, and the calculation method of the convolution kernel is shown in formula (4):
其中,本实施方式中卷积核的大小分别为11×11和12×12。The sizes of the convolution kernels in this embodiment are 11×11 and 12×12, respectively.
依次使用Y中的元素与原图Image进行卷积,如公式(5)所示:Convolve with the original image Image using the elements in Y in turn, as shown in formula (5):
Ii,1=conv2(Image,yi) (5)I i, 1 =conv2(Image, y i ) (5)
式中conv2()为卷积函数。where conv2() is the convolution function.
使用平均池化函数对卷积后的矩阵进行池化:Pool the convolutional matrix using the average pooling function:
Ii,2=averagePooling(Ii,1) (6)I i, 2 = averagePooling(I i, 1 ) (6)
其中,averagePooling()为平均池化函数。Among them, averagePooling() is the average pooling function.
其中i=1,2,...5,依次循环执行公式(5),(6),where i=1, 2, ... 5, and execute formulas (5), (6) in sequence,
每次进行卷积和池化后生成矩阵大小的计算公式为分别为(7)和8():The formulas for calculating the size of the generated matrix after each convolution and pooling are (7) and 8(), respectively:
其中和分别为第i次卷积和池化后的矩阵的高和宽。in and are the height and width of the matrix after the i-th convolution and pooling, respectively.
对输入的原始明文Image进行5次卷积、池化和激活后最后生成大小为6×6的矩阵,记为MCNN。并将生成的MCNN矩阵的每个值映射为0到255的整数,映射函数由公式(9)所示:After 5 times of convolution, pooling and activation of the input original plaintext Image, a matrix of size 6 × 6 is finally generated, which is recorded as MCNN. And map each value of the generated MCNN matrix to an integer from 0 to 255, the mapping function is shown by formula (9):
MCNN1=mod(floor(MCNN/1020),28) (9)MCNN1=mod(floor(MCNN/10 20 ), 2 8 ) (9)
把MCNN1转为一维矩阵,如公式(10)所示:Convert MCNN1 to a one-dimensional matrix, as shown in formula (10):
MCNN2=reshape(MCNN1,1,36) (10)MCNN2=reshape(MCNN1, 1, 36) (10)
把MCNN2每个元素记为{k1k2k3......k36}Denote each element of MCNN2 as {k 1 k 2 k 3 ......k 36 }
步骤六、对步骤五获得的MCNN2矩阵进行计算,通过计算k1k2k3......k36后获得中间变量h1,h2,h3,h4,计算过程由公式(11)所示:Step 6: Calculate the MCNN2 matrix obtained in step 5, and obtain intermediate variables h 1 , h 2 , h 3 , h 4 by calculating k 1 k 2 k 3 ...... k 36 , the calculation process is determined by the formula ( 11) shown:
步骤七、通过步骤六的h1,h2,h3,h4计算混沌系统参数μ和λ,以及混沌系统的初始值x0和y0,计算规则如公式(12)所示:Step 7: Calculate the parameters μ and λ of the chaotic system, and the initial values x 0 and y 0 of the chaotic system through h 1 , h 2 , h 3 , and h 4 in step 6. The calculation rules are shown in formula (12):
其中,本实施方式中μ′0=3.0,λ′0=4.5,x′0=0.4,y′0=0.5。Wherein, in this embodiment, μ′ 0 =3.0, λ′ 0 =4.5, x′ 0 =0.4, and y′ 0 =0.5.
步骤八、使用非线性交叉耦合超混沌系统获得混沌序列,混沌系统由公式(13)表示:Step 8. Use the nonlinear cross-coupling hyper-chaotic system to obtain the chaotic sequence. The chaotic system is represented by formula (13):
其中,xj和yj表示非线性交叉耦合超混沌系统的第j个状态变量的值。xj-1和yj-1为第j-1个状态变量的值。δ为混沌系统控制参数,本实施方式中δ=9.999。Among them, x j and y j represent the value of the jth state variable of the nonlinear cross-coupled hyperchaotic system. x j-1 and y j-1 are the values of the j-1 th state variable. δ is the control parameter of the chaotic system, and δ=9.999 in this embodiment.
步骤九、使用步骤七中的获得的μ,λ作为非线性交叉耦合超混沌系统的控制参数,x0,y0作为非线性交叉耦合超混沌系统的初值,迭代512×512次,生成长度为512×512的混沌序列X′和Y′,如公式(14)所示:Step 9. Use μ and λ obtained in Step 7 as the control parameters of the nonlinear cross-coupling hyperchaotic system, x 0 , y 0 as the initial values of the nonlinear cross-coupling hyper-chaotic system, and iterate 512×512 times to generate a length of are the chaotic sequences X′ and Y′ of 512×512, as shown in formula (14):
步骤十、从步骤九生成的X′序列的第3000个元素开始,截取长度为M的M′序列,由公式(15)表示:Step 10. Starting from the 3000th element of the X' sequence generated in step 9, intercept the M' sequence of length M, which is represented by formula (15):
M′=X′(3000:3000+512-1) (15)M'=X'(3000:3000+512-1) (15)
从步骤九生成的Y′序列的第5000个元素开始,截取长度为N的N′序列,由公式(16)表示:Starting from the 5000th element of the Y' sequence generated in step 9, intercept the N' sequence of length N, which is represented by formula (16):
N′=Y′(5000:5000+512-1) (16)N'=Y'(5000:5000+512-1) (16)
分别对M′和N′序列进行从小到大排序,得到M′和N′的索引序列INDM和INDN,排序由公式(17)表示:Sort the M' and N' sequences from small to large, respectively, to obtain the index sequences INDM and INDN of M' and N', and the sorting is represented by formula (17):
步骤十一、使用INDM序列对原图Image进行行循环移位,如果INDM序列第i个元素值为奇数则将对应第i行进行循环左移该奇数值位,如果INDM序列第个元素值为偶数则将对应第i行进行循环右移该偶数值位,行循环移位结束后得到矩阵Image1。Step 11. Use the INDM sequence to perform a row cyclic shift on the original image. If the i-th element value of the INDM sequence is an odd number, the corresponding i-th row will be cyclically shifted to the left by the odd value bit. If the INDM sequence's first element value is If the number is even, the even-valued bits will be shifted to the right of the i-th row, and the matrix Image1 will be obtained after the row cyclic shift is completed.
步骤十二、使用INDN序列对矩阵Image1进列行循环移位,如果INDN序列第i个元素值为奇数将对应第i列进行循环上移该奇数值位,如果INDN序列第I个元素值为偶数将对应第I列进行循环下移该偶数值位,列循环移位结束后得到矩阵Image2。Step 12. Use the INDN sequence to perform a column-row cyclic shift on the matrix Image1. If the i-th element value of the INDN sequence is an odd number, the odd-valued bit will be cyclically shifted up corresponding to the i-th column. If the i-th element value of the INDN sequence is an odd number, The even number will be cyclically shifted down the even-valued bits corresponding to the first column, and the matrix Image2 will be obtained after the column cyclic shift is completed.
步骤十三、使用步骤九生成的长度为512×512的混沌序列X′。将X′序列的每个元素值映射到0到7之间,由公式(18)所示:Step 13, use the chaotic sequence X' with a length of 512×512 generated in step 9. Map each element value of the X' sequence to a value between 0 and 7, as shown by Equation (18):
XR=mod(floor(X′×104,8) (18)XR=mod(floor(X′×10 4 , 8) (18)
把序列XR分割成512×512/8块,每块8个元素,由公式(19)表示:Divide the sequence XR into 512×512/8 blocks, each block has 8 elements, which is represented by formula (19):
XR=XR1XR2XR3...XRi...XR32767XR32768 (19)XR=XR 1 XR 2 XR 3 ... XR i ... XR 32767 XR 32768 (19)
步骤十四、对单层全连接神经网络进行改造,全连接神经网络是一种最基本的神经网络结构,神经网络中除输入层之外的每个节点都和上一层的所有节点有连接。生成一个大小为8×8的每行元素都是1到8随机排列的矩阵W,W的第c行wc由公式(20)所示:Step 14. Transform the single-layer fully-connected neural network. The fully-connected neural network is the most basic neural network structure. Every node in the neural network except the input layer is connected to all nodes in the previous layer. . Generate a matrix W of size 8 × 8 in which each row of elements is randomly arranged from 1 to 8, and the c-th row w c of W is given by formula (20):
wc=randperm(8) (20)w c = randperm(8) (20)
式中randperm(8)为生成一个1到8的随机排列的数列。where randperm(8) is to generate a random sequence of 1 to 8.
改造后的网络有8个输入和有8个输出。使用W和步骤十三描述的XR序列生成8位的新序列作为该网络的权值,使用一种改进的s-box算法作为该网络的激活函数。通过对单层全连接神经网络进行改造生成单层类全连接网络,使用该网络对图像进行比特级的扩散;The transformed network has 8 inputs and 8 outputs. Use W and the XR sequence described in step 13 to generate a new sequence of 8 bits as the weight of the network, and use an improved s-box algorithm as the activation function of the network. A single-layer fully-connected network is generated by transforming a single-layer fully-connected neural network, and the network is used to diffuse images at the bit level;
步骤十五、将步骤十二获得的Image2转换为一维矩阵,转换公式为(21):Step 15: Convert the Image2 obtained in step 12 into a one-dimensional matrix, and the conversion formula is (21):
P=reshape(Image2,1,512×512) (21)P=reshape(Image2, 1, 512×512) (21)
将P分割为512×512/8块,每块8个元素,由公式(22)表示:Divide P into 512×512/8 blocks, each with 8 elements, represented by formula (22):
P=P1P2P3P4...Pi...P32767P32768 (22)P=P 1 P 2 P 3 P 4 ...P i ...P 32767 P 32768 (22)
步骤十六、把步骤十五描述的Pb使用8位的二进制表示,由公式(23)所示:Step 16: Use 8-bit binary representation of P b described in Step 15, as shown by formula (23):
依次把Pb作为类全连接网络的输入。依次使用XRb序列对步骤十四的矩阵W循环移位。XRb序列第b个元素值为s,如果s为奇数就把W矩阵对应的第i行循环左移s个元素,如果s为偶数就把W矩阵对应的第c行循环右移s个元素,把此操作后得到的矩阵,作为类全连接网络的权值。根据每行wc序列上的值依次选取输入的Pb每一位二进制数,然后把选取的每一位数放到要输出的每个元素上。最后把每个输出元素的8位的二进制数用十进制数表示,然后把每个十进制数通过激活函数s-box计算后得到值作为类全连接网络的输出值。每次输入一个Pb就输出一个PCb,把P的所有元素经过类全连接网络处理后得到一维矩阵PC。Take P b as the input of the fully connected network in turn. The matrix W of step fourteen is cyclically shifted using the XR b sequence in turn. The value of the b-th element of the XR b sequence is s. If s is an odd number, the i-th row corresponding to the W matrix is shifted to the left by s elements; if s is an even number, the c-th row corresponding to the W matrix is rotated to the right by s elements. , and use the matrix obtained after this operation as the weight of the fully connected network. According to the value of each row w c sequence, select each binary digit of input P b in turn, and then put each selected digit on each element to be output. Finally, the 8-bit binary number of each output element is represented by a decimal number, and then each decimal number is calculated by the activation function s-box to obtain the value as the output value of the fully connected network. Each time a P b is input, a PC b is output, and all elements of P are processed by a quasi-fully connected network to obtain a one-dimensional matrix PC.
步骤十七、把步骤八生成的Y′序列,映射到0到255之间。由公式(24)表示:Step 17: Map the Y' sequence generated in step 8 to between 0 and 255. It is represented by formula (24):
YR=mod(floor(Y′×104,28)) (24)YR=mod(floor(Y′×10 4 , 2 8 )) (24)
步骤十八、把步骤十七中长度为512×512的序列YR分割为长度为512×512/2的序列YR1和YR2,由公式(25)表示:Step 18: Divide the sequence YR with a length of 512×512 in Step 17 into sequences YR 1 and YR 2 with a length of 512×512/2, which are represented by formula (25):
步骤十九、使用步骤十六生成的一维矩阵PC={pct}与步骤十八生成的YR1={yr1t}和YR2={yr2t}序列进行异或,由公式(26)所示:Step 19, use the one-dimensional matrix PC={pc t } generated in step 16 and the sequence of YR 1 ={yr 1t } and YR 2 ={yr 2t } generated in step 18 to perform XOR, according to formula (26) shown:
式中XOR为异或函数。异或后得到的PC1矩阵。where XOR is the exclusive OR function. The PC1 matrix obtained after XORing.
步骤二十、将步骤十九生成的PC1矩阵,转换成512×512大小的矩阵,由公式(27)所示:Step 20: Convert the PC1 matrix generated in Step 19 into a matrix of size 512×512, as shown by formula (27):
PC2=reshape(PC1,512,512) (27)PC2=reshape(PC1, 512, 512) (27)
转换后生成的矩阵PC2为最终的加密图。The converted matrix PC2 is the final encrypted image.
解密步骤:Decryption steps:
步骤二十一、解密时使用步骤七中的μ,λ,x0,y0和给定初始值的δ以步骤十、十三和十八相同的方法得到伪随机序列INDM、INDN、XR、YR1和YR2。Step 21: Use μ, λ, x 0 , y 0 in step 7 and δ of the given initial value to obtain pseudo-random sequences INDM, INDN, XR, YR 1 and YR 2 .
步骤二十二、使用步骤十四生成的矩阵W。Step 22, use the matrix W generated in step 14.
步骤二十三、将步骤二十中得到的加密图像PC2转换成一维矩阵,方法如公式(28):Step 23: Convert the encrypted image PC2 obtained in step 20 into a one-dimensional matrix, the method is as formula (28):
PC1=reshape(PC2,1,M×N) (28)PC1=reshape(PC2, 1, M×N) (28)
步骤二十四、将步骤二十三得到的一维矩阵PC1={PC1t}与步骤二十一生成的YR1={yr1t}和YR2={yr2t}序列进行异或操作,方法如公式(29)所示:Step 24: Perform XOR operation on the one-dimensional matrix PC1={PC1 t } obtained in step 23 and the sequence of YR 1 ={yr 1t } and YR 2 ={yr 2t } generated in step 21, method As shown in formula (29):
异或后得到PC矩阵。The PC matrix is obtained after XORing.
步骤二十五、将步骤二十四得到PC矩阵分成l块,每块8个元素,由公式(30)表示:Step 25: Divide the PC matrix obtained in step 24 into l blocks, each of which has 8 elements, represented by formula (30):
PC=PC1PC2PC3PC4...,...PCt-1PCt (30)PC = PC 1 PC 2 PC 3 PC 4 ..., ... PC t-1 PC t (30)
其中,t表示块号,t=1,2,...l。Wherein, t represents the block number, t=1, 2, . . . l.
步骤二十六、依次将步骤二十五得到的PCt输入到步骤十四描述的类全连接网络,进行逆的操作。依次将PCt的每个元素输入逆的类全连接网络,先把PCt的每个值使用成8位二进制表示,使用XRb序列修改W矩阵每行wc的值,根据wc的值选取输入的PCt的对应位置的数,最后生成8个元素的Pb序列。将PC所有元素经过逆的类全连接网络处理后得到P矩阵。In step 26, the PC t obtained in step 25 is sequentially input into the fully connected network described in step 14, and the inverse operation is performed. Input each element of PC t into the inverse fully connected network in turn, first use each value of PC t as an 8-bit binary representation, and use the XR b sequence to modify the value of w c in each row of the W matrix, according to the value of w c Select the number of corresponding positions of the input PC t , and finally generate a Pb sequence of 8 elements. The P matrix is obtained by processing all elements of the PC through an inverse fully connected network.
步骤二十七、将步骤二十四得到的P矩阵转换成M×N大小的矩阵,由公式(31)所示:Step 27: Convert the P matrix obtained in step 24 into a matrix of M×N size, as shown by formula (31):
Image2=reshape(P,M,N) (31)Image2=reshape(P, M, N) (31)
步骤二十八、将步骤二十七得到的Image2矩阵和INDM、INDN序列进行逆的循环移位操作。首先进行逆的列循环移位得到Image1矩阵,然后经过逆的行循环移位得到Image矩阵。Image矩阵就是得到的解密图像。Step 28: Perform an inverse cyclic shift operation on the Image2 matrix and the INDM and INDN sequences obtained in step 27. First perform the inverse column cyclic shift to obtain the Image1 matrix, and then obtain the Image matrix through the inverse row cyclic shift. The Image matrix is the resulting decrypted image.
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110107767.4A CN112887075B (en) | 2021-01-27 | 2021-01-27 | Encryption method of similar full-connection network image based on plaintext correlation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110107767.4A CN112887075B (en) | 2021-01-27 | 2021-01-27 | Encryption method of similar full-connection network image based on plaintext correlation |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112887075A CN112887075A (en) | 2021-06-01 |
CN112887075B true CN112887075B (en) | 2022-06-24 |
Family
ID=76052608
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110107767.4A Active CN112887075B (en) | 2021-01-27 | 2021-01-27 | Encryption method of similar full-connection network image based on plaintext correlation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112887075B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115277978B (en) * | 2022-09-26 | 2022-12-16 | 南通德辰智能科技有限公司 | Image information security management method based on state coding table |
CN118101846A (en) * | 2024-04-16 | 2024-05-28 | 安阳师范学院 | Novel image encryption method based on DNA strand displacement rule |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109379510A (en) * | 2018-09-13 | 2019-02-22 | 桂林电子科技大学 | An Image Encryption Method Based on Two-dimensional Logistic Chaotic System Algorithm |
KR20190104728A (en) * | 2018-03-02 | 2019-09-11 | 인천대학교 산학협력단 | Apparatus and Method for Encrypting Based on Combined Chaos in Body Area Network |
CN112084517A (en) * | 2020-09-15 | 2020-12-15 | 郑州轻工业大学 | An Image Encryption Method Based on Chaos Map and Bit-Level Permutation |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040202326A1 (en) * | 2003-04-10 | 2004-10-14 | Guanrong Chen | System and methods for real-time encryption of digital images based on 2D and 3D multi-parametric chaotic maps |
-
2021
- 2021-01-27 CN CN202110107767.4A patent/CN112887075B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20190104728A (en) * | 2018-03-02 | 2019-09-11 | 인천대학교 산학협력단 | Apparatus and Method for Encrypting Based on Combined Chaos in Body Area Network |
CN109379510A (en) * | 2018-09-13 | 2019-02-22 | 桂林电子科技大学 | An Image Encryption Method Based on Two-dimensional Logistic Chaotic System Algorithm |
CN112084517A (en) * | 2020-09-15 | 2020-12-15 | 郑州轻工业大学 | An Image Encryption Method Based on Chaos Map and Bit-Level Permutation |
Non-Patent Citations (2)
Title |
---|
An Image Segmentation Encryption Algorithm Based on Hybrid Chaotic System;li jinqing,di xiaoqiang;《IEEE Access》;20190729;全文 * |
Spatiotemporal chaos in improved cross coupled map lattice;wang mingxu 等;《Information Sciences》;20201001;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112887075A (en) | 2021-06-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110086601B (en) | Joseph traversal and hyperchaotic system image encryption method based on pixel value association | |
CN113297606B (en) | Color quantum image encryption and decryption method based on multiple chaos and DNA operation | |
Kumar et al. | A survey on chaos based image encryption techniques | |
CN109376540B (en) | An Image Encryption Method Based on Duffing Mapping and Genetic Operation | |
CN106570815A (en) | Image encryption method based on double-chaos system and blocking | |
CN106296561B (en) | Image encryption method and device, decryption method and device based on hyperchaotic system | |
CN104008520A (en) | Color image encryption method based on SHA-384 function, spatiotemporal chaotic system, quantum chaotic system and neural network | |
CN110086600B (en) | An Image Encryption Method Based on Hyperchaotic System and Variable Step Joseph Problem | |
CN109803063A (en) | A kind of image encryption method based on five dimension ultra-chaos systems | |
CN107590394A (en) | A kind of image encryption method based on chaotic maps and bit recombination | |
CN107437266A (en) | Image encryption method based on chaos system Yu DNA chain displacement model | |
CN112887075B (en) | Encryption method of similar full-connection network image based on plaintext correlation | |
CN110519037A (en) | The image encryption method of ultra-chaos pseudo random sequence | |
CN117499005A (en) | Image encryption method based on 4D chaotic system | |
CN109361830B (en) | Image encryption method based on plaintext | |
CN117440101A (en) | Image encryption algorithm and electronic equipment based on multi-chaotic system and circular DNA operation | |
Zhang et al. | The unified image cryptography algorithm based on finite group | |
Iqbal et al. | An efficient hybrid encryption model based on deep convolutional neural networks, deoxyribonucleic acid computing and chaotic system | |
CN112788196B (en) | A Double Image Encryption Method Based on Dynamic Adaptive Diffusion of Convolutional Neural Networks | |
Kumar et al. | SOCIET: Second-order cellular automata and chaotic map-based hybrid image encryption technique | |
CN113259089A (en) | Image encryption method based on combination of chaos principle and genetic algorithm | |
CN118055195A (en) | Image encryption method based on improved chaotic system and compressed sensing | |
Balaji et al. | VLSI Implementation of Optimized 2D SIMM Chaotic Map for Image Encryption. | |
Chattopadhyay et al. | Encoding by DNA relations and randomization through chaotic sequences for image encryption | |
CN117494182A (en) | A facial image regional information encryption method based on four-dimensional chaotic system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |