CN113645367B - Batch image combined encryption method and device - Google Patents
Batch image combined encryption method and device Download PDFInfo
- Publication number
- CN113645367B CN113645367B CN202110795933.4A CN202110795933A CN113645367B CN 113645367 B CN113645367 B CN 113645367B CN 202110795933 A CN202110795933 A CN 202110795933A CN 113645367 B CN113645367 B CN 113645367B
- Authority
- CN
- China
- Prior art keywords
- image
- images
- encryption
- value
- matrix
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/32—Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
- H04N1/32101—Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
- H04N1/32144—Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
- H04N1/32149—Methods relating to embedding, encoding, decoding, detection or retrieval operations
- H04N1/32267—Methods relating to embedding, encoding, decoding, detection or retrieval operations combined with processing of the image
- H04N1/32272—Encryption or ciphering
-
- 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/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/44—Secrecy systems
- H04N1/448—Rendering the image unintelligible, e.g. scrambling
- H04N1/4486—Rendering the image unintelligible, e.g. scrambling using digital data encryption
Abstract
The invention discloses a batch image combination encryption method and a device, wherein the method comprises the following steps: taking K images with the size of M multiplied by N as the input of a Hash algorithm; equally dividing the K images into 3 groups to generate three new images P with the size of M multiplied by N1,P2And P3(ii) a Updating P3:Will P1、P2And updated P3Combining to generate an encryption sequence matrix Q; the image is line scrambled with a first line value Q (1, n) of Q as parameter, and then line scrambled with a second line value Q (2, n) of Q as parameter, all imagesAre all updated to scrambled imagesThe encryption sequence matrix Q and all scrambled imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a ciphertext imageEncrypting the matrix Q by adopting an encryption algorithm to obtain an encrypted matrixThe invention can greatly reduce the time overhead of the encryption process on the basis of ensuring the safety.
Description
Technical Field
The invention belongs to the technical field of image processing, and particularly relates to a batch image combination encryption method and device.
Background
With the rapid development of information technology, digital images are more and more widely applied to business activities and social life, so that the number of images containing a large amount of business and private information is exponentially increased, and thus, the urgent need of a high-speed encryption algorithm is greatly promoted, and particularly, the urgent need is more urgent for image encryption in the environment of the internet of things with a large amount of low-performance electronic equipment. Through the development of many years, a large number of encryption algorithms with higher security emerge in the encryption field. Currently, the chaos encryption method is the most representative image encryption method. In the aspect of safety, the encryption method based on the chaotic system depends on floating point number operation, the precision requirement on floating point numbers is high, but the randomness of the chaotic system is seriously damaged under the environment of low computer precision, so that the safety of the corresponding encryption method is sharply reduced; in terms of encryption speed, encryption methods based on chaotic systems can be roughly classified into two categories: one is that each pixel corresponds to a chaotic random number in the encryption process, and the other is that a plurality of pixels correspond to a chaotic random number. The chaotic system used in the former usually needs tens of floating point number operations when generating a random number, and the high-dimensional chaotic system with higher safety has higher calculation times; although the number of random numbers to be generated is greatly reduced in the latter compared with the former, multiple rounds of encryption are often required in the encryption process, and therefore, the time overhead of the two rounds of encryption is large. The existing encryption algorithm is difficult to meet the actual requirements under the environment. Therefore, designing a high-speed encryption algorithm with high security even in a low-precision environment is an important problem to be solved urgently.
Disclosure of Invention
The invention provides a batch image combination encryption method and a device aiming at the problem that the safety and the speed of the existing image encryption method are lower in the environment with low calculation precision.
In order to achieve the purpose, the invention adopts the following technical scheme:
the invention provides a batch image combination encryption method on one hand, which comprises the following steps:
step 1, generating a hash value: taking K images with the size of M multiplied by N, taking the images as input of a hash algorithm, wherein the output of the hash algorithm is a number of 20 bytes, which is respectively represented by H(s), and s is 1, 2, 20, and the value range of each H(s) is 0-255;
step 2, generating a combined image: the K images were equally divided into 3 groups, and each of the grouped images was represented asWherein, K is 1, 2, 3, i is 1, 2, 3; then, the exclusive-OR operation is performed on the pixel values with (1, 1) in all the images in the 1 st group to generate a new pixel value Then, the exclusive or operation is sequentially performed on all pixel values except the pixel value at the position of (1, 1) in all the images in each 1 group until a new image P with the size of M × N is generated1(ii) a Similarly, the above operations are performed in the 2 nd group and the 3 rd group respectively, and new images P are correspondingly generated2And P3;
And 4, generating an encrypted sequence number according to the following formula:
p1(m,n)=15×P1(m,n)%251
p2(m,n)=14×P2(m,n)%241
p3(m,n)=11×P3(m,n)%239
Q(m,n)=(p1(m,n)+p2(m,n)+p3(m,n))%256
respectively adding P1、P2And updated P3Generating an encrypted sequence matrix Q with the size of M multiplied by N according to the input data of the formula;
and 5, image scrambling: firstly, the first line value Q (1, n) of Q is used as parameter to make line scrambling for image, then the second line value Q (2, n) of Q is used as parameter to make line scrambling for image, all the imagesAre all updated to scrambled images
Step 6, image encryption: the encryption sequence matrix Q and all scrambled imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a ciphertext image
Further, after the step 7, the method further comprises:
image of a personAnd (3) decryption: the matrix Q and all the ciphertext imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a scrambled image
Image inverse scrambling: firstly, the second line value Q (2, n) of Q is used as parameter to make column inverse scrambling on the image, then the first line value Q (1, n) of Q is used as parameter to make line inverse scrambling on the image, all the images areAre all updated to the original image P after the inverse scrambling.
The invention also provides a batch image combination encryption device, which comprises:
a hash value generation module for generating a hash value: taking K images with the size of M multiplied by N, taking the images as input of a hash algorithm, wherein the output of the hash algorithm is a number of 20 bytes, which is respectively represented by H(s), and s is 1, 2, 20, and the value range of each H(s) is 0-255;
a combined image generation module to generate a combined image: the K images were equally divided into 3 groups, and each of the grouped images was represented asWherein, K is 1, 2, 3, i is 1, 2, 3; then, the exclusive-OR operation is performed on the pixel values with (1, 1) in all the images in the 1 st group to generate a new pixel valueThen, the exclusive or operation is sequentially performed on all pixel values except the pixel value at the position of (1, 1) in all the images in each 1 group until a new image P with the size of M × N is generated1(ii) a Similarly, the above operations are performed in the 2 nd group and the 3 rd group respectively, and new images P are correspondingly generated2And P3;
An image update module for updating P3: p generated in step 23Middle pixel value P3(m, N) and h(s), s ═ h [ (m-1) × N + N ] produced in step 1]mod 20 performs an exclusive-or operation and updates the pixel value to the new value generated by the operation, i.e., the
The encryption sequence matrix generating module is used for generating an encryption sequence number according to the following formula:
p1(m,n)=15×P1(m,n)%251
p2(m,n)=14×P2(m,n)%241
p3(m,n)=11×P3(m,n)%239
Q(m,n)=(p1(m,n)+p2(m,n)+p3(m,n))%256
respectively adding P1、P2And updated P3Generating an encrypted sequence matrix Q with the size of M multiplied by N according to the input data of the formula;
an image scrambling module, configured to scramble images: firstly, the first line value Q (1, n) of Q is used as parameter to make line scrambling for image, then the second line value Q (2, n) of Q is used as parameter to make line scrambling for image, all the imagesAre all updated to scrambled images
A first encryption module for image encryption: the encryption sequence matrix Q and all scrambled imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a ciphertext image
A second encryption module for encrypting the matrix Q by using an encryption algorithm to obtain an encrypted matrix
Further, still include:
the second image decryption module is used for image decryption: the encryption sequence matrix Q and all the ciphertext imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a scrambled image
The image inverse scrambling module is used for inverse scrambling of images: firstly, the second line value Q (2, n) of Q is used as parameter to make column inverse scrambling on the image, then the first line value Q (1, n) of Q is used as parameter to make line inverse scrambling on the image, all the images areAre all updated to the original image P after the inverse scrambling.
Compared with the prior art, the invention has the following beneficial effects:
aiming at the problem that the existing image encryption method is low in safety under low precision, the invention adopts a prime number modular multiplication linear congruence generator based on single byte to encrypt the batch images, replaces the existing chaotic system and ensures that the encryption method can effectively operate under the low-precision computing environment. Aiming at the problem of low encryption speed of the existing image encryption method, the invention enables multiple pixels to correspond to the same pseudo-random number in the encryption process, and only single-round encryption is carried out in the encryption process, thereby effectively reducing the time overhead of encryption and improving the encryption speed.
The invention not only shows higher security, but also has very small time complexity, and can greatly reduce the time overhead of the encryption process on the basis of ensuring the security.
Drawings
FIG. 1 is a flowchart illustrating an encryption method for batch image combination encryption according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a decryption method of a batch image combination encryption method according to an embodiment of the present invention;
FIG. 3 is an exemplary diagram of a plaintext image for an experiment;
FIG. 4 is an illustration of a histogram of a plaintext image;
FIG. 5 is an exemplary diagram of a plaintext ciphertext image;
FIG. 6 is an illustration of a histogram of a ciphertext image;
FIG. 7 is an exemplary diagram of a decrypted image;
FIG. 8 is an illustration of a histogram of a decrypted image;
FIG. 9 is a diagram illustrating an example of the distribution of neighboring pixels in different directions in a plaintext image;
FIG. 10 is a diagram illustrating an exemplary distribution of neighboring pixels in different directions of a ciphertext image;
FIG. 11 is an exemplary graph of a sensitivity index test;
FIG. 12 is a pure white image encryption effect diagram;
FIG. 13 is a graph of the effect of pure black image encryption;
FIG. 14 is one of an exemplary graph of anti-noise and anti-occlusion attack testing;
FIG. 15 is a second example graph of anti-noise and anti-occlusion attack tests.
Detailed Description
The invention is further illustrated by the following examples in conjunction with the accompanying drawings:
as shown in fig. 1, a batch image combining encryption method includes:
step 1, generating a hash value: taking K images with the size of M multiplied by N, taking the images as input of a hash algorithm, wherein the output of the hash algorithm is a number of 20 bytes, which is respectively represented by H(s), and s is 1, 2. As one possible implementation, the HASH algorithm is the HASH-1 algorithm.
Step 2, generating a combined image: the K images were equally divided into 3 groups, and each of the grouped images was represented asWherein, K is 1, 2, 3, i is 1, 2, 3; then, the exclusive-OR operation is performed on the pixel values with (1, 1) in all the images in the 1 st group to generate a new pixel value Then, the exclusive or operation is sequentially performed on all pixel values except the pixel value at the position of (1, 1) in all the images in each 1 group until a new image P with the size of M × N is generated1(ii) a Similarly, the above operations are performed in the 2 nd group and the 3 rd group respectively, and new images P are correspondingly generated2And P3。
And 4, generating an encrypted sequence number according to the following formula:
respectively adding P1、P2And updated P3As input data to the above formula, an encrypted sequence matrix Q of size M × N is generated accordingly.
And 5, image scrambling: firstly, the first line value Q (1, n) of Q is used as parameter to make line scrambling for image, then the second line value Q (2, n) of Q is used as parameter to make line scrambling for image, all the imagesAre all updated to scrambled imagesSpecifically, the row scrambling step can be described as: all images are taken as parameters by taking the value of Q (1, n)The pixel values of the nth row are shifted left by Q (1, n) times by taking the pixel as a unit, and the pixel values shifted out on the left side are sequentially added to the tail of the right side of the row until all the rows are shifted; the rank scrambling step can be described as: all images are taken as parameters by taking the value of Q (2, n)The pixel value of the nth column is shifted up Q (2, n) times in units of pixels, and the pixel values shifted up are sequentially added to the end below the column until all columns are shifted.
Step 6, image encryption: the encryption sequence matrix Q and all scrambled imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a ciphertext imageThe specific operation formula is as follows:
and 7, encrypting the matrix Q by adopting an encryption algorithm to obtain an encrypted matrixIn particular, the matrix Q may be encrypted using any encryption algorithm with a high security, and as an implementable embodiment, a modified 2D-SCL encryption method (Chen C, Sun K H and He sb.2020.an improved physical encryption algorithm with fine computing precision J].SignalProcessing,2020,168:107340.[DOI:10.1016/j.sigpro.2019.107340]) The matrix Q is encrypted. The improved 2D-SCL encryption method combines the confusion and diffusion processes in one stage based on a new two-dimensional chaotic mapping to improve the operation speed. Based on the SHA-1 hash value and the chaotic sequence of the common image, a pseudo-random number sequence is designed, and a degradation-resistant method is introduced on the basis, so that the dynamic degradation of the 2D-SCL map under the limited calculation precision is improved. Meanwhile, the algorithm also updates the initial value of the 2D-SCL mapping in real time, thereby enhancing the capability of resisting known plaintext and plaintext attack selection.
Further, as shown in fig. 2, after the step 7, the method further includes:
for matrixDecrypting to obtain an encrypted sequence matrix Q; as an implementable manner, the decryption is performed by correspondingly adopting an improved 2D-SCL decryption method;
image decryption: the matrix Q and all the ciphertext imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a scrambled imageThe specific operation formula is as follows:
image inverse scrambling: firstly, the second line value Q (2, n) of Q is taken as a parameter to carry out image processingThe columns are inverse scrambled, then the images are inverse scrambled by using the first row value Q (1, n) of Q as parameter, all the imagesAre all updated to the original image P after the inverse scrambling. Specifically, the column inversion scrambling step can be described as: all images are taken as parameters by taking the value of Q (2, n)The pixel value of the nth column is shifted down by Q (2, n) times by taking the pixel as a unit, and the pixel values shifted down are sequentially added to the head part above the column until all the columns are shifted; the reverse-row scrambling step can be described as: all images are taken as parameters by taking the value of Q (1, n)The pixel values of the nth row of (1, n) are shifted right by Q (1, n) times in units of pixels, and the pixel values shifted right are sequentially added to the head of the left side of the row until all rows are shifted.
To verify the effect of the present invention, the following experiment was performed:
in all experiments our computer was configured with Intel (R) core (TM) i7-10710 CPU @1.10GHz, memory was 16G, operating system was Windows 10; the simulation software adopts Pycharm 20192019.2.4x64. Experiments used 100 standard test images 512 x 512 from the USC-SIPI-michcellaneous dataset as the test dataset, where 4 representative images were selected for the cryptographic effect presentation (see fig. 3-8); where fig. 3 is a plaintext image (where (a) is Airplane, (b) is babon, (c) is House, and (d) is Lena), fig. 4 is a histogram of the plaintext image, fig. 5 is a plaintext ciphertext image, fig. 6 is a histogram of the ciphertext image, fig. 7 is a decrypted image, and fig. 8 is a histogram of the decrypted image.
(a) Correlation analysis
The neighboring pixel correlation is typically used to evaluate the performance of an image encryption scheme. The correlation of two adjacent pixel sequences can be calculated by:
wherein D (T), D' (T) is two adjacent pixels of the picture, T is the number of pixels,andto D (t), D' (t) corresponds to a mathematical expectation. If D (t) and D' (t) exhibit a high correlation, then the value of R is close to 1 or-1; otherwise, it will approach 0.
Fig. 9 and 10 show the distribution of adjacent pixels in different directions, where (b), (c), and (d) in fig. 9 show the correlation between adjacent pixels in the horizontal, vertical, and diagonal directions of the plaintext image (fig. 9 (a)), and (b), (c), and (d) in fig. 10 show the correlation between adjacent pixels in the horizontal, vertical, and diagonal directions of the ciphertext image (fig. 10 (a)), respectively. As can be seen from (b), (c), and (d) in fig. 9, the correlation values between adjacent pixels in the horizontal, vertical, and diagonal directions of the plaintext image are concentrated on the diagonal line, and a strong correlation is exhibited; however, as shown in fig. 10 (b), (c), and (d), the correlation between adjacent pixels in the horizontal, vertical, and diagonal directions of the ciphertext image is uniformly distributed in the correlation space, and thus a high degree of independence is exhibited. Table 1 is a specific correlation data statistic.
TABLE 1 correlation
(b) Entropy of information
The information entropy is a method for evaluating the randomness of an image encryption algorithm, and a calculation formula is as follows:
where p (i) is the probability of the image pixel value i. The maximum information entropy is 8 for each channel of a color image or a grayscale image. Table 2 lists the information entropies of different images and their corresponding encrypted images, where column 1 is the plaintext name, column 2 shows the information entropy of the plaintext, column 3 is the information entropy of the ciphertext image generated by the improved 2D-SCL decryption method, and column 4 is the information entropy of the ciphertext image generated by the method of this patent. The table shows that the information entropy of the ciphertext generated by all encryption methods is extremely close to 8.
TABLE 2 entropy of information
(c) Index of sensitivity
Changing one of the pixels in one of the 100 pictures, as shown in fig. 11 (a) and (b), and subtracting (b) from (a) in fig. 11, fig. 11 (c) can be obtained, and it can be seen that (a) and (b) in fig. 11 are slightly different. Fig. 11 (a) and (b) are encrypted according to the method of the present invention to obtain (d) and (e) in fig. 11, respectively, and fig. 11(f) is obtained by subtracting (e) from (d) in fig. 11, and it is obvious from fig. 11(f) that (d) and (e) in fig. 11 are very different. The higher sensitivity of the present invention can be demonstrated.
(d) Key space
It is well known that the key space of a cryptographic algorithm should not be less than 2128To ensure encryption security. The key space of this patent and the improved 2D-SCL method with different computational accuracies is shown in table 3. As can be seen from Table 3, the calculation accuracy was 2-16And 2-8Under the environment, the key space of the patent is 28×512×512Is much greater than 2128Sufficient to satisfy the requirements of key security; while the improved 2D-SCL method has a calculation precision of 2-16The key space under the environment is 0.3 × 2158The requirement of key security can be met, but the calculation precision is 2-8The key space under the environment is 0.3 × 294Far less than 2128Does not satisfy the requirement of key security
TABLE 3 Key space comparison
(e) Differential attack
A differential attack is a common and efficient security attack. The rate of change of the Number of Pixels (NPCR) and the uniform average intensity of change (UACI) are two common indicators for evaluating the ability to resist differential attacks. The NPCR calculates the number of different pixels, while the UACI calculates the average change in pixels between two images. Suppose d1And d2Are two cryptographic images, their ordinary images have only one bit difference, and their NPCR and UACI values can be calculated as follows:
where δ is a sign function if d1(t) is equal to d1(t), then δ (d)1(t),d2(t)) ═ 0; otherwise, δ (p)1(t),p2(t)). 1. Further, F denotes a maximum allowable pixel value, and is usually set to 255. The value of NPCR is ideally μN0.9961, UACI value μuAt the α level, 0.3346, it is determined whether the current NPCR is within the standard range by equations (7) and (8).
When NPCR < N*When the current NPCR does not meet the requirement, rejecting; otherwise, it is accepted.
Similar to NPCR, UACI has a set of criteria, and at the α level, whether the current UACI is within the criteria is determined by equations (9) and (10).
Significance levels a were set to 0.01 and 0.05, obtained in the experiment, N*(0.01)=99.5810%,N*(0.05)=99.5893, In the experiment, each picture is tested for 100 times, and random pixels of one image are changed by 1 bit each time, and then are spliced and encrypted with the original data set except the picture. The results obtained by calculation according to the above formula are shown in Table 4. The table shows that the pass rate can stably reach more than 90, which indicates that the proposed algorithm can effectively resist differential attack.
TABLE 4 NPCR, UACI passage
(f) Anti-plaintext attack
Plaintext and chosen plaintext attacks are known to be common attacks for image encryption algorithms. Therefore, a secure cryptographic algorithm should have a better resistance to these attacks. A completely black or white image defeats the scrambling effect of the encryption algorithm. Therefore, hackers often use this type of image to crack the encryption algorithm. Thus, they were used to evaluate the resistance of the proposed cryptosystem to known plaintext and chosen plaintext attacks, fig. 12, 13 show the effect of pure white and pure black encryption, fig. 12 (b) and fig. 13 (b) show the ciphertext of fig. 12 (a) and fig. 13 (a), respectively, fig. 12 (c) and fig. 13 (c) show the histogram of the ciphertext image (fig. 12 (b) and fig. 13 (b)), respectively, it can be seen that the encrypted images are both noise-like images, and the histogram is uniformly distributed, which means that no information about the normal image can be obtained from these encrypted images. Table 5 shows the correlation, information entropy, and NPCR and UACI values for the ciphertext for the pure white and pure black images.
TABLE 5 pure white and pure black indices
(g) Noise and occlusion attack immunity
In the process of transmitting the encrypted image, the anti-noise and attack shielding capabilities are added, so that the method has great significance for improving the safety of the algorithm. For an ideal encryption algorithm, it must be extremely sensitive to small changes in the normal image, or even to a pixel change, which has little effect on the decryption process. Taking airplan, i.e. fig. 14 (a), as an example, the encrypted file fig. 14 (b) is cut to a certain size to obtain fig. 14 (c), and then decrypted in a normal manner to obtain fig. 14 (d).
The original image, i.e. figure 15 (a), is encrypted, the salt and pepper noise is added to the encrypted file, figure 15 (b), to obtain figure 15 (c), and the encrypted file is decrypted in a normal way to obtain figure 15 (d).
As can be seen from the above figure, the method of the present invention has certain robustness.
(h) Time consumption
In addition to the security of cryptographic algorithms, speed of operation is also an important condition for evaluating the performance of cryptographic systems. As shown in table 6, 50 to 800 common images are encrypted, and it can be seen that the method of the present invention has certain advantages in time consumption when encrypting multiple images.
TABLE 6 time consumption
On the basis of the above embodiment, the present invention further provides a batch image combination encryption apparatus, including:
a hash value generation module for generating a hash value: taking K images with the size of M multiplied by N, taking the images as input of a hash algorithm, wherein the output of the hash algorithm is a number of 20 bytes, which is respectively represented by H(s), and s is 1, 2, 20, and the value range of each H(s) is 0-255;
a combined image generation module to generate a combined image: the K images were equally divided into 3 groups, and each of the grouped images was represented asWherein, K is 1, 2, 3, i is 1, 2, 3; then, the exclusive-OR operation is performed on the pixel values with (1, 1) in all the images in the 1 st group to generate a new pixel valueThen, the exclusive or operation is sequentially performed on all pixel values except the pixel value at the position of (1, 1) in all the images in each 1 group until a new image P with the size of M × N is generated1(ii) a Similarly, the above operations are performed in the 2 nd group and the 3 rd group respectively, and new images P are correspondingly generated2And P3;
An image update module for updating P3: p generated in step 23Middle pixel value P3(m, N) and h(s), s ═ h [ (m-1) × N + N ] produced in step 1]mod 20 performs an exclusive-or operation and updates the pixel value to the new value generated by the operation, i.e., the
The encryption sequence matrix generating module is used for generating an encryption sequence number according to the following formula:
p1(m,n)=15×P1(m,n)%251
p2(m,n)=14×P2(m,n)%241
p3(m,n)=11×P3(m,n)%239
Q(m,n)=(p1(m,n)+p2(m,n)+p3(m,n))%256
respectively adding P1、P2And updated P3Generating an encrypted sequence matrix Q with the size of M multiplied by N according to the input data of the formula;
an image scrambling module, configured to scramble images: firstly, the first line value Q (1, n) of Q is used as parameter to make line scrambling for image, then the second line value Q (2, n) of Q is used as parameter to make line scrambling for image, all the imagesAre all updated to scrambled images
A first encryption module for image encryption: the encryption sequence matrix Q and all scrambled imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a ciphertext image
A second encryption module for encrypting the matrix Q by using an encryption algorithm to obtain an encrypted matrix
Further, still include:
the second image decryption module is used for image decryption: the encryption sequence matrix Q and all the ciphertext imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a scrambled image
The image inverse scrambling module is used for inverse scrambling of images: firstly, the second line value Q (2, n) of Q is used as parameter to make column inverse scrambling on the image, then the first line value Q (1, n) of Q is used as parameter to make line inverse scrambling on the image, all the images areAre all updated to the original image P after the inverse scrambling.
In summary, aiming at the problem that the existing image encryption method is low in safety under low precision, the invention adopts a prime number modular multiplication linear congruence generator based on a single byte to encrypt the batch image, replaces the existing chaotic system, and ensures that the encryption method can effectively operate under the low-precision computing environment. Aiming at the problem of low encryption speed of the existing image encryption method, the invention enables multiple pixels to correspond to the same pseudo-random number in the encryption process, and only single-round encryption is carried out in the encryption process, thereby effectively reducing the time overhead of encryption and improving the encryption speed. The invention not only shows higher security, but also has very small time complexity, and can greatly reduce the time overhead of the encryption process on the basis of ensuring the security.
The above shows only the preferred embodiments of the present invention, and it should be noted that it is obvious to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and these modifications and improvements should also be considered as the protection scope of the present invention.
Claims (4)
1. A batch image combining encryption method, comprising:
step 1, generating a hash value: taking K images with the size of M multiplied by N, taking the images as input of a hash algorithm, wherein the output of the hash algorithm is a number of 20 bytes, which is respectively represented by H(s), and s is 1, 2, 20, and the value range of each H(s) is 0-255;
step 2, generating a combined image: the K images were equally divided into 3 groups, and each of the grouped images was represented asWherein, K is 1, 2, 3, i is 1, 2, 3; then, the exclusive-OR operation is performed on the pixel values with (1, 1) in all the images in the 1 st group to generate a new pixel value Then, the exclusive or operation is sequentially performed on all pixel values except the pixel value at the position of (1, 1) in all the images in each 1 group until a new image P with the size of M × N is generated1(ii) a Similarly, the above operations are performed in the 2 nd group and the 3 rd group respectively, and new images P are correspondingly generated2And P3;
Step 3, updating P3: p generated in step 23Middle pixel value P3(m, N) and h(s), s ═ h [ (m-1) × N + N ] produced in step 1]mod 20 performs an exclusive-or operation and updates the pixel value to the new value generated by the operation, i.e., the
And 4, generating an encrypted sequence number according to the following formula:
p1(m,n)=15×P1(m,n)%251
p2(m,n)=14×P2(m,n)%241
p3(m,n)=11×P3(m,n)%239
Q(m,n)=(p1(m,n)+p2(m,n)+p3(m,n))%256
respectively adding P1、P2And updated P3Generating an encrypted sequence matrix Q with the size of M multiplied by N according to the input data of the formula;
and 5, image scrambling: firstly, the first line value Q (1, n) of Q is used as parameter to make line scrambling for image, then the second line value Q (2, n) of Q is used as parameter to make line scrambling for image, all the imagesAre all updated to scrambled images
Step 6, image encryption: the encryption sequence matrix Q and all scrambled imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a ciphertext image
2. The batch image combined encryption method according to claim 1, further comprising, after the step 7:
image decryption: the matrix Q and all the ciphertext imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a scrambled image
Image inverse scrambling: firstly, the second line value Q (2, n) of Q is used as parameter to make column inverse scrambling on the image, then the first line value Q (1, n) of Q is used as parameter to make line inverse scrambling on the image, all the images areAre all updated to the original image P after the inverse scrambling.
3. A batch image combining encryption apparatus, comprising:
a hash value generation module for generating a hash value: taking K images with the size of M multiplied by N, taking the images as input of a hash algorithm, wherein the output of the hash algorithm is a number of 20 bytes, which is respectively represented by H(s), and s is 1, 2, 20, and the value range of each H(s) is 0-255;
a combined image generation module to generate a combined image: the K images were equally divided into 3 groups, and each of the grouped images was represented asWherein, K is 1, 2, 3, i is 1, 2, 3; then, the exclusive-OR operation is performed on the pixel values with (1, 1) in all the images in the 1 st group to generate a new pixel valueThen, the exclusive or operation is sequentially performed on all pixel values except the pixel value at the position of (1, 1) in all the images in each 1 group until a new image P with the size of M × N is generated1(ii) a Similarly, the above operations are performed in groups 2 and 3, respectively,correspondingly generating new image P2And P3;
An image update module for updating P3: p generated in step 23Middle pixel value P3(m, N) and h(s), s ═ h [ (m-1) × N + N ] produced in step 1]mod 20 performs an exclusive-or operation and updates the pixel value to the new value generated by the operation, i.e., the
The encryption sequence matrix generating module is used for generating an encryption sequence number according to the following formula:
p1(m,n)=15×P1(m,n)%251
p2(m,n)=14×P2(m,n)%241
p3(m,n)=11×P3(m,n)%239
Q(m,n)=(p1(m,n)+p2(m,n)+p3(m,n))%256
respectively adding P1、P2And updated P3Generating an encrypted sequence matrix Q with the size of M multiplied by N according to the input data of the formula;
an image scrambling module, configured to scramble images: firstly, the first line value Q (1, n) of Q is used as parameter to make line scrambling for image, then the second line value Q (2, n) of Q is used as parameter to make line scrambling for image, all the imagesAre all updated to scrambled images
A first encryption module for image encryption: the encryption sequence matrix Q and all scrambled imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a ciphertext image
4. The batch image combination encryption device according to claim 3, further comprising:
the second image decryption module is used for image decryption: the encryption sequence matrix Q and all the ciphertext imagesThe pixel values of the corresponding positions are subjected to XOR operation to generate a scrambled image
The image inverse scrambling module is used for inverse scrambling of images: firstly, the second line value Q (2, n) of Q is used as parameter to make column inverse scrambling on the image, then the first line value Q (1, n) of Q is used as parameter to make line inverse scrambling on the image, all the images areAre all updated to the original image P after the inverse scrambling.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110795933.4A CN113645367B (en) | 2021-07-14 | 2021-07-14 | Batch image combined encryption method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110795933.4A CN113645367B (en) | 2021-07-14 | 2021-07-14 | Batch image combined encryption method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113645367A CN113645367A (en) | 2021-11-12 |
CN113645367B true CN113645367B (en) | 2022-04-29 |
Family
ID=78417398
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110795933.4A Active CN113645367B (en) | 2021-07-14 | 2021-07-14 | Batch image combined encryption method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113645367B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104008520A (en) * | 2014-05-09 | 2014-08-27 | 河南大学 | Color image encryption method based on SHA-384 function, spatiotemporal chaotic system, quantum chaotic system and neural network |
WO2015056236A1 (en) * | 2013-10-17 | 2015-04-23 | Andre Keith Joubert | A method of generating key arrays of random numbers and encryption |
CN109660696A (en) * | 2018-11-30 | 2019-04-19 | 大连理工大学 | A kind of new image encryption method |
CN109889686A (en) * | 2019-01-28 | 2019-06-14 | 郑州轻工业学院 | Based on H fractal structure and dynamically from the image encryption method of invertible matrix |
CN111105339A (en) * | 2019-12-23 | 2020-05-05 | 郑州轻工业大学 | Image encryption method based on multidimensional chaotic system and Joseph scrambling |
-
2021
- 2021-07-14 CN CN202110795933.4A patent/CN113645367B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2015056236A1 (en) * | 2013-10-17 | 2015-04-23 | Andre Keith Joubert | A method of generating key arrays of random numbers and encryption |
CN104008520A (en) * | 2014-05-09 | 2014-08-27 | 河南大学 | Color image encryption method based on SHA-384 function, spatiotemporal chaotic system, quantum chaotic system and neural network |
CN109660696A (en) * | 2018-11-30 | 2019-04-19 | 大连理工大学 | A kind of new image encryption method |
CN109889686A (en) * | 2019-01-28 | 2019-06-14 | 郑州轻工业学院 | Based on H fractal structure and dynamically from the image encryption method of invertible matrix |
CN111105339A (en) * | 2019-12-23 | 2020-05-05 | 郑州轻工业大学 | Image encryption method based on multidimensional chaotic system and Joseph scrambling |
Non-Patent Citations (2)
Title |
---|
DNA Strands Level Scrambling Based Color Image Encryption Scheme;Nadeem Iqbal等;《IEEE Access》;20200921;第8卷;全文 * |
一种基于混沌系统的新型图像加密算法;王宏达;《光学技术》;20170515;第43卷(第03期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113645367A (en) | 2021-11-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Chai et al. | Medical image encryption algorithm based on Latin square and memristive chaotic system | |
Hua et al. | Image encryption using Josephus problem and filtering diffusion | |
Hua et al. | Medical image encryption using high-speed scrambling and pixel adaptive diffusion | |
Hanif et al. | A novel and efficient 3D multiple images encryption scheme based on chaotic systems and swapping operations | |
Kanso et al. | A novel image encryption algorithm based on a 3D chaotic map | |
Mirzaei et al. | A new image encryption method: parallel sub-image encryption with hyper chaos | |
Ghebleh et al. | An image encryption scheme based on irregularly decimated chaotic maps | |
CN109102452B (en) | Image encryption method based on Latin square array scrambling and bidirectional diffusion | |
Rohith et al. | Image encryption and decryption using chaotic key sequence generated by sequence of logistic map and sequence of states of Linear Feedback Shift Register | |
CN108122188B (en) | Image encryption method | |
CN107633175B (en) | Chaos-based rapid color image encryption method | |
Touil et al. | Text encryption: Hybrid cryptographic method using vigenere and hill ciphers | |
Song et al. | A fast parallel batch image encryption algorithm using intrinsic properties of chaos | |
CN110086600B (en) | Image encryption method based on hyperchaotic system and variable step length Joseph problem | |
Liu et al. | A new DNA coding and hyperchaotic system based asymmetric image encryption algorithm | |
Ahadpour et al. | A chaos-based image encryption scheme using chaotic coupled map lattices | |
Murugan et al. | A hybrid image encryption algorithm using chaos and Conway's game‐of‐life cellular automata | |
Ye | A novel image encryption scheme based on generalized multi-sawtooth maps | |
CN107633474B (en) | A kind of chaos color image encrypting method with fast key stream generating process | |
CN110225222B (en) | Image encryption method based on 3D orthogonal Latin square and chaotic system | |
Jia | Image encryption with cross colour field algorithm and improved cascade chaos systems | |
Ramírez-Torres et al. | Image encryption with an improved cryptosystem based on a matrix approach | |
CN109376793B (en) | Image encryption method based on four-dimensional Chen hyper-chaotic system and K-means clustering | |
Dash et al. | An efficient Intra-Inter pixel encryption scheme to secure healthcare images for an IoT environment | |
Thiyagarajan et al. | A chaotic image encryption scheme with complex diffusion matrix for plain image sensitivity |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |