CN106157231A - A kind of based on image information encryption and the decryption method of improving Arnold conversion and LSB - Google Patents

A kind of based on image information encryption and the decryption method of improving Arnold conversion and LSB Download PDF

Info

Publication number
CN106157231A
CN106157231A CN201610482879.7A CN201610482879A CN106157231A CN 106157231 A CN106157231 A CN 106157231A CN 201610482879 A CN201610482879 A CN 201610482879A CN 106157231 A CN106157231 A CN 106157231A
Authority
CN
China
Prior art keywords
image
pixel
encryption
frame
lsb
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.)
Granted
Application number
CN201610482879.7A
Other languages
Chinese (zh)
Other versions
CN106157231B (en
Inventor
张迎周
卫学渊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Post and Telecommunication University
Original Assignee
Nanjing Post and Telecommunication 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 Nanjing Post and Telecommunication University filed Critical Nanjing Post and Telecommunication University
Priority to CN201610482879.7A priority Critical patent/CN106157231B/en
Publication of CN106157231A publication Critical patent/CN106157231A/en
Application granted granted Critical
Publication of CN106157231B publication Critical patent/CN106157231B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Facsimile Transmission Control (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses a kind of based on image information encryption and the decryption method of improving Arnold conversion and LSB, first this method uses the Arnold conversion of improvement that image carries out pretreatment, then it is embedded in background image with LSB algorithm and constructs the new images containing encrypted image.Ciphering process is broadly divided into four big steps: calculates quantity of information, input key that background image can accommodate, and uses the Arnold conversion of improvement hiding frame to carry out pretreatment, the size of the hiding frame of storage, uses LSB algorithm to be embedded in background image by hiding frame.Decrypting process is broadly divided into three big steps: extracts hiding frame size, LSB algorithm extracts and hide frame, input key and the hiding frame after extracting is carried out Arnold inverse transformation deciphering.The present invention has been greatly reinforced the confidentiality of information.

Description

一种基于改进Arnold变换和LSB的图像信息加密及解密方法An Image Information Encryption and Decryption Method Based on Improved Arnold Transform and LSB

技术领域technical field

本发明涉及信息隐藏技术领域,特别是一种基于改进Arnold变换和LSB的图像信息加密及解密方法。The invention relates to the technical field of information hiding, in particular to an image information encryption and decryption method based on improved Arnold transformation and LSB.

背景技术Background technique

信息隐藏技术(Steganography technique)是信息安全研究领域里面对于图像加密隐藏的一种技术。同时也是计算机应用领域中的其中一个典型的隐秘通道问题的解决方案,在军事领域,信息伪装等信息加密传输领域有着广泛的应用。Steganography technique is a technology for image encryption and hiding in the field of information security research. At the same time, it is also a typical solution to the covert channel problem in the field of computer applications. It has a wide range of applications in the military field, information camouflage and other information encrypted transmission fields.

针对信息隐藏技术这一问题,现阶段主要有时空域算法和变换域算法两种解决方案。但是两者由于本身固有的缺点,并不能很好的直接用于图像信息隐藏的实际应用中。时空域主要缺点是隐藏的信息容易被检测出来,而变换域虽然加密技术相对较好,但是信息隐藏的容量小,而且受制于图像的像素分布。Aiming at the problem of information hiding technology, at this stage, there are mainly two solutions: space-time domain algorithm and transform domain algorithm. However, due to their own inherent shortcomings, the two methods cannot be directly used in the practical application of image information hiding. The main disadvantage of the space-time domain is that the hidden information is easy to be detected. Although the encryption technology of the transform domain is relatively good, the capacity of information hiding is small, and it is limited by the pixel distribution of the image.

图像信息隐藏技术虽然研究广泛,但是目前为止尚未有一种完美的解决方案,而且对于不同的应用场景采用的隐藏方案也不同。2007年,邵利平等人在《二维非等长图像置乱变换》一文中讨论了改进的Arnold变换用于非等长图像加密变换的几种算法;2012年,夏煜等人在《基于图像的信息隐藏分析技术综述》一文中则讨论了现阶段图像隐藏分析技术的发展,对于嵌入了隐秘信息的图像的探测的方法做了介绍。目前图像的信息隐藏目的主要是防止被检测、被破解出来;但如何做好防检测、防破解是目前还亟待解决的问题。Although image information hiding technology has been widely studied, there is no perfect solution so far, and the hiding schemes adopted for different application scenarios are also different. In 2007, Shao Liping and others discussed several algorithms of the improved Arnold transform for non-equal-length image encryption transformation in the article "Two-dimensional non-equal-length image scrambling transformation"; in 2012, Xia Yu et al. "A Review of Image Information Hiding Analysis Technology" discusses the development of image hiding analysis technology at the present stage, and introduces the detection methods of images embedded with hidden information. At present, the purpose of image information hiding is mainly to prevent detection and cracking; however, how to prevent detection and cracking is still an urgent problem to be solved.

发明内容Contents of the invention

本发明所要解决的技术问题是克服现有技术的不足,而提供一种基于改进Arnold变换和LSB的图像信息加密及解密方法,利用改进的Arnold变换对需要隐写的隐藏信息图像进行变换,然后利用LSB算法将隐藏信息图像嵌入到背景图像中生成加密后图像,加密后图像与背景图像从肉眼上无法分辨;解密时仅需加密后图像便可分理出隐藏信息图像。The technical problem to be solved by the present invention is to overcome the deficiencies in the prior art, and provide a kind of image information encryption and decryption method based on the improved Arnold transform and LSB, utilize the improved Arnold transform to transform the hidden information image that needs steganography, and then Using the LSB algorithm to embed the hidden information image into the background image to generate an encrypted image, the encrypted image and the background image cannot be distinguished from the naked eye; only the encrypted image is needed to separate the hidden information image during decryption.

本发明为解决上述技术问题采用以下技术方案:The present invention adopts the following technical solutions for solving the problems of the technologies described above:

根据本发明提出的一种基于改进Arnold变换和LSB的图像信息加密及解密方法,包括以下步骤:A kind of image information encryption and decryption method based on improved Arnold transform and LSB proposed according to the present invention comprises the following steps:

步骤1、加载背景图像,并计算出该背景图像可容纳的最大像素数;若隐藏信息图像的像素数超过最大像素数,则用户对隐藏信息图像进行裁剪;Step 1, load the background image, and calculate the maximum number of pixels that the background image can accommodate; if the number of pixels of the hidden information image exceeds the maximum number of pixels, the user crops the hidden information image;

步骤2、采用改进的Arnold变换对隐藏信息图像进行预处理;具体如下:Step 2, using the improved Arnold transform to preprocess the hidden information image; specifically as follows:

步骤2.1)、用户输入2个密钥的数值key1、key2,key1和key2均为正整数;Step 2.1), the user inputs the values key1 and key2 of the two keys, and both key1 and key2 are positive integers;

步骤2.2)、用户选择下述加密方式中的任一种对隐藏信息图像进行加密:Step 2.2), the user chooses any one of the following encryption methods to encrypt the hidden information image:

第一种加密方式:每个隐藏信息图像像素的新的坐标为(x′,y′),其中:x′=(x+key2*y),y′=y;The first encryption method: the new coordinates of each hidden information image pixel are (x', y'), wherein: x'=(x+key2*y), y'=y;

第二种加密方式:每个隐藏信息图像像素的新的坐标为(x′,y′),其中,x′=x,y′=(key2*x+y);其中,(x,y)是需要加密的隐藏信息图像的原始像素坐标;The second encryption method: the new coordinates of each hidden information image pixel are (x', y'), wherein, x'=x, y'=(key2*x+y); wherein, (x, y) is the original pixel coordinate of the hidden information image to be encrypted;

然后x′、y′分别对隐藏信息图像的宽度A.width和高度A.height进行取余运算:x″=x′mod A.width;y″=y′mod A.height;Then x', y' carry out remainder operation to width A.width and height A.height of hidden information image respectively: x "=x'mod A.width; y "=y'mod A.height;

步骤2.3)、将原来坐标为(x,y)的像素点搬移到新的像素点(x″,y″)处;Step 2.3), move the pixel point whose original coordinates are (x, y) to the new pixel point (x″, y″);

步骤2.4)、重复执行步骤2.2)-步骤2.3)key1次;Step 2.4), repeat step 2.2)-step 2.3) key1 times;

步骤3、将隐藏信息图像的尺寸存储在背景图像的开头;Step 3, storing the size of the hidden information image at the beginning of the background image;

步骤4、将经过步骤2预处理后的隐藏信息图像使用LSB算法嵌入到背景图像中,从而生成加密后的图像;Step 4, embedding the hidden information image preprocessed in step 2 into the background image using the LSB algorithm, thereby generating an encrypted image;

步骤5、提取隐藏信息图像尺寸;Step 5, extract hidden information image size;

步骤6、由LSB算法提取隐藏信息图像;Step 6, extracting the hidden information image by the LSB algorithm;

步骤7、用户输入密钥并对提取后的隐藏信息图像进行Arnold反变换解密,从而恢复了隐藏信息图像的原始数据。Step 7. The user enters the key and performs Arnold inverse transformation and decryption on the extracted hidden information image, thereby recovering the original data of the hidden information image.

作为本发明所述的一种基于改进Arnold变换和LSB的图像信息加密及解密方法进一步优化方案,所述步骤3具体如下:As a further optimization scheme of the image information encryption and decryption method based on the improved Arnold transform and LSB described in the present invention, the step 3 is specifically as follows:

步骤3.1)、遍历背景图像的前4个像素,每个像素包含3个字节;首先将隐藏信息图像的高度A.height每2bit一组拆分,按照顺序直接替换背景图像中前6个字节中每个字节的最末2bit;Step 3.1), traverse the first 4 pixels of the background image, each pixel contains 3 bytes; first split the height A.height of the hidden information image into groups of 2 bits, and directly replace the first 6 characters in the background image in order The last 2 bits of each byte in the section;

步骤3.2)、将隐藏图像A的宽度A.width每2bit一组拆分,按照顺序直接替换背景图像中后6个字节中每个字节的最末2bit。Step 3.2), split the width A.width of the hidden image A into groups of 2 bits, and directly replace the last 2 bits of each byte in the last 6 bytes in the background image in order.

作为本发明所述的一种基于改进Arnold变换和LSB的图像信息加密及解密方法进一步优化方案,所述步骤4具体如下:As a further optimization scheme of the image information encryption and decryption method based on the improved Arnold transform and LSB described in the present invention, the step 4 is specifically as follows:

步骤4.1)、跳过背景图像的前4个像素的隐藏信息图像的尺寸存储区,对隐藏信息图像进行LSB加密;设初始迭代次数i=1;Step 4.1), skip the size storage area of the hidden information image of the first 4 pixels of the background image, and perform LSB encryption on the hidden information image; set the initial number of iterations i=1;

步骤4.2)、依次取出隐藏信息图像中的第i个字节,将该字节的最高2bit存放在背景图像的第(4+i)个像素的第1个字节的末2bit中,直接替换掉背景图像的第(4+i)个像素第1个字节的末2bit;Step 4.2), take out the i-th byte in the hidden information image in turn, store the highest 2 bits of the byte in the last 2 bits of the first byte of the (4+i) pixel of the background image, and replace it directly Drop the last 2 bits of the first byte of the (4+i)th pixel of the background image;

步骤4.3)、然后取出该字节的第6位、第5位的数据放在背景图像的第(4+i)个像素的第2个字节的末2bit中;Step 4.3), then take out the 6th and 5th data of the byte and put it in the last 2bit of the 2nd byte of the (4+i)th pixel of the background image;

步骤4.4)、当i小于隐藏信息图像的所有字节数量,则i=i+1,重复步骤4.2)-步骤4.4);直到将隐藏信息图像的所有字节全部被放入背景图像中,这样就生成加密后图像。Step 4.4), when i is less than all the bytes of the hidden information image, then i=i+1, repeat steps 4.2)-step 4.4); until all the bytes of the hidden information image are all put into the background image, like this An encrypted image is generated.

作为本发明所述的一种基于改进Arnold变换和LSB的图像信息加密及解密方法进一步优化方案,所述步骤5具体如下:As a further optimization scheme of the image information encryption and decryption method based on the improved Arnold transform and LSB described in the present invention, the step 5 is specifically as follows:

步骤5.1)、加载加密后图像到内存;Step 5.1), load the encrypted image to the memory;

步骤5.2)、提取出加密后图像的前4个像素数据,其中,根据加密原理,前2个像素为图像的高度数据,后2个像素为图像的宽度数据;前2个像素中,每个像素按照顺序直接提取其中每个字节的最末2bit,然后拼接在一起形成12bit的数值,该数值就是隐藏信息图像的高度数值A.height;Step 5.2), extract the first 4 pixel data of the encrypted image, wherein, according to the encryption principle, the first 2 pixels are the height data of the image, and the last 2 pixels are the width data of the image; in the first 2 pixels, each Pixels directly extract the last 2 bits of each byte in order, and then splice them together to form a 12-bit value, which is the height value A.height of the hidden information image;

步骤5.3)、提取出加密后图像的前4个像素中的后2个像素数据,后2个像素中,每个像素按照顺序直接提取其中每个字节的最末2bit,并按顺序直接拼接成12bit的数值,该数值就是隐藏信息图像的宽度数值A.width。Step 5.3), extract the last 2 pixel data of the first 4 pixels of the encrypted image, and in the last 2 pixels, each pixel directly extracts the last 2 bits of each byte in order, and directly stitches them in order into a 12-bit value, which is the width value A.width of the hidden information image.

作为本发明所述的一种基于改进Arnold变换和LSB的图像信息加密及解密方法进一步优化方案,所述步骤6具体如下:As a further optimization scheme of the image information encryption and decryption method based on the improved Arnold transform and LSB described in the present invention, the step 6 is specifically as follows:

步骤6.1)、跳过加密后图像的前4个像素;Step 6.1), skipping the first 4 pixels of the encrypted image;

步骤6.2)从加密后的图像的第5个像素开始,将每个像素的每个字节的最末2bit提取出来按照顺序拼接,最终生成带有改进Arnold变换后的隐藏信息图像。Step 6.2) Starting from the fifth pixel of the encrypted image, the last 2 bits of each byte of each pixel are extracted and spliced in order to finally generate a hidden information image with an improved Arnold transform.

作为本发明所述的一种基于改进Arnold变换和LSB的图像信息加密及解密方法进一步优化方案,所述步骤7具体如下:As a further optimization scheme of the image information encryption and decryption method based on the improved Arnold transform and LSB described in the present invention, the step 7 is specifically as follows:

步骤7.1)、如果是第一种加密方式,则根据公式x1=(x″-key2*y″),y1=y″进行图像Arnold反变换解密;如果是第二种加密方式,则根据公式x1=x″,y1=(-key2*x″+y″)进行图像Arnold反变换解密;Step 7.1), if it is the first encryption method, then according to the formula x1=(x″-key2*y″), y1=y″ carries out image Arnold inverse transformation decryption; if it is the second encryption method, then according to the formula x1 =x ", y1=(-key2*x "+y") carries out image Arnold inverse transform decryption;

步骤7.2)、然后x1,y1分别对隐藏信息图像的宽度A.width和高度A.height进行取余运算:x=x1 mod A.width,y=y1mod A.height;如果x<0则x=x+A.width,如果y<0则y=y+A.height;Step 7.2), then x1, y1 respectively carry out remainder operation on width A.width and height A.height of hidden information image: x=x1 mod A.width, y=y1 mod A.height; if x<0 then x= x+A.width, if y<0 then y=y+A.height;

步骤7.3)、重复执行步骤7.1)到步骤7.2)key1次,这样就恢复了隐藏信息图像的原始数据。Step 7.3), repeat step 7.1) to step 7.2) key1 times, thus recovering the original data of the hidden information image.

本发明采用以上技术方案与现有技术相比,具有以下技术效果:Compared with the prior art, the present invention adopts the above technical scheme and has the following technical effects:

(1)将Arnold变换用于图像信息隐藏技术当中;(1) Arnold transform is used in image information hiding technology;

(2)使用LSB算法结合Arnold变换嵌入图像,使得隐藏的信息容量更大,而且由于图像变换后呈现无规则排列,因此难以被检测到包含隐藏信息;(2) Using the LSB algorithm combined with the Arnold transform to embed the image, so that the hidden information capacity is larger, and because the image is irregularly arranged after transformation, it is difficult to detect the hidden information;

(3)用户通过3个密钥的形式加密,大大加强了信息的保密性;(3) The user encrypts in the form of 3 keys, which greatly enhances the confidentiality of information;

(4)加密后图像具有一定的防破坏能力,损失一定的像素信息隐藏信息图像仍然能够被恢复;(4) The encrypted image has a certain anti-destruction ability, and the image that loses certain pixel information and hides information can still be restored;

(5)采用改进的Arnold变换算法,可以对非等长的图像进行加密,传统Arnold只能对矩形图像进行加密置乱。(5) Using the improved Arnold transformation algorithm, images of non-equal length can be encrypted, while traditional Arnold can only encrypt and scramble rectangular images.

附图说明Description of drawings

图1是本发明的加解密示意图。Fig. 1 is a schematic diagram of encryption and decryption of the present invention.

图2是本发明的加密过程的流程图。Figure 2 is a flowchart of the encryption process of the present invention.

图3是本发明的解密过程的流程图。Fig. 3 is a flowchart of the decryption process of the present invention.

图4为本方法使用的LSB存储数据的逻辑图。FIG. 4 is a logical diagram of LSB storage data used in the method.

具体实施方式detailed description

为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图及具体实施例对本发明进行详细描述。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

为了方便叙述,简单定义算法中的主要变量为:隐藏信息图像A,背景图像B,嵌入后生成的加密后图像C,其中用height表示图像的高度,width表示图像的宽度,A.width表示A图像的宽度,A.height表示A图像的高度。B、C图像亦同。其中用户需要输入的密钥有两个,密钥key1以及密钥key2,加密位置为1号或2号;For the convenience of description, the main variables in the simple definition algorithm are: hidden information image A, background image B, and encrypted image C generated after embedding, where height represents the height of the image, width represents the width of the image, and A.width represents A The width of the image, A.height indicates the height of the A image. The same is true for B and C images. Among them, the user needs to enter two keys, key1 and key2, and the encryption position is No. 1 or No. 2;

图1是本发明的加解密示意图,本方法首先运用改进的Arnold变换对图像进行预处理,然后将其用LSB算法嵌入在背景图像中构造出含有加密图像的新图像。加密过程主要分为四大步骤:计算出背景图像能够容纳的信息量、输入密钥,并使用改进的Arnold变换对隐藏信息图像进行预处理、存储隐藏信息图像的尺寸、使用LSB算法将隐藏信息图像嵌入到背景图像中。解密过程主要分为三大步骤:提取隐藏信息图像尺寸、由LSB算法提取隐藏信息图像、输入密钥并对提取后的隐藏信息图像进行Arnold反变换解密。Fig. 1 is a schematic diagram of encryption and decryption of the present invention. This method first uses the improved Arnold transform to preprocess the image, and then embeds it in the background image with the LSB algorithm to construct a new image containing the encrypted image. The encryption process is mainly divided into four steps: calculate the amount of information that the background image can hold, input the key, and use the improved Arnold transform to preprocess the hidden information image, store the size of the hidden information image, and use the LSB algorithm to convert the hidden information The image is embedded in the background image. The decryption process is mainly divided into three steps: extracting the size of the hidden information image, extracting the hidden information image by the LSB algorithm, inputting the key, and decrypting the extracted hidden information image by Arnold inverse transformation.

图2是本发明的加密过程的流程图,加密步骤为:Fig. 2 is the flowchart of encryption process of the present invention, and encryption step is:

步骤1)加载背景图像B,并估算出该背景图像B能够容纳多大的隐藏信息:Step 1) Load the background image B, and estimate how much hidden information the background image B can hold:

步骤1.1)由公式计算出可容纳的隐藏信息图像的最大像素数;Step 1.1) by the formula Calculate the maximum number of pixels that can accommodate hidden information images;

步骤1.2)如果隐藏信息图像A的像素数没有超过上一步骤计算出来的最大像素数,则执行下一步,否则,需要用户对隐藏信息图像A进行裁剪。Step 1.2) If the number of pixels of the hidden information image A does not exceed the maximum number of pixels calculated in the previous step, perform the next step; otherwise, the user needs to crop the hidden information image A.

步骤2)使用改进的Arnold变换对隐藏信息图像A进行预处理:Step 2) Preprocess the hidden information image A using the improved Arnold transform:

步骤2.1)用户输入2个密钥的数值,key1和key2,均为正整数;Step 2.1) The user inputs the values of two keys, key1 and key2, both of which are positive integers;

步骤2.2)用户选择加密位置为1号或者2号;key1,key2和加密位置用户不能丢失,还原图像时需要三个值全部正确才能恢复;其中key1作为Arnold变换的变换次数;Step 2.2) The user selects the encrypted position as No. 1 or No. 2; key1, key2 and the encrypted position cannot be lost by the user, and all three values need to be correct to restore the image; wherein key1 is used as the number of transformations of the Arnold transformation;

步骤2.3)对隐藏信息图A像采取改进后的Arnold变换,如果用户选择加密位置为1号位置,则每个图像像素的新的x坐标和新的y坐标计算公式为:x′=(x+key2*y),y′=y,如果用户选择加密位置为2号位置,则每个图像像素的新的x坐标和新的y坐标计算公式为:x′=x,y′=(key2*x+y),然后x′、y′分别对隐藏信息图像的宽度A.width和高度A.height进行取余运算:x″=x′mod A.width;y″=y′mod A.height;Step 2.3) The improved Arnold transformation is adopted for the hidden information image A. If the user selects the encrypted position as position No. 1, the new x-coordinate and new y-coordinate calculation formula of each image pixel is: x′=(x +key2*y), y'=y, if the user selects the encrypted position as the No. 2 position, then the new x-coordinate and new y-coordinate calculation formula of each image pixel is: x'=x, y'=(key2 *x+y), then x' and y' respectively perform remainder operations on the width A.width and height A.height of the hidden information image: x"=x'mod A.width; y"=y'mod A. height;

步骤2.4)求出新的坐标(x″,y″)后,将原来的(x,y)坐标的像素点搬移到新的像素点(x″,y″)处;Step 2.4) After calculating the new coordinates (x″, y″), move the pixel point of the original (x, y) coordinate to the new pixel point (x″, y″);

步骤2.5)按照key1的数值大小重复执行步骤2.3)到步骤2.4)key1次;Step 2.5) Repeat step 2.3) to step 2.4) key1 times according to the value of key1;

步骤3)将隐藏信息图像A的尺寸存储在背景图像B的开头:Step 3) Store the dimensions of hidden information image A at the beginning of background image B:

步骤3.1)遍历背景图像B前4个像素,由于图像加载到内存后每个像素包含3字节,分别对应B通道,G通道,R通道(蓝通道,绿通道,红通道)。因此前4像素共计12字节。由于修改每个字节的最末2bit并不影响图像的质量,用户肉眼无法分辨,因此,每个字节的最末2bit可以用来存储数据。首先将隐藏信息图像A的宽度A.height存入前2个像素(即前6字节),其中每个字节可存2bit数据,因此共计12bit,最高可存212-1=4095像素高度,存储方式为将隐藏信息图像A的高度A.height每2bit一组拆分,按照顺序直接替换背景图像前6字节的每字节最末2bit;Step 3.1) Traversing the first 4 pixels of the background image B, because each pixel contains 3 bytes after the image is loaded into the memory, corresponding to the B channel, G channel, and R channel (blue channel, green channel, red channel). So the first 4 pixels total 12 bytes. Since modifying the last 2 bits of each byte does not affect the quality of the image, the user cannot distinguish it with the naked eye. Therefore, the last 2 bits of each byte can be used to store data. First store the width A.height of the hidden information image A into the first 2 pixels (that is, the first 6 bytes), where each byte can store 2bit data, so the total is 12bit, and the maximum can store 2 12 -1=4095 pixel height , the storage method is to split the height A.height of the hidden information image A into groups of 2 bits, and directly replace the last 2 bits of each byte of the first 6 bytes of the background image in order;

步骤3.2)将隐藏图像A的宽度A.width存入后2个像素(即后6字节),其中和前6字节一样,每个字节2bit数据,因此共计12bit,最高存212-1=4095像素高度的隐藏信息图像。存储方式和步骤3.1)中隐藏信息图像A的高度A.height存储方式一样;Step 3.2) Store the width A.width of the hidden image A into the last 2 pixels (that is, the last 6 bytes), which is the same as the first 6 bytes, and each byte has 2 bits of data, so the total is 12 bits, and the maximum storage is 2 12 - 1 = hidden information image of 4095 pixel height. The storage method is the same as the height A.height storage method of the hidden information image A in step 3.1);

步骤4)将经过Arnold变换后的隐藏信息图像A嵌入到背景图像B中:Step 4) Embed the hidden information image A after the Arnold transformation into the background image B:

步骤4.1)跳过背景图像B的前4个像素的隐藏图像A尺寸存储区,开始对图像进行LSB加密。首先取出隐藏图像A的1个字节(8bit)(记为t),将该t字节最高2bit存放在背景图像B的第5像素的第1个字节的末2bit中,直接替换掉背景图像B的第5像素第1个字节的末2bit。Step 4.1) Skip the hidden image A size storage area of the first 4 pixels of the background image B, and start to perform LSB encryption on the image. First, take out 1 byte (8bit) of hidden image A (denoted as t), store the highest 2bit of this tbyte in the last 2bit of the first byte of the 5th pixel of background image B, and directly replace the background The last 2 bits of the first byte of the fifth pixel of image B.

步骤4.2)然后取出t的次高2bit,即其6、5位数据放在背景图像的第5像素的第2个字节的末2bit中,以此类推,直到将隐藏信息图像A的所有字节全部放入背景图像中。这样就生成加密后图像C。Step 4.2) Then take out the second highest 2 bits of t, that is, its 6 and 5 bits of data are placed in the last 2 bits of the 2nd byte of the 5th pixel of the background image, and so on until all the words of the hidden information image A section all into the background image. In this way, the encrypted image C is generated.

步骤5)将加密后图像C保存。Step 5) Save the encrypted image C.

图3是本发明的解密过程的流程图,解密步骤为:Fig. 3 is a flowchart of the decryption process of the present invention, and the decryption steps are:

步骤1)提取隐藏信息图像尺寸:Step 1) Extract hidden information image size:

步骤1.1)加载加密后图像C到内存。Step 1.1) Load the encrypted image C to memory.

步骤1.2)提取出加密后图像C的前4像素数据,其中,根据加密原理,前2像素为图像的高度数据,后2像素为图像的宽度数据。前2个像素中,每个像素按照顺序直接提取其中每个字节的最末2bit,然后拼接在一起形成12bit的数值,该数值就是隐藏信息图像的高度数值A.height;Step 1.2) Extract the first 4 pixel data of the encrypted image C, wherein, according to the encryption principle, the first 2 pixels are the height data of the image, and the last 2 pixels are the width data of the image. In the first two pixels, each pixel directly extracts the last 2 bits of each byte in order, and then stitches them together to form a 12-bit value, which is the height value A.height of the hidden information image;

步骤1.3)提取出加密后图像C的前4像素中的后2像素数据并按照步骤1.2)的方法提取其中每个字节的最末2bit按顺序直接拼接成12bit的数值,该数值就是隐藏信息图像的宽度数值Awidth;Step 1.3) Extract the data of the last 2 pixels in the first 4 pixels of the encrypted image C and extract the last 2 bits of each byte in order according to the method of step 1.2) and directly splice them into a 12-bit value, which is the hidden information Image width value Awidth;

步骤2)提取隐藏信息图像:Step 2) Extract hidden information image:

步骤2.1)跳过加密后图像的前4像素;Step 2.1) Skip the first 4 pixels of the encrypted image;

步骤2.2)从第5像素点开始,每个像素点(3个字节)的每个字节的最末2bit提取出来拼接;首先第5像素的第1个字节提取最末2bit数据到隐藏信息图像A的第1个像素的第1字节的7、8位;Step 2.2) Starting from the 5th pixel, the last 2 bits of each byte of each pixel (3 bytes) are extracted and spliced; first, the first byte of the 5th pixel extracts the last 2 bits of data to hide Bits 7 and 8 of the first byte of the first pixel of the information image A;

步骤2.3)提取第5像素第2字节的最末2bit数据到隐藏信息图像A的第1个像素的第1字节的5、6位,Step 2.3) Extract the last 2bit data of the 2nd byte of the 5th pixel to the 5th and 6th bits of the 1st byte of the 1st pixel of the hidden information image A,

步骤2.4)以此类推,提取完隐藏信息图像A第1个像素的第1字节之后(8bit对应1个字节),提取第2字节,还是按照顺序提取,直到所有的隐藏信息图像的像素点提取完毕,隐藏信息图像的尺寸就是步骤1.2)和步骤1.3)提取出来的尺寸;最终生成带有改进Arnold变换后的隐藏信息图像A;Step 2.4) By analogy, after extracting the first byte of the first pixel of the hidden information image A (8bit corresponds to 1 byte), extract the second byte, or extract in order, until all hidden information images After the pixel points are extracted, the size of the hidden information image is the size extracted in step 1.2) and step 1.3); finally generate the hidden information image A with the improved Arnold transform;

步骤3)对提取后的隐藏信息图像A进行Arnold反变换解密:Step 3) Carry out Arnold inverse transform decryption to the hidden information image A after extraction:

步骤3.1)用户输入2个密钥key1、key2和一个加密位置;Step 3.1) The user inputs two keys key1, key2 and an encryption location;

步骤3.2)如果是1号位置,则根据公式x1=(x″-key2*y″),y1=y″进行图像Arnold反变换解密,如果是2号位置则根据公式x1=x″,y1=(-key2*x″+y″)进行图像Arnold反变换解密;Step 3.2) If it is the No. 1 position, then according to the formula x1=(x″-key2*y″), y1=y″, carry out image Arnold inverse transformation decryption, if it is the No. 2 position, then according to the formula x1=x″, y1= (-key2*x″+y″) performs image Arnold inverse transformation decryption;

步骤3.3)然后x1,y1分别对隐藏信息图像的宽度A.width和高度A.height进行取余运算:x=x1 mod A.width;y=y1 mod A.height;如果x<0则x=x+A.width,如果y<0则y=y+A.height;Step 3.3) Then x1 and y1 respectively carry out remainder operation on the width A.width and height A.height of the hidden information image: x=x1 mod A.width; y=y1 mod A.height; if x<0 then x= x+A.width, if y<0 then y=y+A.height;

步骤3.4)按照密钥key1的数值重复执行步骤3.2)到步骤3.3)key1次,这样就恢复了隐藏信息图像的原始数据;Step 3.4) Repeat step 3.2) to step 3.3) key1 times according to the numerical value of the key key1, so that the original data of the hidden information image is recovered;

步骤4)将隐藏信息图像保存下来,恢复工作完成。Step 4) Save the hidden information image, and the restoration work is completed.

上面结合附图对本发明的实施方式作了详细说明,但是本发明并不限于上述实施方式,在本领域普通技术人员所具备的知识范围内,还可以在不脱离本发明宗旨的前提下做出各种变化。The embodiments of the present invention have been described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments, and can also be made without departing from the gist of the present invention within the scope of knowledge possessed by those of ordinary skill in the art. Variations.

图4是本发明的解密过程中的LSB算法核心思想:Fig. 4 is the core idea of the LSB algorithm in the decryption process of the present invention:

可以看出,本发明LSB算法解密思想是取出每个像素的每个字节的最末位2bit数据将他们用需要嵌入的数据用二进制的形式替换掉。It can be seen that the decryption idea of the LSB algorithm of the present invention is to take out the last 2-bit data of each byte of each pixel and replace them with the data to be embedded in binary form.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围内。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. All should be covered within the protection scope of the present invention.

Claims (6)

1. encrypt and decryption method based on the image information improving Arnold conversion and LSB for one kind, it is characterised in that include following Step:
Step 1, loading background image, and calculate this background image open ended maximum pixel number;If hiding frame Pixel count exceedes maximum pixel number, then user carries out cutting to hiding frame;
The Arnold conversion that step 2, employing improve carries out pretreatment to hiding frame;Specific as follows:
Step 2.1), user input numerical value key1, key2 of 2 keys, key1 and key2 is positive integer;
Step 2.2), user select any one in following cipher mode that hiding frame is encrypted:
The first cipher mode: the new coordinate of each hiding frame pixel is (x ', y '), wherein: x '=(x+key2* Y), y '=y;
The second cipher mode: the new coordinate of each hiding frame pixel is (x ', y '), wherein, x '=x, y '= (key2*x+y);Wherein, (x y) is the original pixels coordinate of hiding frame needing encryption;
Then x ', y ' carry out complementation respectively to the width A.width of hiding frame and height A.height: x "=x ' mod A.width;Y "=y ' mod A.height;
Step 2.3), by original coordinate be (x, pixel y) move new pixel (x ", y ") place;
Step 2.4), repeated execution of steps 2.2)-step 2.3) key1 time;
Step 3, the size of hiding frame is stored in the beginning of background image;
Step 4, LSB algorithm will be used to be embedded in background image through the pretreated hiding frame of step 2, thus raw Become the image after encryption;
Frame size is hidden in step 5, extraction;
Step 6, by LSB algorithm extract hide frame;
Step 7, user input key and the hiding frame after extracting are carried out Arnold inverse transformation deciphering, thus recovering Hide the initial data of frame.
A kind of image information encryption based on improvement Arnold conversion and LSB the most according to claim 1 and decryption method, It is characterized in that, described step 3 is specific as follows:
Step 3.1), traversal background image front 4 pixels, each pixel comprises 3 bytes;First by hiding frame Highly A.height every 2bit mono-assembling and dismantling divide, and the most directly replace in background image in front 6 bytes each byte End 2bit;
Step 3.2), width A.width every 2bit mono-assembling and dismantling of hidden image A are divided, the most directly replace background image In most end 2bit of each byte in rear 6 bytes.
A kind of image information encryption based on improvement Arnold conversion and LSB the most according to claim 2 and decryption method, It is characterized in that, described step 4 is specific as follows:
Step 4.1), skip the size memory block of the hiding frame of front 4 pixels of background image, to hiding frame Carry out LSB encryption;If primary iteration number of times i=1;
Step 4.2), take out the i-th byte hidden in frame successively, leave the highest 2bit of this byte in Background In the last 2bit of the 1st byte of (4+i) individual pixel of picture, directly replace (4+i) individual pixel the 1st of background image The last 2bit of byte;
Step 4.3), then take out the 6th of this byte, the data of the 5th be placed on background image (4+i) individual pixel In the last 2bit of 2 bytes;
Step 4.4), when i less than hide frame all byte quantity, then i=i+1, repeat step 4.2)-step 4.4);Until all bytes of hiding frame being all placed in background image, thus generate image after encryption.
A kind of image information encryption based on improvement Arnold conversion and LSB the most according to claim 3 and decryption method, It is characterized in that, described step 5 is specific as follows:
Step 5.1), load encryption after image to internal memory;
Step 5.2), extract front 4 pixel datas of image after encryption, wherein, according to encryption principle, front 2 pixels are figure The altitude information of picture, rear 2 pixels are the width data of image;In front 2 pixels, each pixel extracting directly in order its In most end 2bit of each byte, be then stitched together and form the numerical value of 12bit, this numerical value is exactly the height hiding frame Number of degrees value A.height;
Step 5.3), extract rear 2 pixel datas in front 4 pixels of image after encryption, in rear 2 pixels, each picture Most end 2bit of the element the most each byte of extracting directly in order, and direct splicing becomes the numerical value of 12bit in order, this numerical value It is exactly the width numerical value A.width hiding frame.
A kind of image information encryption based on improvement Arnold conversion and LSB the most according to claim 4 and decryption method, It is characterized in that, described step 6 is specific as follows:
Step 6.1), skip front 4 pixels of image after encryption;
Step 6.2) from the beginning of the 5th pixel of the image after encryption, most end 2bit of each byte of each pixel is extracted Splice the most in order, the hiding frame after ultimately generating with improvement Arnold conversion.
A kind of image information encryption based on improvement Arnold conversion and LSB the most according to claim 4 and decryption method, It is characterized in that, described step 7 is specific as follows:
Step 7.1) if the first cipher mode, then according to formula x1=(x "-key2*y "), y1=y " carries out image Arnold inverse transformation is deciphered;If the second cipher mode, then according to formula x1=x ", y1=(-key2*x "+y ") is carried out Image Arnold inverse transformation is deciphered;
Step 7.2), then x1, y1 carry out remainder fortune to the width A.width of hiding frame and height A.height respectively Calculate: x=x1mod A.width, y=y1mod A.height;If x < 0, x=x+A.width, if y < 0, y=y+ A.height;
Step 7.3), repeated execution of steps 7.1) to step 7.2) key1 time, thus recovered the original of hiding frame Data.
CN201610482879.7A 2016-06-27 2016-06-27 A kind of image information encryption and decryption method based on improvement Arnold conversion and LSB Expired - Fee Related CN106157231B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610482879.7A CN106157231B (en) 2016-06-27 2016-06-27 A kind of image information encryption and decryption method based on improvement Arnold conversion and LSB

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610482879.7A CN106157231B (en) 2016-06-27 2016-06-27 A kind of image information encryption and decryption method based on improvement Arnold conversion and LSB

Publications (2)

Publication Number Publication Date
CN106157231A true CN106157231A (en) 2016-11-23
CN106157231B CN106157231B (en) 2018-11-27

Family

ID=57350059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610482879.7A Expired - Fee Related CN106157231B (en) 2016-06-27 2016-06-27 A kind of image information encryption and decryption method based on improvement Arnold conversion and LSB

Country Status (1)

Country Link
CN (1) CN106157231B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107634965A (en) * 2017-10-15 2018-01-26 天津飞眼无人机科技有限公司 The hidden biography system for the information that unmanned plane obtains
CN108805786A (en) * 2017-05-05 2018-11-13 北京大学 Steganalysis method and device are matched based on least significant bit
CN110780834A (en) * 2019-10-31 2020-02-11 深圳云里物里科技股份有限公司 Method, system and device for locally updating picture of display equipment
CN113452688A (en) * 2021-06-24 2021-09-28 山东三未信安信息科技有限公司 Image encryption and decryption method and device based on SM4 and SM2 algorithms

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105118018A (en) * 2015-08-17 2015-12-02 安徽大学 An image hiding method based on a video carrier and under an off-line controllable mechanism
CN105303512A (en) * 2015-09-18 2016-02-03 安徽大学 Video dual watermark method based on SVD and QR codes

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105118018A (en) * 2015-08-17 2015-12-02 安徽大学 An image hiding method based on a video carrier and under an off-line controllable mechanism
CN105303512A (en) * 2015-09-18 2016-02-03 安徽大学 Video dual watermark method based on SVD and QR codes

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
GIRISH 等: "Encryption of an Image Using Least Significant Bit Substitution Method and Arnold Transformation", 《INTERNATIONAL JOURNAL OF COMBINED RESEARCH & DEVELOPMENT(IJCRD)》 *
朱宁: "Arnold加密算法改进", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
陈中 等: "基于Arnold变换的改进LSB水印嵌入方法研究", 《衡阳师范学院学报》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108805786A (en) * 2017-05-05 2018-11-13 北京大学 Steganalysis method and device are matched based on least significant bit
CN108805786B (en) * 2017-05-05 2022-05-10 北京大学 Steganalysis method and device based on least significant bit matching
CN107634965A (en) * 2017-10-15 2018-01-26 天津飞眼无人机科技有限公司 The hidden biography system for the information that unmanned plane obtains
CN107634965B (en) * 2017-10-15 2023-09-01 天津飞眼无人机科技有限公司 Hidden transmission system for information acquired by unmanned aerial vehicle
CN110780834A (en) * 2019-10-31 2020-02-11 深圳云里物里科技股份有限公司 Method, system and device for locally updating picture of display equipment
CN113452688A (en) * 2021-06-24 2021-09-28 山东三未信安信息科技有限公司 Image encryption and decryption method and device based on SM4 and SM2 algorithms
CN113452688B (en) * 2021-06-24 2022-07-08 山东三未信安信息科技有限公司 Image encryption and decryption method and device based on SM4 and SM2 algorithms

Also Published As

Publication number Publication date
CN106157231B (en) 2018-11-27

Similar Documents

Publication Publication Date Title
Chai et al. TPE-GAN: Thumbnail preserving encryption based on GAN with key
Wang et al. Cross-plane multi-image encryption using chaos and blurred pixels
CN104851070B (en) A kind of image encryption and decryption method based on foreground and background separation
CN107809644B (en) A Double Encryption Method for Reversible Data Hiding of Encrypted Domain Image
CN116582246B (en) Vector geospatial data exchange cipher watermarking method based on chaos and zero watermarking
CN106157231B (en) A kind of image information encryption and decryption method based on improvement Arnold conversion and LSB
CN103646264A (en) Multiple information encrypted two-dimensional code anti-counterfeiting method
CN110008745A (en) Encryption method, computer equipment and computer storage medium
CN103778590A (en) Method and device for utilizing digital image to store and transmit information
CN107239709A (en) A kind of method of New chaotic image encryption, apparatus and system
CN107833174B (en) Image encryption method based on Logistic chaotic system algorithm
CN108055121A (en) The encryption method and decryption method of image
CN106651735A (en) Chaos theory-based digital image parallel encryption method
CN111970507A (en) Reversible data hiding method of ciphertext domain image based on pixel difference coding
CN104050617B (en) Image encryption method based on Liu chaos systems
CN104881837B (en) The image encryption method of key choice of dynamical based on hyperchaotic system
CN105872305B (en) A kind of completely separable encryption area image reversible data concealing method
Aminuddin et al. AuSR3: A new block mapping technique for image authentication and self-recovery to avoid the tamper coincidence problem
CN114553589B (en) Cloud file secure transmission method based on multi-stage encryption
Wang et al. Study on image encryption algorithm based on arnold transformation and chaotic system
Abu-Alhaija Crypto-Steganographic LSB-based System for AES-Encrypted Data
CN111147685B (en) Random sequence-based multiple image encryption method, system and intelligent terminal
CN112508764B (en) Encryption method for balancing image privacy and usability based on information embedding
CN112184841B (en) Block replacement generation type information hiding and recovering method, equipment and medium
CN111177742B (en) Multi-image encryption method and decryption method based on light field principle and chaotic system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20181127