CN115412229A - 一种随机序列和位异或运算的图像加密编解码方法 - Google Patents
一种随机序列和位异或运算的图像加密编解码方法 Download PDFInfo
- Publication number
- CN115412229A CN115412229A CN202211036378.8A CN202211036378A CN115412229A CN 115412229 A CN115412229 A CN 115412229A CN 202211036378 A CN202211036378 A CN 202211036378A CN 115412229 A CN115412229 A CN 115412229A
- Authority
- CN
- China
- Prior art keywords
- image
- matrix
- bit
- xor
- ciphertext
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 24
- 239000011159 matrix material Substances 0.000 claims abstract description 55
- 230000009466 transformation Effects 0.000 description 2
- NAWXUBYGYWOOIX-SFHVURJKSA-N (2s)-2-[[4-[2-(2,4-diaminoquinazolin-6-yl)ethyl]benzoyl]amino]-4-methylidenepentanedioic acid Chemical compound C1=CC2=NC(N)=NC(N)=C2C=C1CCC1=CC=C(C(=O)N[C@@H](CC(=C)C(O)=O)C(O)=O)C=C1 NAWXUBYGYWOOIX-SFHVURJKSA-N 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000000354 decomposition reaction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
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/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/0618—Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
- H04L63/0435—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply symmetric encryption, i.e. same key used for encryption and decryption
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/18—Network architectures or network communication protocols for network security using different networks or channels, e.g. using out of band channels
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Facsimile Transmission Control (AREA)
Abstract
本发明涉及一种图像加密编解码方法。针对互联网时代图像加密保护的需求,本发明提出了一种随机序列和位异或运算的图像加密编解码方法,将待加密的图像分解为单独比特位矩阵,再对图像比特矩阵位矩阵进行乱序排列,然后生成一个二进制密钥矩阵,根据乱序后的序列逐次对图像矩阵进行异或运算,从而得到加密的比特矩阵。将该密文通过公共信道,并将密钥通过保密信道进行传输,最终接收者根据密钥通过逆向操作对密文进行解密,得到明文。该方法处理速度快,能够将各种内容的数字图像都加密成随机噪声图像,加密效果好,可实现比特级别的图像加密。
Description
技术领域
本发明涉及一种图像加密编解码方法,尤其是一种随机序列和位异或运算的图像加密编解码方法。
背景技术
随着网络和多媒体技术的快速发展,以电子版方式传播的知识产品也越来越多,互联网上的数字图像信息正在呈爆炸式增长,各种各样以图片呈现的信息随处可见。然而,在很多应用场景中,数字图像的内容需要被保密传输,以防未获授权的第三方获取其内容。因此就诞生了数字图像的解密与解密技术。加密过程是对数字图像的内容进行某种形式的变换,同时将图像的内容变为与其不相关的随机信息,从而防止没有密钥的人员获取图像信息。为了实现这一目标,目前已经提出了多种方案,包括对图像进行频域变换,对其相位信息进行随机化、图像像素的空间位置乱置、图像矩阵分解再分别进行加密等方法。这些方法各有优势,有的加密速度快,有些抗干扰能力强,还有些占用的计算资源少,但没有一种方法能够适应各种场景的需求,因此针对特定场景的加密方法。
一种图像加密编码方法,应当尽可能适应多个图像加密应用场景,能以较低的计算资源占用率,实现快速加密,研究者将密钥长度尽可能缩短,减少保密信道资源的占用,当前已经提出了多种技术方案。此类技术的基本目标是,将一幅有意义的数字图像通过某种编码方法,变换为一幅无意义的噪声图像,且该噪声图像的内容与原图像之间没有关联。为了实现图像的加密编码,通过积分变换对空域以及频域的相位进行随机化、像素位置乱置、图像矩阵分解等技术,已经提出了多种加密方案。然而基于变换的加密方法往往易于受到攻击,且密钥长度较长,传输时对加密信道的资源占用较多。
为了压缩密钥长度,同时又能提高编码的速度,本发明针对数字图像通过矩阵乱序和位异或运算实现了一种比特级的加密编码和解码方法。
发明内容
针对现有技术的不足,本发明提出了一种随机序列和位异或运算的图像加密编解码方法。下面结合附图对本发明做进一步详细说明。为实现上述目的,本发明的方案包括:如图1所示,加密编解码包括如下步骤:
S1. 对于数字图像I(x,y),其中x和y表示像素坐标,图像的比特位数为B,图像的像素尺寸为M*N,x取1到M,y取1到N,其中M表示图像的列数,N表示图像的行数。
S2. 根据数字图像I的比特位数B,将图像分解为单比特矩阵H(x,y,b),其中比特位数b大于等于1且小于等于B。
S3. 生成包含M个元素且从1到M的不重复随机整数序列P={x(1),x(2),…,x(M)},用于将比特矩阵进行乱序。
S4. 生成尺寸为N*B的密钥矩阵T(y,b)。
S5. 从P中取出第一个元素x(1),代入单比特矩阵,并根据式(1)计算其与密钥矩阵T(y,b)的异或,
R(x(1),y,b) = XOR[H(x(1),y,b),T(y,b)];(1)
其中,XOR[.]表示按找矩阵对应元素进行异或运算,R(x(1),y,b)表示经过加密的位矩阵。
S6. 从P中取出第二个元素x(2),代入单比特矩阵,并根据式(2)计算其与密文矩阵R(x(1),y,b)的异或,
R(x(2),y,b) = XOR[R(x(1),y,b), H(x(2),y,b)]。(2)
S7. 以此类推,依次遍历P中的所有元素,计算出R(x(3),y,b)到R(x(M),y,b),并按P内元素表示的序号将其合并位密文单比特位矩阵R(x,y,b)。
S8. 根据公式(3)计算出密文图像Ie(x,y),
S9. 将密钥矩阵T(y,b)和不重复随机整数序列P通过保密信道传给接收方,并将密文图像Ie(x,y)通过公共信道传输给接收方。
S10. 接收方将密文图像Ie(x,y)分解为单比特矩阵He(x,y,b)。
S11. 从P中取出第一个元素x(1),结合密钥矩阵T(x,y),根据式(4)进行位异或运算,
Re(x(1),y,b) = XOR[He(x(1),y,b),T(y,b)]。(4)
S12. 从P中取出第二个元素x(2),结合密钥矩阵T(x,y),根据式(5)进行位异或运算,
Re(x(2),y,b) = XOR[He(x(2),y,b), He(x(1),y,b)]。(5)
S13. 以此类推,依次遍历P中的所有元素,计算出Re(x(3),y,b)到Re(x(M),y,b),并结合P内元素表示的序号,得到解密的单比特位矩阵Re(x,y,b)。
S14. 根据公式(6)计算出明文图像Id(x,y),
本发明与现有技术相比,有益效果在于:本发明提出的方法密文长度较短,减少对保密信道资源的占用。同时,本方法加密过程消耗的计算资源少,加密速度快,能够抵抗已知的通用攻击技术。
附图说明
下面结合附图对本发明进一步说明。
图1为本发明所述图像加密编码与解码的流程图。
图2为本发明实施例中所用的测试灰度图像I(x,y)。
图3为本发明实施例中所述的密钥矩阵T(x,y)。
图4为本发明实施例中所述的密文图像Ie(x,y)。
图5为本发明实施例中所述的解码数字图像Id(x,y)。
具体实施方式
为使本发明的上述目的、特征和优点能够更加易于理解,下面结合附图和具体实施方式对本发明作进一步详细说明。
实施例:
如图1所示,编解码包括如下步骤:
S1. 选择一幅灰度数字图像I(x,y),图像的比特位数为8,图像的像素尺寸为480*500,其中M=480,N=500,如图2所示。
S2. 根据图像I的比特位数8,将图像分解为单比特矩阵H(x,y,b),其中比特位数b大于等于1且小于等于8。
S3. 生成包含480个元素且从1到480的不重复随机整数序列P={x(1),x(2),…,x(480)},用于将比特矩阵进行乱序。
S4. 生成尺寸为500*8的密钥矩阵T(y,b),如图3所示。
S5. 从P中取出第一个元素x(1),代入单比特矩阵,并根据式(7)计算其与密钥矩阵T(y,b)的异或,
R(x(1),y,b) = XOR[H(x(1),y,b),T(y,b)];(7)
其中,XOR[.]表示按找矩阵对应元素进行异或运算,R(x(1),y,b)表示经过加密的位矩阵。
S6. 从P中取出第二个元素x(2),代入单比特矩阵,并根据式(8)计算其与密文矩阵R(x(1),y,b)的异或,
R(x(2),y,b) = XOR[R(x(1),y,b), H(x(2),y,b)]。(8)
S7. 以此类推,依次遍历P中的所有元素,计算出R(x(3),y,b)到R(x(480),y,b),并按P内元素表示的序号将其合并位密文单比特位矩阵R(x,y,b)。
S8. 根据公式(9)计算出密文图像Ie(x,y),如图4所示,
S9. 将密钥矩阵T(y,b)和不重复随机整数序列P通过保密信道传给接收方,并将密文图像Ie(x,y)通过公共信道传输给接收方。
S10. 接收方将密文图像Ie(x,y)分解为单比特矩阵He(x,y,b)。
S11. 从P中取出第一个元素x(1),结合密钥矩阵T(x,y),根据式(10)进行位异或运算,
Re(x(1),y,b) = XOR[He(x(1),y,b),T(y,b)]。(10)
S12. 从P中取出第二个元素x(2),结合密钥矩阵T(x,y),根据式(11)进行位异或运算,
Re(x(2),y,b) = XOR[He(x(2),y,b), He(x(1),y,b)]。(11)
S13. 以此类推,依次遍历P中的所有元素,计算出Re(x(3),y,b)到Re(x(M),y,b),并结合P内元素表示的序号,得到解密的单比特位矩阵Re(x,y,b)。
S14. 根据公式(12)计算出明文图像Id(x,y),如图5所示,
Claims (1)
1.一种随机序列和位异或运算的图像加密编解码方法,其特征在于:包括如下步骤:
S1 对于数字图像I(x,y),其中x和y表示像素坐标,图像的比特位数为B,图像的像素尺寸为M*N,x取1到M,y取1到N,其中M表示图像的列数,N表示图像的行数;
S2 根据数字图像I的比特位数B,将图像分解为单比特矩阵H(x,y,b),其中比特位数b大于等于1且小于等于B;
S3 生成包含M个元素且从1到M的不重复随机整数序列P={x(1),x(2),…,x(M)},用于将比特矩阵进行乱序;
S4 生成尺寸为N*B的密钥矩阵T(y,b);
S5 从P中取出第一个元素x(1),代入单比特矩阵,并根据式(1)计算其与密钥矩阵T(y,b)的异或,
R(x(1),y,b) = XOR[H(x(1),y,b),T(y,b)];(1)
其中,XOR[.]表示按找矩阵对应元素进行异或运算,R(x(1),y,b)表示经过加密的位矩阵;
S6 从P中取出第二个元素x(2),代入单比特矩阵,并根据式(2)计算其与密文矩阵R(x(1),y,b)的异或,
R(x(2),y,b) = XOR[R(x(1),y,b), H(x(2),y,b)];(2)
S7 以此类推,依次遍历P中的所有元素,计算出R(x(3),y,b)到R(x(M),y,b),并按P内元素表示的序号将其合并位密文单比特位矩阵R(x,y,b);
S8 根据公式(3)计算出密文图像Ie(x,y),
S9 将密钥矩阵T(y,b)和不重复随机整数序列P通过保密信道传给接收方,并将密文图像Ie(x,y)通过公共信道传输给接收方;
S10 接收方将密文图像Ie(x,y)分解为单比特矩阵He(x,y,b);
S11 从P中取出第一个元素x(1),结合密钥矩阵T(x,y),根据式(4)进行位异或运算,
Re(x(1),y,b) = XOR[He(x(1),y,b),T(y,b)];(4)
S12 从P中取出第二个元素x(2),结合密钥矩阵T(x,y),根据式(5)进行位异或运算,
Re(x(2),y,b) = XOR[He(x(2),y,b), He(x(1),y,b)];(5)
S13 以此类推,依次遍历P中的所有元素,计算出Re(x(3),y,b)到Re(x(M),y,b),并结合P内元素表示的序号,得到解密的单比特位矩阵Re(x,y,b);
S14 根据公式(6)计算出明文图像Id(x,y),
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211036378.8A CN115412229A (zh) | 2022-08-28 | 2022-08-28 | 一种随机序列和位异或运算的图像加密编解码方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211036378.8A CN115412229A (zh) | 2022-08-28 | 2022-08-28 | 一种随机序列和位异或运算的图像加密编解码方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115412229A true CN115412229A (zh) | 2022-11-29 |
Family
ID=84161289
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211036378.8A Pending CN115412229A (zh) | 2022-08-28 | 2022-08-28 | 一种随机序列和位异或运算的图像加密编解码方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115412229A (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116936041A (zh) * | 2023-09-18 | 2023-10-24 | 天河超级计算淮海分中心 | 一种医学影像文件处理方法、电子设备及存储介质 |
CN117394984A (zh) * | 2023-11-28 | 2024-01-12 | 安雾信息技术(重庆)有限公司 | 一种敏感信息安全保护方法、装置、设备及存储介质 |
-
2022
- 2022-08-28 CN CN202211036378.8A patent/CN115412229A/zh active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116936041A (zh) * | 2023-09-18 | 2023-10-24 | 天河超级计算淮海分中心 | 一种医学影像文件处理方法、电子设备及存储介质 |
CN116936041B (zh) * | 2023-09-18 | 2023-12-22 | 天河超级计算淮海分中心 | 一种医学影像文件处理方法、电子设备及存储介质 |
CN117394984A (zh) * | 2023-11-28 | 2024-01-12 | 安雾信息技术(重庆)有限公司 | 一种敏感信息安全保护方法、装置、设备及存储介质 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Sheela et al. | Image encryption based on modified Henon map using hybrid chaotic shift transform | |
Xiong et al. | Robust reversible watermarking in encrypted image with secure multi-party based on lightweight cryptography | |
Ben Slimane et al. | A novel chaotic image cryptosystem based on DNA sequence operations and single neuron model | |
Chen et al. | Compression-unimpaired batch-image encryption combining vector quantization and index compression | |
CN115412229A (zh) | 一种随机序列和位异或运算的图像加密编解码方法 | |
Su et al. | Multimedia security: a survey of chaos-based encryption technology | |
Zhang et al. | Chaos-based partial encryption of SPIHT coded color images | |
Ahmed et al. | A perceptually scalable and jpeg compression tolerant image encryption scheme | |
CN1518269A (zh) | 数据加密设备和方法 | |
CN109547663B (zh) | 一种结合密码学的改进lsb图像隐写方法 | |
Sharma et al. | A new image encryption using modified aes algorithm and its comparision with aes | |
Ye et al. | Research on reversible image steganography of encrypted image based on image interpolation and difference histogram shift | |
Arumugam et al. | An efficient machine learning based image encryption scheme for medical image security | |
Banupriya et al. | Video steganography using LSB algorithm for security application | |
Gebereselassie et al. | Speech encryption algorithm based on two newly designed chaotic maps | |
Chandra et al. | A Logical Data Security Establishment over Wireless Communications using Media based Steganographic Scheme | |
Sarmah et al. | Cryptography and digital image steganography techniques | |
CN115208549A (zh) | 一种基于Paillier同态加密的JPEG图像可逆信息隐藏方法及系统 | |
Yassin et al. | A novel image encryption scheme based on DCT transform and DNA sequence | |
Kumari et al. | A novel Cosine-Cosine chaotic map-based video encryption scheme | |
Hussein et al. | Protection of images by combination of vernam stream cipher, AES, and LSB steganography in a video clip | |
Radke et al. | Review of Image Security Approaches: Concepts, issues, challenges and applications | |
Janakiraman et al. | Pixel bit manipulation for encoded hiding—An inherent stego | |
Abdelmged et al. | A Combined approach of steganography and cryptography technique based on parity checker and huffman encoding | |
Singh et al. | Image Encryption Technique Using Huffman Coding and Spatial Transformation |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20221129 |
|
WD01 | Invention patent application deemed withdrawn after publication |