﻿ 基于改进Logistic映射的图像加密算法
 计算机系统应用  2019, Vol. 28 Issue (6): 125-129 PDF

1. 江苏南水科技有限公司, 南京 210012;
2. 水利部南京水利水文自动化研究所, 南京 210012

Image Encryption Algorithm Based on Improved Logistic Mapping
HU Chun-Jie1,2, RUAN Cong2, NIU Zhi-Xing1
1. Jiangsu Nanshui Technology Co. Ltd., Nanjing 210012, China;
2. Nanjing Automation Institute of Water Conservancy, Ministry of Water Resources, Nanjing 210012, China
Abstract: In order to effectively improve the image encryption effect and security, an improved logistic mapping image encryption algorithm is designed. Firstly, on the basis of cubic mapping and logistic mapping, a new two-dimensional discrete mapping is proposed to overcome the problem of narrow chaotic interval and fewer parameters. The image is scrambled by improved logistic mapping. Then the scrambled image is processed by bitwise exclusive or operation between adjacent pixels, and the final cipher-text image is obtained by crossover operation. The simulation results show that the algorithm is simple and easy to execute, has good security, strong anti-attack ability and high efficiency.
Key words: cubic mapping     improved logistic mapping     bit exchanged across     image encryption

1 Logistic映射及改进 1.1 Logistic映射

Logistic映射是一个典型的非线性迭代方程. 其方程如下:

 ${x_{k + 1}} = \mu {x_k}(1 - {x_k})$ (1)

 图 1 Logistic映射序列分布

1.2 改进的Logistic映射

 $\left\{ {\begin{array}{*{20}{c}} {{x_{k + 1}} = \mu {y_k} - c{x_k}{y_k}} \\ {{y_{k + 1}} = ax_k^2 - b{x_k}} \end{array}} \right.$ (2)

2 改进的加密算法设计 2.1 位置置乱

(1) 将原始明文图像转换成二维矩阵, 分别将其行数和列数放在数组C1和C2中;

(2) 计算原始明文图像所有像素值之和为sum, 通过式(3), 得到辅助密钥k;

 $k = od (sum,256)/255$ (3)

(3) 设改进logistic映射的初始值为 ${x_0}$ ${y_0}$ 经过 ${x'_0} = \sqrt {({x_0}^2 + {k^2})/2}$ ${y'_0} = \sqrt {({x_0}^2 + {k^2})/2}$ 得到混沌系统新的初始值 ${x'_0}$ ${y'_0}$ ;

(4) 设置初始条件 ${x_0}$ =0.3, ${y_0}$ =0.4经过式(2)迭代生成两个实数序列 $\left\{ {{x_k},{y_k}|k = 1,2,\cdots, m \times n} \right\}$

(5) 对序列 ${x_k}$ ${y_k}$ 分别依次进行升序操作, 并相应地记录各元素在原始序列的下标, 得到两个序列的索引Index1和Index2, 将索引Index1和Index2与原始图像的行C1和列C2交换, 从而达到置乱的效果, 得到置乱图像C.

2.2 图像像素值的改变

(1) 设置乱图像C的第一个像素的灰度值为C(1)与255进行异或, 得到 $C'(1)$ ,再对 $C'(1)$ 进行交叉换位, 得到Q(1). 具体的换位操作如下图2所示(图 2中的bit1, bit2, …, bit8 分别表示像素点二进制灰度值的第 1, 2, …, 8位);

 图 2 交叉换位示意图

(2) 置乱图像C的第二个像素的灰度值C(2)与Q(1)进行异或操作, 得到 $C'(2)$ ,再对 $C'(1)$ 进行交叉换位, 得到Q(2);

(3) 依次将图像的每个灰度值C(i)与Q(i-1)进行异或, 得到 $C'(i)$ ; 依据交叉换位规则得到Q(i). 最后将一维Q(i)换成图像D, 即得到最终加密图像D.

2.3 解密算法

3 仿真结果

 图 3 图像加密与解密

4 算法分析 4.1 直方图分析

 图 4 加密前后的灰度值

4.2 密钥空间分析

4.3 信息熵

 $H(m) = \sum\limits_{i = 1}^{2N - 1} {P({m_i})} {\log _2}\frac{1}{{P({m_i})}}$ (4)

4.4 相邻像素点的相关性

 $\left\{ {\begin{array}{*{20}{l}} {D(x) = 1/n\sum\limits_{i = 1}^n {{{[{x_i} - E(x)]}^2}} } \\ {\operatorname{cov} (x,y) = 1/n\sum\limits_{i = 1}^n {[{x_i} - E(x)][{y_i} - E(y)]} } \\ {r = \operatorname{cov} (x,y)/(\sqrt {D(x)} \sqrt {D(y)} )} \end{array}} \right.$ (5)

 图 5 垂直方向的相关性

 图 6 水平方向的相关性

 图 7 对角方向的相关性

4.5 差分攻击分析

 $NPCR = \frac{{\sum\limits_{i,j} {D(i,j)} }}{{m \times n}} \times 100\%$ (6)
 $UACI = \frac{1}{{m \times n}}\left[ {\sum\limits_{i,j} {\frac{{\left| {{C_1}(i,j) - {C_2}(i,j)} \right|}}{{255}}} } \right] \times 100\%$ (7)

5 结束语

 [1] François M, Grosges T, Barchiesi D, et al. A new image encryption scheme based on a chaotic function. Signal Processing: Image Communication, 2012, 27(3): 249-259. DOI:10.1016/j.image.2011.11.003 [2] 胡春杰, 陈晓, 郭银. 基于多混沌映射的光学图像加密算法. 激光杂志, 2017, 38(1): 110-114. [3] 张健, 房东鑫. 应用混沌映射索引和DNA编码的图像加密技术. 计算机工程与设计, 2015, 36(3): 613-618. [4] Kanso A, Ghebleh M. A novel image encryption algorithm based on a 3D chaotic map. Communications in Nonlinear Science and Numerical Simulation, 2012, 17(7): 2943-2959. DOI:10.1016/j.cnsns.2011.11.030 [5] Wang XY, Yang L. A novel chaotic image encryption algorithm based on water wave motion and water drop diffusion models. Optics Communications, 2012, 285(20): 4033-4042. DOI:10.1016/j.optcom.2012.06.039 [6] Lin R, Liu QN, Zhang CL. A new fast algorithm for gyrator transform. Laser Technology, 2012, 36(1): 50-53. [7] 刘刚, 王立香. 一种新的基于混沌的图像加密算法. 电视技术, 2008, 32(12): 22-24. DOI:10.3969/j.issn.1002-8692.2008.12.007 [8] 朱晓升, 廖晓峰. 基于图像分区的置乱算法. 计算机技术与发展, 2015, 25(12): 52-55, 59. [9] 谢国波, 丁煜明. 基于Logistic映射的可变置乱参数的图像加密算法. 微电子学与计算机, 2015, 32(4): 111-115. [10] Zhu CX, Sun KH. Cryptanalysis and improvement of a class of hyperchaos based image encryption algorithms. Acta Physica Sinica, 2012, 61(12): 120503. [11] Wang XG, Zhan M, Lai CH, et al. Error function attack of chaos synchronization based encryption schemes. Chaos, 2004, 14(1): 128-137. DOI:10.1063/1.1633492 [12] Pan TG, Li DY. A novel image encryption using Arnold cat. International Journal of Security and its Application, 2013, 7(5): 377-386. DOI:10.14257/ijsia [13] 张海涛, 姚雪, 陈虹宇, 等. 基于分层Arnold变换的置乱算法. 计算机应用, 2013, 33(8): 2240-2243. [14] 赵芳玲, 马文涛. 一种图像混合加密算法仿真研究. 计算机仿真, 2012, 29(5): 278-282, 290. DOI:10.3969/j.issn.1006-9348.2012.05.068 [15] 王静, 蒋国平. 一种超混沌图像加密算法的安全性分析及其改进. 物理学报, 2011, 60(6): 83-93.