WO2020119645A1 - 一种图像加密方法、装置及图像解密方法、装置 - Google Patents

一种图像加密方法、装置及图像解密方法、装置 Download PDF

Info

Publication number
WO2020119645A1
WO2020119645A1 PCT/CN2019/124069 CN2019124069W WO2020119645A1 WO 2020119645 A1 WO2020119645 A1 WO 2020119645A1 CN 2019124069 W CN2019124069 W CN 2019124069W WO 2020119645 A1 WO2020119645 A1 WO 2020119645A1
Authority
WO
WIPO (PCT)
Prior art keywords
random sequence
sequence
random
image data
image
Prior art date
Application number
PCT/CN2019/124069
Other languages
English (en)
French (fr)
Inventor
杨建权
常杰
王员根
钱静
朱国普
Original Assignee
中国科学院深圳先进技术研究院
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 中国科学院深圳先进技术研究院 filed Critical 中国科学院深圳先进技术研究院
Publication of WO2020119645A1 publication Critical patent/WO2020119645A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data

Definitions

  • the present application relates to the field of image encryption technology, in particular to an image encryption method and device, and an image decryption method and device.
  • users and the cloud have different needs. Users want to protect their data privacy, and the cloud wants to be able to perform certain processing on user data, such as data compression and retrieval, to save storage space and shorten response time more effectively. Users can encrypt data to protect data privacy, and the cloud needs to process the encrypted data without decryption, which promotes the development of signal processing in the encrypted domain and is widely valued.
  • GraigCentry proposed a homomorphic encryption scheme in the paper "A fully homomorphic encryption” scheme for encrypting generalized data, which can perform a variety of operations on plain data without decryption. , So that the encrypted information can still be processed and analyzed without affecting its confidentiality.
  • Homomorphic encryption technology allows companies to store sensitive information in remote servers, not only to avoid leakage from the local host, but still Ensure the use and search of information.
  • this data encryption scheme will cause a sharp expansion of the amount of encrypted data, causing cloud servers to consume a large amount of additional storage space, but contrary to the cloud's desire to reduce the storage burden.
  • the data encryption scheme uses a constant base in the calculation.
  • a decimal integer (such as an 8-bit unsigned integer from 0 to 255) is usually used to represent the brightness value, and the digits, tens, hundreds, and thousands of digits are every ten.
  • the present invention proposes not to use a constant hexadecimal number, but to let the hexadecimal number of each digit be controlled by an encryption key, which makes it impossible for a third party without a key to correctly parse the encrypted value, thereby achieving the purpose of encryption.
  • the embodiments of the present invention provide a random base image encryption method and device to enhance image detail processing while protecting user privacy.
  • the technical solution is as follows:
  • An image encryption method including:
  • a first random sequence and a second random sequence are generated;
  • the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element;
  • a random base conversion is performed to encrypt the input first image data.
  • the performing random base conversion according to the third random sequence to encrypt the input first image data includes:
  • the first image data and the ith element of the third random sequence are taken as the ith bit element of the encrypted image data after the first image data is encrypted; the input image data is non-zero Image data
  • An image decryption method including:
  • a first random sequence and a second random sequence are generated;
  • the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element;
  • a random base conversion is performed to decrypt the encrypted image data.
  • the performing random base conversion according to the third random sequence to decrypt the encrypted image data includes:
  • x is the first image data
  • [y 1 , y 2 , y 3 , ...] represent the i-th element of the encrypted image data from the lowest bit to the highest bit
  • It is the third random sequence.
  • the first and second sequence generation modules generate a first random sequence and a second random sequence based on the encryption key; the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element;
  • a third sequence generation module generating a third random sequence according to the first random sequence and the second random sequence
  • the image encryption module performs random base conversion according to the third random sequence to encrypt the input first image data.
  • the first and second sequence generation modules generate a first random sequence and a second random sequence based on the encryption key; the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element;
  • a third sequence generation module generating a third random sequence according to the first random sequence and the second random sequence
  • the image decryption module performs random base conversion according to the third random sequence to decrypt the encrypted image data.
  • the image decryption module includes:
  • the splitting module splits the encrypted image data to obtain the i-th element from the lowest bit to the highest bit of the encrypted image data
  • the decryption and restoration module performs decryption and restoration of the first image data according to the following formula.
  • x is the first image data
  • [y 1 , y 2 , y 3 , ...] represent the i-th element of the encrypted image data from the lowest bit to the highest bit
  • It is the third random sequence.
  • the present invention generates a first random sequence and a second random sequence based on an encryption key; the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element; According to the first random sequence and the second random sequence, a third random sequence is generated; according to the third random sequence, a random base conversion is performed, and the input first image data is encrypted, so that the constant is used by the random base Representation of the hexadecimal number avoids the extreme expansion of the image data volume after encryption, reduces the storage requirements of the cloud server and the calculation load when processing the encryption domain; on the other hand, the present invention is based on indicating the first random sequence The second random sequence and the first random sequence of the reciprocal sequence elements are taken to generate the third random sequence, which makes the encryption result more random and enhances the encryption effect.
  • Embodiment 1 is a flowchart of image encryption according to Embodiment 1 of the present invention.
  • Fig. 3 is an image encryption and decryption effect diagram of Embodiment 3 of the present invention
  • Fig. 3(a) is an original image
  • an image encryption method is different from text data.
  • Image data has special characteristics: a single pixel value usually does not have a clear semantics, and it can only be constructed by observing it with its neighboring pixels. Certain semantic patterns. Therefore, there is no need to perform high-intensity homomorphic encryption on each pixel. It is only necessary to introduce randomness between adjacent pixels to disturb the original pattern and make it unrecognizable, so as to achieve the purpose of encryption.
  • a first random sequence and a second random sequence are generated;
  • the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element;
  • a random base conversion is performed to encrypt the input first image data.
  • the performing random base conversion according to the third random sequence to encrypt the input first image data includes:
  • the first image data and the ith element of the third random sequence are taken as the ith bit element of the encrypted image data after the first image data is encrypted; the input image data is non-zero Image data
  • FIG. 1 an image encryption flowchart of Embodiment 1 of the present invention
  • the task of image encryption in this implementation is to output the encrypted value y according to the input pixel brightness value x and the encryption key K.
  • the generation of random numbers is a fairly mature technology.
  • different software development kits will provide corresponding functions (such as rand for generating random floating-point numbers and randi for generating random positive integers), due to their internal implementation methods. different.
  • the random positive integer is generated by setting the random number range between 2 and N, and using K as the initialization parameter of the randi function.
  • Each call to randi can generate a random number. Therefore, you only need to call randi in a loop to generate an arbitrary number of random numbers, thus forming a random number sequence.
  • Step 2 Under the control of the encryption key K, a binary sequence [s 1 , s 2 , s 3 , ...] with a value of 0 or 1 is generated, and the probability of controlling the element with 1 in the sequence is P, 0 ⁇ P ⁇ 0.5, P is set by the user.
  • the binary sequence [s 1 , s 2 , s 3 , ...] is used to indicate which bits in the positive integer sequence [n 1 , n 2 , n 3 , ...] need to take the reciprocal to improve the randomness of encryption.
  • the randi function of Matlab 2016a is called, K is used as the initialization parameter of the randi function, and the random number value range is set to 0 or 1, and a random number can be generated. Random calls to randi can generate any number of random numbers to form a random number sequence of 0 or 1.
  • Step 3 Iterate over each element in the binary sequence [s 1 , s 2 , s 3 , ...], if the element takes 1, then the corresponding subscript element in [n 1 , n 2 , n 3 , ...] Take the reciprocal; if the element takes 0, then the corresponding subscript elements in [n 1 , n 2 , n 3 , ...] are not modified, and finally a new random number sequence is obtained
  • Step 4 For the input brightness value x to be encrypted, perform the "random number conversion" algorithm described below to obtain the digits of the encrypted brightness value y:
  • the present invention implements an image encryption method, including:
  • a first random sequence and a second random sequence are generated;
  • the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element;
  • a random base conversion is performed to decrypt the encrypted image data.
  • the performing random base conversion according to the third random sequence to decrypt the encrypted image data includes:
  • x is the first image data
  • [y 1 , y 2 , y 3 , ...] represent the i-th element of the encrypted image data from the lowest bit to the highest bit
  • It is the third random sequence.
  • the task of image decryption in this implementation is to decrypt the original value x by decrypting the encrypted value y and the encryption key K according to the input pixel brightness value.
  • the first three steps are similar to the first three steps of the encryption module of the first embodiment, and are used to generate a random base.
  • the value of N here must be the same as N in the encryption module, otherwise it cannot be decrypted.
  • the generation of random numbers is a fairly mature technology.
  • different software development kits will provide corresponding functions (such as rand for generating random floating-point numbers and randi for generating random positive integers), due to their internal implementation methods. different.
  • the random positive integer is generated by setting the random number range between 2 and N, and using K as the initialization parameter of the randi function.
  • Each call to randi can generate a random number. Therefore, you only need to call randi in a loop to generate an arbitrary number of random numbers, thus forming a random number sequence.
  • Step 2 Under the control of the encryption key K, a binary sequence [s 1 , s 2 , s 3 , ...] with a value of 0 or 1 is generated, and the probability of controlling the element with 1 in the sequence is P, 0 ⁇ P ⁇ 0.5, where P must be the same as the value of P in the encryption module.
  • the randi function of Matlab 2016a is called, K is used as the initialization parameter of the randi function, and the random number value range is set to 0 or 1, and a random number can be generated. Random calls to randi can generate any number of random numbers to form a random number sequence of 0 or 1.
  • Step 3 Iterate over each element in the binary sequence [s 1 , s 2 , s 3 , ...], if the element takes 1, then the corresponding subscript element in [n 1 , n 2 , n 3 , ...] Take the reciprocal; if the element takes 0, then the corresponding subscript elements in [n 1 , n 2 , n 3 , ...] are not modified, and finally a new random number sequence is obtained
  • Step 4 Split the encrypted brightness value y from the lowest bit to the highest bit into a sequence [y 1 , y 2 , y 3 , ...], and obtain the original brightness value x according to the following decryption formula:
  • the present invention implements an image encryption device, including:
  • the first and second sequence generation modules generate a first random sequence and a second random sequence based on the encryption key; the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element;
  • a third sequence generation module generating a third random sequence according to the first random sequence and the second random sequence
  • the image encryption module performs random base conversion according to the third random sequence to encrypt the input first image data.
  • the present invention implements an image decryption device, including:
  • the first and second sequence generation modules generate a first random sequence and a second random sequence based on the encryption key; the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element;
  • a third sequence generation module generating a third random sequence according to the first random sequence and the second random sequence
  • the image decryption module performs random base conversion according to the third random sequence to decrypt the encrypted image data.
  • the image decryption module further includes:
  • the splitting module splits the encrypted image data to obtain the i-th element from the lowest bit to the highest bit of the encrypted image data
  • the decryption and restoration module performs decryption and restoration of the first image data according to the following formula.
  • x is the first image data
  • [y 1 , y 2 , y 3 , ...] represent the i-th element of the encrypted image data from the lowest bit to the highest bit
  • It is the third random sequence.
  • the lena.bmp image is used for encryption and decryption experiments.
  • Figure 3(a) is the original image
  • the present invention generates a first random sequence and a second random sequence based on an encryption key; the second random sequence is a binary sequence and is used to instruct the first random sequence to take the reciprocal sequence element; According to the first random sequence and the second random sequence, a third random sequence is generated; according to the third random sequence, a random base conversion is performed, and the input first image data is encrypted, so that the constant is used by the random base Representation of the hexadecimal number avoids the extreme expansion of the image data volume after encryption, reduces the storage requirements of the cloud server and the calculation load when processing the encryption domain; on average, the existing technology is used: GraigCentry in the paper "A Fully homomorphic encryption scheme proposed in "Homomorphic Encryption Scheme" encryption, if the encryption strength of 256bit is used, the original 8bit value will be expanded to 256bit, which is 32 times the original; while using the present invention, usually only need 64bit is only 1/4 of the existing technology.
  • the present invention generates the third random sequence based on the second random sequence indicating the reciprocal sequence element in the first random sequence and the first random sequence, which makes the encryption result more random and enhances the encryption effect.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Facsimile Transmission Control (AREA)

Abstract

一种图像加密与校正方法、装置及图像解密方法、装置,属于图像加密技术领域。基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;根据所述第一随机序列、第二随机序列,生成第三随机序列;根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密,从而利用随机进制对常数进制数进行重新表示,避免了图像在加密后数据量的极度膨胀,降低了云端服务器的存储需求和加密域处理时的计算负荷;基于用于指示第一随机序列中取倒数的序列元素的第二随机序列以及第一随机序列来生成第三随机序列,使得加密结果更为随机,增强了加密效果。

Description

一种图像加密方法、装置及图像解密方法、装置 技术领域
本申请涉及一种图像加密技术领域,特别是涉及一种图像加密方法、装置及图像解密方法、装置。
背景技术
在云储存环境中,用户和云端具有不同的需求。用户希望自己的数据隐私得到保护,而云端则希望能够对用户数据进行一定处理,比如数据压缩和检索,以更有效地节省存储空间和缩短响应时间。用户为保护数据隐私可对数据进行加密,而云端则需要在不进行解密的前提下对加密数据进行处理,这促进了加密域信号处理的发展并受到广泛重视。
Graig Centry在论文“A fully homomorphic encryption scheme”中提出了一种同态加密方案,用于加密一般化的数据,其可以在不解密的条件下对加密数据进行多种可以在明文上进行的运算,使得对加密信息仍能进行一定的处理和分析,而不会影响其保密性,同态加密技术允许公司将敏感的信息储存在远程服务器里,既避免从当地的主机端发生泄密,又依然保证了信息的使用和搜索。但是,该数据加密方案会造成加密数据量急剧膨胀,导致云端服务器额外消耗大量的存储空间,反而与云端期望减轻存储负担的需求相悖。该数据加密方案在计算中采用常数进制。对于图像亮度数据表示时,通常用一个十进制整数(如0~255的8位无符号整数)来表示亮度值,其个、十、百、千位皆逢十进一。本发明提出不采用常数进制,而是让各位数字的进制由加密秘钥控制,这就使得无秘钥的第三方无法对加密值进行正确解析,从而达到加密的目的。
发明内容
为解决上述技术问题,本发明实施例提供了一种随机进制的图像加密方法、装置,保护用户私密性的情况下进行图像细节增强处理,技术方案如下:
一种图像加密方法,包括:
基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
根据所述第一随机序列、第二随机序列,生成第三随机序列;
根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密。
优选地,所述根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密,包括:
(1)所述第一图像数据与所述第三随机序列第i个元素取余,作为所述第一图像数据加密后的加密图像数据的第i位元素;所述输入图像数据为非0的图像数据;
(2)所述输入数据与所述第三随机序列第i个元素取整,获取第二图像数据;
(3)i=i+1,将所述第一图像数据更新为所述第二图像数据的数值,重复执行以上步骤,直至所述输入数据为0。
一种图像解密方法,包括:
基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
根据所述第一随机序列、第二随机序列,生成第三随机序列;
根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密。
优选地,所述根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密,包括:
(1)对于加密图像数据进行拆分,获取加密图像数据的自最低位到最高位第i位元素;
(2)根据如下公式,执行解密还原第一图像数据。
Figure PCTCN2019124069-appb-000001
其中,x为第一图像数据;[y 1,y 2,y 3,…]分别表示加密图像数据的自最低位到最高位的第i位元素;
Figure PCTCN2019124069-appb-000002
为第三随机序列。
一种图像加密装置,其特征在于:
第一、第二序列生成模块,基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
第三序列生成模块,根据所述第一随机序列、第二随机序列,生成第三随机 序列;
图像加密模块,根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密。
一种图像解密装置,其特征在于:
第一、第二序列生成模块,基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
第三序列生成模块,根据所述第一随机序列、第二随机序列,生成第三随机序列;
图像解密模块,根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密。
优选地,所述图像解密模块,包括:
拆分模块,对于加密图像数据进行拆分,获取加密图像数据的自最低位到最高位第i位元素;
解密还原模块,根据如下公式,执行解密还原第一图像数据。
Figure PCTCN2019124069-appb-000003
其中,x为第一图像数据;[y 1,y 2,y 3,…]分别表示加密图像数据的自最低位到最高位的第i位元素;
Figure PCTCN2019124069-appb-000004
为第三随机序列。
与现有技术相比,本发明基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;根据所述第一随机序列、第二随机序列,生成第三随机序列;根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密,从而利用随机进制对常数进制数进行重新表示,避免了图像在加密后数据量的极度膨胀,降低了云端服务器的存储需求和加密域处理时的计算负荷;另一方面,本发明基于用于指示第一随机序列中取倒数的序列元素的第二随机序列以及第一随机序列来进行生成第三随机序列,使得加密结果更为随机,增强了加密效果。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的 附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例一的图像加密流程图;
图2为本发明实施例二的图像解密流程图;
图3为本发明实施例三的图像加密、解密效果图;图3(a)为原始图像;图3(b)为在加密秘钥K=123实施的图像加密效果图;图3(c)为基于秘钥K=123实施的图像解密后的效果图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
实施例一
如图1所示,本发明实施例一种图像加密方法,不同于文字数据,图像数据具有特殊性:单独一个像素值通常不具有明确的语义,只有将它与其邻域像素一同观察,才构成一定的语义模式。因此,没有必要对每个像素进行高强度的同态加密,只需在相邻像素间引入随机性,即可扰乱原有的模式,使之无法辨认,从而达到加密的目的。
本发明实施例一种图像加密方法,包括:
基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
根据所述第一随机序列、第二随机序列,生成第三随机序列;
根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密。
所述根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密,包括:
(1)所述第一图像数据与所述第三随机序列第i个元素取余,作为所述第一图像数据加密后的加密图像数据的第i位元素;所述输入图像数据为非0的图像数据;
(2)所述输入数据与所述第三随机序列第i个元素取整,获取第二图像数据;
(3)i=i+1,将所述第一图像数据更新为所述第二图像数据的数值,重复执行以上步骤,直至所述输入数据为0。
相应的,如图1所示,本发明实施例一的图像加密流程图;
本实施执行图像加密的任务是根据输入的像素亮度值x和加密秘钥K,输出其加密值y。
Step 1:在加密秘钥K的控制下,产生一个取值范围在2和N之间的随机正整数序列[n 1,n 2,n 3,…],即2≤n i≤N,i=1,2,3,…。N可由用户设置。
具体地,随机数的产生是相当成熟的技术,目前不同的软件开发包会提供相应的函数(如rand用于产生随机浮点数,randi用于产生随机正整数),由于其内部实现方式各有不同。本实施例,通过调用Matlab 2016a提供的randi函数接口,通过设置随机数范围在2和N之间,并用K作为randi函数的初始化参数来产生此处的随机正整数。每次调用randi就能产生一个随机数。因此,只需要循环调用randi,即可生成任意个数的随机数,从而构成随机数序列。
Step 2:在加密秘钥K的控制下,产生一个取值为0或1的二值序列[s 1,s 2,s 3,…],控制该序列中取1的元素的概率为P,0≤P≤0.5,P由用户设置。二值序列[s 1,s 2,s 3,…]用于指示正整数序列[n 1,n 2,n 3,…]中的哪些位需要取倒数,提高加密的随机性。
具体地,本实施例,调用Matlab 2016a的randi函数,用K作为randi函数的初始化参数,并设置随机数取值范围是0或1,即可生成1个随机数。循环调用randi,即可生成任意个数的随机数,从而构成0或1的随机数序列。
Step 3:遍历二值序列[s 1,s 2,s 3,…]中的每个元素,如果该元素取1,则将[n 1,n 2,n 3,…]中对应下标的元素取倒数;如果该元素取0,则[n 1,n 2,n 3,…]中对应下标的元素不做修改,最后得到新的随机数序列
Figure PCTCN2019124069-appb-000005
Figure PCTCN2019124069-appb-000006
Step 4:对输入的待加密亮度值x,执行以下所述的“随机进制转换”算法得到加密后亮度值y的各位数字:
Figure PCTCN2019124069-appb-000007
例如,待加密亮度值x=123,在加密秘钥K=628的控制下,设置N=9,P=0.1,最终加密得到的y的各位数字是[y 1,y 2,y 3,y 4,y 5,y 6]=[0,1,4,0,1,1],那么亮度加密值为y=110410。
实施例二
如图2所示,本发明实施一种图像加密方法,包括:
基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
根据所述第一随机序列、第二随机序列,生成第三随机序列;
根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密。
优选地,所述根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密,包括:
(1)对于加密图像数据进行拆分,获取加密图像数据的自最低位到最高位第i位元素;
(2)根据如下公式,执行解密还原第一图像数据。
Figure PCTCN2019124069-appb-000008
其中,x为第一图像数据;[y 1,y 2,y 3,…]分别表示加密图像数据的自最低位到最高位的第i位元素;
Figure PCTCN2019124069-appb-000009
为第三随机序列。
如图2所示为本发明实施例的图像解密流程图;
本实施执行图像解密的任务是根据输入的像素亮度值加密值y和加密秘钥K,解密得到其原值x。前三个步骤与实施例一加密模块的前三个步骤相似,用于产生随机进制。
Step 1:在加密秘钥K的控制下,产生一个取值范围在2和N之间的随机正整数序列[n 1,n 2,n 3,…],即2≤n i≤N,i=1,2,3,…。此处的N必须与加密模块中的N取值相同,否则无法解密。
具体地,随机数的产生是相当成熟的技术,目前不同的软件开发包会提供相应的函数(如rand用于产生随机浮点数,randi用于产生随机正整数),由于其内部实现方式各有不同。本实施例,通过调用Matlab 2016a提供的randi函数接口,通过设置随机数范围在2和N之间,并用K作为randi函数的初始化参数来产生此处的随机正整数。每次调用randi就能产生一个随机数。因此,只需要循环调用randi,即可生成任意个数的随机数,从而构成随机数序列。
Step 2:在加密秘钥K的控制下,产生一个取值为0或1的二值序列[s 1,s 2,s 3,…],控制该序列中取1的元素的概率为P,0≤P≤0.5,此处的P必须与加密模块中的P取值相同。
具体地,本实施例,调用Matlab 2016a的randi函数,用K作为randi函数的初始化参数,并设置随机数取值范围是0或1,即可生成1个随机数。循环调用randi,即可生成任意个数的随机数,从而构成0或1的随机数序列。
Step 3:遍历二值序列[s 1,s 2,s 3,…]中的每个元素,如果该元素取1,则将[n 1,n 2,n 3,…]中对应下标的元素取倒数;如果该元素取0,则[n 1,n 2,n 3,…]中对应下标的元素不做修改,最后得到新的随机数序列
Figure PCTCN2019124069-appb-000010
Figure PCTCN2019124069-appb-000011
Step 4:对加密亮度值y,自最低位到最高位拆分成序列[y 1,y 2,y 3,…],根据以下解密公式得到亮度原值x:
Figure PCTCN2019124069-appb-000012
例如,亮度加密值为y=110410,将y自最低位向最高位拆分成序列[y 1,y 2,y 3,…]=[0,1,4,0,1,1],然后在加密秘钥K=628,N=9,P=0.1的控制下,得到亮度原值x=123。
实施例三
本发明实施一种图像加密装置,包括:
第一、第二序列生成模块,基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
第三序列生成模块,根据所述第一随机序列、第二随机序列,生成第三随机序列;
图像加密模块,根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密。
本发明实施一种图像解密装置,包括:
第一、第二序列生成模块,基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
第三序列生成模块,根据所述第一随机序列、第二随机序列,生成第三随机序列;
图像解密模块,根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密。
所述图像解密模块进一步包括:
拆分模块,对于加密图像数据进行拆分,获取加密图像数据的自最低位到最高位第i位元素;
解密还原模块,根据如下公式,执行解密还原第一图像数据。
Figure PCTCN2019124069-appb-000013
其中,x为第一图像数据;[y 1,y 2,y 3,…]分别表示加密图像数据的自最低位到最高位的第i位元素;
Figure PCTCN2019124069-appb-000014
为第三随机序列。
本实施,使用lena.bmp图像进行加密和解密实验,本实施中采用的参数均为:P=0.1,N=9。
加密:待加密亮度值x=123,在加密秘钥K=628的控制下,设置N=9,P=0.1,最终加密得到的y的各位数字是[y 1,y 2,y 3,y 4,y 5,y 6]=[0,1,4,0,1,1],那么亮度加密值为y=110410;
解密:亮度加密值为y=110410,将y自最低位向最高位拆分成序列[y 1,y 2,y 3,…]=[0,1,4,0,1,1],然后在加密秘钥K=628,N=9,P=0.1的控制下,得到亮度原值x=123。
如图3(a)为原始图像;图3(b)为在加密秘钥K=123实施的图像加密效果图;如图3(c)为基于秘钥K=123实施的图像解密后的效果图。可以看到,加密图像中的细节已经基本无法辨认,达到较好的加密效果。而解密后的图像则复原出与原图一致的视觉信息。
可选地,本发明可以对多个待加密对象执行加密域加法运算,取两个待加密的亮度值x 1=35,x 2=187,在秘钥K=628的控制下,x 1的加密值y 1=10710,x 2的加密值y 2=201110。在加密域,将两个加密值相加,得到加密值y 3=y 1+y 2=10710+201110=211820。
对加密值y 3进行解密,得到x 3=222。这正好满足x 3=x 1+x 2,满足了本发明实施的加密域加法运算。
与现有技术相比,本发明基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;根据所述第一随机序列、第二随机序列,生成第三随机序列;根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密,从而利用随机进制对 常数进制数进行重新表示,避免了图像在加密后数据量的极度膨胀,降低了云端服务器的存储需求和加密域处理时的计算负荷;平均意义下,使用现有技术:Graig Centry在论文“A fully homomorphic encryption scheme”中提出的同态加密方案,进行加密,如果采用256bit的加密强度,会使原本8bit的数值膨胀为256bit,足足为原来的32倍;而使用本发明,则通常只需要64bit,仅为现有技术1的1/4。
另一方面,本发明基于用于指示第一随机序列中取倒数的序列元素的第二随机序列以及第一随机序列来进行生成第三随机序列,使得加密结果更为随机,增强了加密效果。

Claims (7)

  1. 一种图像加密方法,其特征在于,包括:
    基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
    根据所述第一随机序列、第二随机序列,生成第三随机序列;
    根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密。
  2. 根据权利要求1所述的图像加密方法,其特征在于,所述根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密,包括:
    (1)所述第一图像数据与所述第三随机序列第i个元素取余,作为所述第一图像数据加密后的加密图像数据的第i位元素;所述输入图像数据为非0的图像数据;
    (2)所述输入数据与所述第三随机序列第i个元素取整,获取第二图像数据;
    (3)i=i+1,将所述第一图像数据更新为所述第二图像数据的数值,重复执行以上步骤,直至所述输入数据为0。
  3. 一种图像解密方法,其特征在于,包括:
    基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
    根据所述第一随机序列、第二随机序列,生成第三随机序列;
    根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密。
  4. 根据权利要求3所述的图像解密方法,其特征在于,所述根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密,包括:
    (1)对于加密图像数据进行拆分,获取加密图像数据的自最低位到最高位第i位元素;
    (2)根据如下公式,执行解密还原第一图像数据。
    Figure PCTCN2019124069-appb-100001
    其中,x为第一图像数据;[y 1,y 2,y 3,…]分别表示加密图像数据的自最低位到最高位的第i位元素;
    Figure PCTCN2019124069-appb-100002
    为第三随机序列。
  5. 一种图像加密装置,其特征在于,包括:
    第一、第二序列生成模块,基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
    第三序列生成模块,根据所述第一随机序列、第二随机序列,生成第三随机序列;
    图像加密模块,根据所述第三随机序列,执行随机进制转换,对输入的第一图像数据进行加密。
  6. 一种图像解密装置,其特征在于,包括:
    第一、第二序列生成模块,基于加密密钥,生成第一随机序列、第二随机序列;所述第二随机序列为二值序列,用于指示第一随机序列中取倒数的序列元素;
    第三序列生成模块,根据所述第一随机序列、第二随机序列,生成第三随机序列;
    图像解密模块,根据所述第三随机序列,执行随机进制转换,对加密图像数据进行解密。
  7. 根据权利要求6所述的图像解密装置,其特征在于,所述图像解密模块,包括:
    拆分模块,对于加密图像数据进行拆分,获取加密图像数据的自最低位到最高位第i位元素;
    解密还原模块,根据如下公式,执行解密还原第一图像数据。
    Figure PCTCN2019124069-appb-100003
    其中,x为第一图像数据;[y 1,y 2,y 3,…]分别表示加密图像数据的自最低位到最高位的第i位元素;
    Figure PCTCN2019124069-appb-100004
    为第三随机序列。
PCT/CN2019/124069 2018-12-13 2019-12-09 一种图像加密方法、装置及图像解密方法、装置 WO2020119645A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811527894.4A CN111324897B (zh) 2018-12-13 2018-12-13 一种图像加密方法、装置及图像解密方法、装置
CN201811527894.4 2018-12-13

Publications (1)

Publication Number Publication Date
WO2020119645A1 true WO2020119645A1 (zh) 2020-06-18

Family

ID=71075946

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/124069 WO2020119645A1 (zh) 2018-12-13 2019-12-09 一种图像加密方法、装置及图像解密方法、装置

Country Status (2)

Country Link
CN (1) CN111324897B (zh)
WO (1) WO2020119645A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102196320A (zh) * 2011-04-15 2011-09-21 江苏省现代企业信息化应用支撑软件工程技术研发中心 一种图像加解密系统
US20170289390A1 (en) * 2016-03-31 2017-10-05 Megachips Corporation Encryption device, computer-readable recording medium, and encryption method
CN107809644A (zh) * 2017-10-26 2018-03-16 宁波工程学院 一种双重加密的加密域图像可逆数据隐藏方法

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5077793A (en) * 1989-09-29 1991-12-31 The Boeing Company Residue number encryption and decryption system
JP2003195756A (ja) * 2001-12-25 2003-07-09 Shisei O 暗号化方法及びその装置
CN1207677C (zh) * 2003-06-26 2005-06-22 上海交通大学 基于余数图像的数字水印嵌入和提取方法
US9077509B2 (en) * 2005-12-13 2015-07-07 Koninklijke Philips N.V. Secure threshold decryption protocol computation
JP5027422B2 (ja) * 2006-02-09 2012-09-19 ルネサスエレクトロニクス株式会社 剰余演算処理装置
CN100576226C (zh) * 2008-07-10 2009-12-30 浙江工业大学 基于中国剩余定理的数据库加密方法
US8462939B2 (en) * 2010-12-07 2013-06-11 King Fahd University Of Petroleum And Minerals RNS-based cryptographic system and method
JP5268011B2 (ja) * 2011-03-19 2013-08-21 国立大学法人お茶の水女子大学 暗号化システム及び復号化システム
CN103067162B (zh) * 2012-11-15 2016-08-03 新浪技术(中国)有限公司 一种数据传输的方法及装置
GB2537094B (en) * 2015-02-27 2019-02-20 Sheffield Hallam Univ Image data compression and decompression

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102196320A (zh) * 2011-04-15 2011-09-21 江苏省现代企业信息化应用支撑软件工程技术研发中心 一种图像加解密系统
US20170289390A1 (en) * 2016-03-31 2017-10-05 Megachips Corporation Encryption device, computer-readable recording medium, and encryption method
CN107809644A (zh) * 2017-10-26 2018-03-16 宁波工程学院 一种双重加密的加密域图像可逆数据隐藏方法

Also Published As

Publication number Publication date
CN111324897B (zh) 2022-08-09
CN111324897A (zh) 2020-06-23

Similar Documents

Publication Publication Date Title
US20210312334A1 (en) Model parameter training method, apparatus, and device based on federation learning, and medium
WO2021068444A1 (zh) 数据处理方法、装置、计算机设备和存储介质
WO2022077793A1 (zh) 基于二维滞后复Logistic映射的图像加解密通信算法
WO2021068445A1 (zh) 数据处理方法、装置、计算机设备和存储介质
TWI701561B (zh) 資料備份方法、裝置、存儲介質及伺服器
US10885203B2 (en) Encrypted data exchange
US8681976B2 (en) System and method for device dependent and rate limited key generation
CN107993073B (zh) 一种人脸识别系统及其工作方法
WO2017000726A1 (zh) 一种密钥变换方法、装置及终端
Koppu et al. A fast enhanced secure image chaotic cryptosystem based on hybrid chaotic magic transform
WO2021114850A1 (zh) 消息的加解密、读写方法、装置、计算机设备和存储介质
CN104618096A (zh) 保护密钥授权数据的方法、设备和tpm密钥管理中心
WO2021129470A1 (zh) 基于多项式完全同态的二进制数据加密系统及方法
WO2019242645A1 (zh) 密钥生成装置、加密解密装置、密钥生成和分发系统以及信息安全传递系统
WO2023046207A1 (zh) 一种数据传输方法、装置及计算机非易失性可读存储介质
CN114417364A (zh) 一种数据加密方法、联邦建模方法、装置及计算机设备
Priyanka et al. A survey of image encryption for healthcare applications
Dey Amalgamation of cyclic bit operation in sd-ei image encryption method: An advanced version of sd-ei method: Sd-ei ver-2
Dharangan et al. Secure cloud-based E-health system using advanced encryption standard
CN113055153B (zh) 一种基于全同态加密算法的数据加密方法、系统和介质
US20240178999A1 (en) Method for data encryption, terminal device and non-transitory computer-readable storage medium
WO2020114308A1 (zh) 一种图像加密与校正方法、装置及图像解密方法、装置
WO2020119645A1 (zh) 一种图像加密方法、装置及图像解密方法、装置
CN112131591A (zh) 对信息的密文进行压缩的加密方法、装置、设备及介质
CN116132065A (zh) 密钥确定方法、装置、计算机设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19896989

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19896989

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.11.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19896989

Country of ref document: EP

Kind code of ref document: A1