Image encryption method, image decryption device, electronic device, and medium

文档序号:1964733 发布日期:2021-12-14 浏览:20次 中文

阅读说明:本技术 图像加密方法、图像解密方法、装置、电子设备和介质 (Image encryption method, image decryption device, electronic device, and medium ) 是由 董伯平 刘庆详 赵庆明 于 2021-09-29 设计创作,主要内容包括:本公开提供了一种图像加密方法、图像解密方法、装置、电子设备和介质,涉及图像加密技术领域。其中,图像加密方法包括:获取待加密图像的图像特征值;基于所述图像特征值生成可逆的执行加密矩阵;基于所述执行加密矩阵的行数和/或列数对所述待加密图像的像素矩阵进行分块,得到多个分块像素矩阵;将每个所述分块像素矩阵与所述执行加密矩阵进行相乘,得到多个加密分块;将所述多个加密分块基于分块的顺序进行组装,生成加密图像。通过本公开的技术方案,在保证加密操作的可靠性与加密图像的安全性,也简化了加密的实现过程并且容易操作。(The disclosure provides an image encryption method, an image decryption device, electronic equipment and a medium, and relates to the technical field of image encryption. The image encryption method comprises the following steps: acquiring an image characteristic value of an image to be encrypted; generating a reversible execution encryption matrix based on the image characteristic values; partitioning the pixel matrix of the image to be encrypted based on the row number and/or the column number of the executed encryption matrix to obtain a plurality of partitioned pixel matrices; multiplying each block pixel matrix with the execution encryption matrix to obtain a plurality of encryption blocks; and assembling the plurality of encrypted blocks based on the sequence of the blocks to generate an encrypted image. By the technical scheme, the reliability of encryption operation and the safety of an encrypted image are ensured, the implementation process of encryption is simplified, and the operation is easy.)

1. An image encryption method, comprising:

acquiring an image characteristic value of an image to be encrypted;

generating a reversible execution encryption matrix based on the image characteristic values;

partitioning the pixel matrix of the image to be encrypted based on the row number and/or the column number of the executed encryption matrix to obtain a plurality of partitioned pixel matrices;

multiplying each block pixel matrix with the execution encryption matrix to obtain a plurality of encryption blocks;

and assembling the plurality of encrypted blocks based on the sequence of the blocks to generate an encrypted image.

2. The image encryption method according to claim 1,

before generating a reversible execution encryption matrix based on the image characteristic value, the method further comprises the following steps:

presetting a reversible initial encryption matrix;

the generating of the reversible execution encryption matrix based on the image characteristic value specifically includes:

and executing mapping operation on the initial encryption matrix based on the image characteristic value to generate the execution encryption matrix.

3. The image encryption method according to claim 2, wherein the performing a mapping operation on the initial encryption matrix based on the image feature value to generate the execution encryption matrix specifically comprises:

and executing at least one of four arithmetic operations on the initial encryption matrix and the graphic characteristic value to execute mapping operation on the initial encryption matrix to obtain the executed encryption matrix.

4. The image encryption method according to claim 1, wherein the blocking the pixel matrix of the image to be encrypted based on the number of rows and/or columns of the encryption matrix to be executed to obtain a plurality of blocked pixel matrices specifically comprises:

dividing a pixel matrix of the image to be encrypted into the block pixel matrix having the same length and the same width as the execution encryption matrix,

and in the block pixel matrix with the blank area, performing character filling on the blank area based on a preset filling value.

5. The image encryption method according to any one of claims 1 to 4,

the image characteristic value is a pixel median value and/or a pixel mean value of the image to be encrypted.

6. An image decryption method, comprising:

acquiring an image characteristic value when an encrypted image is not encrypted;

generating a reversible execution encryption matrix based on the image characteristic values;

determining an inverse matrix of the execution encryption matrix as a decryption matrix;

partitioning the pixel matrix of the encrypted image based on the number of rows and/or columns of the executed encryption matrix to obtain a plurality of encrypted partitions;

multiplying each encrypted block by the decryption matrix to obtain a plurality of block pixel matrixes;

and assembling the plurality of block pixel matrixes based on the sequence of the blocks to generate a decrypted image.

7. The image decryption method of claim 6,

before generating a reversible execution encryption matrix based on the image characteristic value, the method further comprises the following steps:

acquiring a reversible initial encryption matrix;

the generating of the reversible execution encryption matrix based on the image characteristic value specifically includes:

and executing mapping operation on the initial encryption matrix based on the image characteristic value to generate the execution encryption matrix.

8. The image decryption method according to claim 7, wherein the mapping operation is performed on the initial encryption matrix based on the image feature value to generate the execution encryption matrix, and specifically comprises:

and executing at least one of four arithmetic operations on the initial encryption matrix and the graphic characteristic value to execute mapping operation on the initial encryption matrix to obtain the executed encryption matrix.

9. The image decryption method of claim 6, wherein assembling the plurality of block-wise pixel matrices based on an order of the blocks to generate the decrypted image, further comprises:

scanning a character fill area in the block pixel matrix based on the fill value;

and when the character filling area is scanned, deleting filling characters in the character filling area so as to assemble the block pixel matrix with the filling characters deleted.

10. The image decryption method according to any one of claims 6 to 9,

the image characteristic value is a pixel median value and/or a pixel mean value of the encrypted image when the encrypted image is not encrypted.

11. An image encryption apparatus characterized by comprising:

the acquisition module is used for acquiring the image characteristic value of the image to be encrypted;

the generating module is used for generating a reversible execution encryption matrix based on the image characteristic value;

the segmentation module is used for partitioning the pixel matrix of the image to be encrypted based on the row number and/or the column number of the executed encryption matrix to obtain a plurality of partitioned pixel matrices;

the encryption module is used for multiplying each block pixel matrix with the execution encryption matrix to obtain a plurality of encryption blocks;

and the combination module is used for assembling the plurality of encrypted blocks based on the sequence of the blocks to generate the encrypted image.

12. An image decryption apparatus, comprising:

the acquisition module is used for acquiring the image characteristic value when the encrypted image is not encrypted;

the generating module is used for generating a reversible execution encryption matrix based on the image characteristic value;

a determining module, configured to determine an inverse matrix of the execution encryption matrix as a decryption matrix;

a partitioning module, configured to block a pixel matrix of the encrypted image based on the number of rows and/or columns of the executed encryption matrix to obtain a plurality of encrypted blocks;

the decryption module is used for multiplying each encrypted block by the decryption matrix to obtain a plurality of block pixel matrixes;

and the combination module is used for assembling the plurality of block pixel matrixes based on the sequence of the blocks to generate a decrypted image.

13. An electronic device, comprising:

a processor; and

a memory for storing executable instructions of the processor;

wherein the processor is configured to perform the image encryption method of any of claims 1 to 5 and/or the image decryption method of any of claims 6 to 10 via execution of the executable instructions.

14. A computer-readable storage medium on which a computer program is stored, the computer program, when executed by a processor, implementing the image encryption method of any one of claims 1 to 5 and/or the image decryption method of any one of claims 6 to 10.

Technical Field

The present disclosure relates to the field of image encryption technologies, and in particular, to an image encryption method, an image decryption apparatus, an electronic device, and a storage medium.

Background

The method for encrypting the image transmission currently used comprises chaotic matrix encryption and the like, wherein the chaotic matrix encryption generates a plurality of groups of chaotic sequences by introducing inverse affine transformation on an integer domain and combining two-dimensional logistic chaotic mapping phases, and the chaotic sequences control the pixel scrambling transformation and gray value replacement to realize the image encryption.

It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.

Disclosure of Invention

The present disclosure is directed to an image encryption method, an image decryption apparatus, a storage medium, and an electronic device, which at least to some extent overcome the problem that the encryption and decryption processes in the related art are complex to implement.

Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.

According to an aspect of the present disclosure, there is provided an image encryption method including: acquiring an image characteristic value of an image to be encrypted; generating a reversible execution encryption matrix based on the image characteristic values; partitioning the pixel matrix of the image to be encrypted based on the row number and/or the column number of the executed encryption matrix to obtain a plurality of partitioned pixel matrices; multiplying each block pixel matrix with the execution encryption matrix to obtain a plurality of encryption blocks; and assembling the plurality of encrypted blocks based on the sequence of the blocks to generate an encrypted image.

In one embodiment, before generating the reversible execution encryption matrix based on the image feature value, the method further comprises: presetting a reversible initial encryption matrix; the generating of the reversible execution encryption matrix based on the image characteristic value specifically includes: and executing mapping operation on the initial encryption matrix based on the image characteristic value to generate the execution encryption matrix.

In an embodiment, the performing a mapping operation on the initial encryption matrix based on the image feature value to generate the execution encryption matrix specifically includes: and executing at least one of four arithmetic operations on the initial encryption matrix and the graphic characteristic value to execute mapping operation on the initial encryption matrix to obtain the executed encryption matrix.

In an embodiment, the blocking the pixel matrix of the image to be encrypted based on the number of rows and/or columns of the executed encryption matrix to obtain a plurality of blocked pixel matrices specifically includes: and dividing the pixel matrix of the image to be encrypted into the block pixel matrix with the same length and the same width as the encryption execution matrix, wherein in the block pixel matrix with the blank area, the blank area is subjected to character filling based on a preset filling value.

In one embodiment, the image feature value is a pixel median value and/or a pixel mean value of the image to be encrypted.

According to a second aspect of the present disclosure, there is provided an image decryption method comprising: acquiring an image characteristic value when an encrypted image is not encrypted; generating a reversible execution encryption matrix based on the image characteristic values; determining an inverse matrix of the execution encryption matrix as a decryption matrix; partitioning the pixel matrix of the encrypted image based on the number of rows and/or columns of the executed encryption matrix to obtain a plurality of encrypted partitions; multiplying each encrypted block by the decryption matrix to obtain a plurality of block pixel matrixes; and assembling the plurality of block pixel matrixes based on the sequence of the blocks to generate a decrypted image.

In one embodiment, before generating the reversible execution encryption matrix based on the image feature value, the method further comprises: acquiring a reversible initial encryption matrix; the generating of the reversible execution encryption matrix based on the image characteristic value specifically includes: and executing mapping operation on the initial encryption matrix based on the image characteristic value to generate the execution encryption matrix.

In an embodiment, the performing a mapping operation on the initial encryption matrix based on the image feature value to generate the execution encryption matrix specifically includes: and executing at least one of four arithmetic operations on the initial encryption matrix and the graphic characteristic value to execute mapping operation on the initial encryption matrix to obtain the executed encryption matrix.

In one embodiment, the assembling the plurality of block pixel matrices based on the order of the blocks to generate the decrypted image further includes: scanning a character fill area in the block pixel matrix based on the fill value; and when the character filling area is scanned, deleting filling characters in the character filling area so as to assemble the block pixel matrix with the filling characters deleted.

In one embodiment, the image feature value is a median and/or mean of pixels of the encrypted image when unencrypted.

According to a third aspect of the present disclosure, there is provided an image encryption apparatus comprising: the acquisition module is used for acquiring the image characteristic value of the image to be encrypted; the generating module is used for generating a reversible execution encryption matrix based on the image characteristic value; the segmentation module is used for partitioning the pixel matrix of the image to be encrypted based on the row number and/or the column number of the executed encryption matrix to obtain a plurality of partitioned pixel matrices; the encryption module is used for multiplying each block pixel matrix with the execution encryption matrix to obtain a plurality of encryption blocks; and the combination module is used for assembling the plurality of encrypted blocks based on the sequence of the blocks to generate the encrypted image.

According to a fourth aspect of the present disclosure, there is provided an image decryption apparatus comprising: the acquisition module is used for acquiring the image characteristic value when the encrypted image is not encrypted; the generating module is used for generating a reversible execution encryption matrix based on the image characteristic value; a determining module, configured to determine an inverse matrix of the execution encryption matrix as a decryption matrix; a partitioning module, configured to block a pixel matrix of the encrypted image based on the number of rows and/or columns of the executed encryption matrix to obtain a plurality of encrypted blocks; the decryption module is used for multiplying each encrypted block by the decryption matrix to obtain a plurality of block pixel matrixes; and the combination module is used for assembling the plurality of block pixel matrixes based on the sequence of the blocks to generate a decrypted image.

According to a fifth aspect of the present disclosure, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions for the processor; the processor is configured to perform the image encryption method and/or the image decryption method described above via execution of the executable instructions.

According to a sixth aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the image encryption method and/or the image decryption method described above.

According to the image encryption method provided by the embodiment of the disclosure, the characteristic value of the image to be encrypted is extracted, and the reversible execution encryption matrix is generated based on the characteristic value, and because different images to be encrypted have different characteristic values, different execution encryption matrixes can be used for encrypting different images, so that the dynamic generation of the encryption key is realized.

Further, the image to be encrypted is blocked based on the size of the execution encryption matrix to obtain a blocked pixel matrix, block encryption of the image to be encrypted is realized in a multiplication mode, the obtained encrypted blocks are assembled to obtain an encrypted image corresponding to the original matrix to be encrypted, and dynamic encryption of the image to be encrypted is realized.

It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.

FIG. 1 is a flow chart illustrating an image encryption method in an embodiment of the present disclosure;

FIG. 2 is a flow chart illustrating another image encryption method in an embodiment of the present disclosure;

FIG. 3 is a flow chart illustrating another image encryption method in an embodiment of the present disclosure;

FIG. 4 is a flow chart illustrating a further image decryption method in an embodiment of the present disclosure;

FIG. 5 is a flow chart illustrating a further image decryption method in an embodiment of the present disclosure;

FIG. 6 is a flow chart illustrating a further image decryption method in an embodiment of the present disclosure;

FIG. 7 is a flow chart of yet another image encryption and decryption method in the disclosed embodiment;

FIG. 8 shows a schematic diagram of a pixel matrix of an image to be encrypted in an embodiment of the disclosure;

fig. 9 shows a schematic diagram of a blocking pixel matrix for blocking the pixel matrix of the image to be encrypted in fig. 8 in the embodiment of the present disclosure;

FIG. 10 is a schematic diagram of an image encryption apparatus according to an embodiment of the disclosure;

FIG. 11 is a schematic diagram of an image decryption apparatus in an embodiment of the disclosure;

fig. 12 shows a block diagram of a computer device in an embodiment of the present disclosure.

Detailed Description

Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.

According to the scheme provided by the application, the image to be encrypted is blocked based on the size of the execution encryption matrix to obtain the blocked pixel matrix, the blocked encryption of the image to be encrypted is realized in a multiplication mode, the obtained encrypted blocks are assembled to obtain the original encrypted image corresponding to the matrix to be encrypted, and the dynamic encryption of the image to be encrypted is realized.

Hereinafter, each step of the image encryption method and the image decryption method in the present exemplary embodiment will be described in more detail with reference to the drawings and examples.

Fig. 1 shows a flowchart of an image encryption method in an embodiment of the present disclosure.

As shown in fig. 1, an image encryption method according to an embodiment of the present disclosure, applied to an image encryption side, includes the following steps:

step S102, obtaining the image characteristic value of the image to be encrypted.

The image characteristic value is used for representing the characteristic of the image to be encrypted, different images have different characteristics, and the image characteristic value can be one or more.

In one embodiment, the image feature value of the image to be encrypted is a pixel median value and/or a pixel mean value of a pixel point of the image to be encrypted.

In step S104, a reversible execution encryption matrix is generated based on the image feature value.

The reversible execution encryption matrix is generated based on the image characteristic value, so that the encryption mode of encrypting different images by using different execution encryption matrixes is realized.

Further, by generating a executable encryption matrix, the inverse matrix of the executable encryption matrix can be solved by an inverse operation for the image decryption process.

Specifically, performing the generation of the encryption matrix includes, but is not limited to, the following implementations:

when there are a plurality of image feature values, a reversible execution encryption matrix may be randomly generated based on the plurality of image feature values.

When there is one image characteristic value, the execution encryption matrix is obtained by performing specified operation between the image characteristic value and the initial encryption matrix, wherein the initial encryption matrix can be a fixed matrix or a randomly generated matrix.

And step S106, partitioning the pixel matrix of the image to be encrypted based on the row number and/or the column number of the encryption matrix to obtain a plurality of partitioned pixel matrices.

The encryption matrix may be a square matrix, that is, the number of rows and columns of the matrix is the same, or a matrix with different numbers of rows and columns.

The pixel matrix of the image to be encrypted is blocked based on the number of rows and/or columns of the execution encryption matrix, and the block can be performed based on the number of rows to obtain a square block, or the block is performed based on the number of columns to obtain a square block, or the block of the image to be encrypted is a block pixel matrix with the same size as the execution encryption matrix.

Step S108, multiplying each block pixel matrix with the execution encryption matrix to obtain a plurality of encryption blocks.

Wherein each block pixel matrix is multiplied by the execution encryption matrix to implement the encryption process.

In addition, it can be understood by those skilled in the art that addition, subtraction, division, or the like can be used instead of multiplication.

In step S110, a plurality of encrypted blocks are assembled in the order of blocks, and an encrypted image is generated.

In the embodiment, by extracting the characteristic value of the image to be encrypted and generating the reversible execution encryption matrix based on the characteristic value, different images to be encrypted have different characteristic values, so that different execution encryption matrixes can be used for encrypting different images, and dynamic generation of the encryption key is realized.

Further, the image to be encrypted is blocked based on the size of the execution encryption matrix to obtain a blocked pixel matrix, block encryption of the image to be encrypted is realized in a multiplication mode, the obtained encrypted blocks are assembled to obtain an encrypted image corresponding to the original matrix to be encrypted, and dynamic encryption of the image to be encrypted is realized.

As shown in fig. 2, an image encryption method according to another embodiment of the present disclosure includes the steps of:

step S202, a reversible initial encryption matrix is preset.

And step S204, acquiring the image characteristic value of the image to be encrypted.

And step S206, performing mapping operation on the initial encryption matrix based on the image characteristic value to generate a reversible execution encryption matrix.

As a preferred mapping manner, the initial encryption matrix may be divided by the image feature value, and the result may be kept in a fractional form to obtain an execution encryption matrix.

Step S208, the pixel matrix of the image to be encrypted is blocked based on the row number and/or the column number of the encryption matrix, and a plurality of blocked pixel matrices are obtained.

Step S210, multiplying each block pixel matrix by the execution encryption matrix to obtain a plurality of encrypted blocks.

In step S212, the plurality of encrypted blocks are assembled in the order of blocks, and an encrypted image is generated.

In the embodiment, the reversible initial encryption matrix is preset, and the mapping operation is performed on the initial encryption matrix based on the characteristic value to obtain the execution encryption matrix generated based on the characteristic value.

In one embodiment, in step S206, performing a mapping operation on the initial encryption matrix based on the image feature value to generate a reversible execution encryption matrix, specifically including:

and executing at least one of four arithmetic operations on the initial encryption matrix and the graphic characteristic value to execute mapping operation on the initial encryption matrix to obtain an execution encryption matrix.

It will be understood by those skilled in the art that at least one of the four arithmetic operations may be performed as any of addition, subtraction, multiplication and division, or in various combinations.

As shown in fig. 3, an image encryption method according to still another embodiment of the present disclosure includes the steps of:

step S302, a reversible initial encryption matrix is preset.

Step S304, obtaining the image characteristic value of the image to be encrypted.

And step S306, performing mapping operation on the initial encryption matrix based on the image characteristic value to generate a reversible execution encryption matrix.

Step S308, the pixel matrix of the image to be encrypted is divided into block pixel matrices having the same length and the same width as the execution encryption matrix.

Step S310, in the block pixel matrix with the blank area, character filling is carried out on the blank area based on a preset filling value.

Step S312, multiply each block pixel matrix with the execution encryption matrix to obtain a plurality of encrypted blocks.

In step S314, the plurality of encrypted blocks are assembled in the order of blocks, and an encrypted image is generated.

In this embodiment, if a generated block pixel matrix has empty rows or columns due to the size not reaching the size of the execution encryption matrix, padding is performed with 0 to ensure the reliability of block pixel matrix generation.

Fig. 4 shows a flowchart of an image decryption method in an embodiment of the present disclosure.

As shown in fig. 4, the image decryption method according to one embodiment of the present disclosure, applied to an image decryption side, includes the following steps:

in step S402, an image feature value is obtained when the encrypted image is not encrypted.

The image characteristic value can be obtained by sending the image sending end to the image receiving end.

In step S404, a reversible execution encryption matrix is generated based on the image feature value.

Wherein the performing encryption matrix is the same as the performing encryption matrix generated by the encryption process, as will be understood by those skilled in the art.

In step S406, the inverse matrix of the execution encryption matrix is determined as the decryption matrix.

Step S408, the pixel matrix of the encrypted image is blocked based on the number of rows and/or columns of the executed encryption matrix, resulting in a plurality of encrypted blocks.

Step S410, multiply each encrypted block by the decryption matrix to obtain a plurality of block pixel matrices.

In step S412, the plurality of block pixel matrices are assembled in the order of blocks, and a decrypted image is generated.

In this embodiment, by extracting the feature value of the unencrypted image and generating the decryption matrix based on the feature value, different decryption matrices can be used for different images to perform decryption due to different unencrypted images and different feature values, thereby realizing dynamic generation of the decryption key.

Further, the encrypted image is partitioned based on the size of the executed encryption matrix to obtain encrypted partitions, decryption of the encrypted partitions is achieved by multiplying each encrypted partition by the decryption matrix, the obtained partitioned pixel matrices are assembled to obtain a decrypted image, and dynamic decryption of the encrypted image is achieved.

As shown in fig. 5, an image decryption method according to another embodiment of the present disclosure, applied to an image decryption side, includes the following steps:

step S502, the image characteristic value and the reversible initial encryption matrix when the encrypted image is not encrypted are obtained.

And step S504, mapping the initial encryption matrix based on the image characteristic value to generate a reversible execution encryption matrix.

In step S506, the inverse matrix of the execution encryption matrix is determined as the decryption matrix.

Step S508, the pixel matrix of the encrypted image is blocked based on the number of rows and/or columns of the executed encryption matrix, resulting in a plurality of encrypted blocks.

Step S510, multiply each encrypted block by the decryption matrix to obtain a plurality of block pixel matrices.

Step S512, a plurality of block pixel matrices are assembled based on the sequence of blocks, and a decrypted image is generated.

In one embodiment, the mapping operation is performed on the initial encryption matrix based on the image feature value to generate a reversible execution encryption matrix, which specifically includes:

and executing at least one of four arithmetic operations on the initial encryption matrix and the graphic characteristic value to execute mapping operation on the initial encryption matrix to obtain an execution encryption matrix.

In this embodiment, at the decryption end, a preset initial encryption matrix is obtained, and the initial encryption matrix is subjected to mapping operation based on the characteristic value, so as to obtain an execution encryption matrix generated based on the characteristic value.

As shown in fig. 6, an image decryption method according to another embodiment of the present disclosure, applied to an image decryption side, includes the following steps:

step S602, the image characteristic value and the reversible initial encryption matrix when the encrypted image is not encrypted are obtained.

Step S604, mapping operation is carried out on the initial encryption matrix based on the image characteristic value, and a reversible execution encryption matrix is generated.

In step S606, the inverse matrix of the execution encryption matrix is determined as the decryption matrix.

Step S608, the pixel matrix of the encrypted image is blocked based on the number of rows and/or columns of the executed encryption matrix, resulting in a plurality of encrypted blocks.

Step S610, multiplying each encrypted block by the decryption matrix to obtain a plurality of block pixel matrices.

Step S612, scanning a character fill area in the block pixel matrix based on the fill value.

The acquisition of the character filling area can be realized by scanning operation, or by transmitting the filling area to the decryption end in an information manner by the encryption end.

In step S614, when the character filling area is scanned, the filling characters in the character filling area are deleted, so as to assemble the block pixel matrix from which the filling characters are deleted.

In one embodiment, the image feature values are pixel median values and/or pixel mean values of the encrypted image when the encrypted image is not encrypted.

In the embodiment, the reliability of the generation of the block pixel matrix in the decryption process is ensured by acquiring the filling area in the block pixel matrix and deleting the filling characters, so that the reliable decryption operation of the encrypted image is realized.

As shown in fig. 7, the whole process of image encryption and decryption according to an embodiment of the present disclosure, based on the interaction between the encryption side and the decryption side, includes the following steps:

at the image encryption end:

step S702, a reversible initial encryption matrix is preset.

Step S704, a pixel median of the image to be encrypted is obtained.

In step S706, the initial encryption matrix is divided by the pixel median (in the form of preserved fraction) to obtain an execution encryption matrix.

Step 708, the pixel matrix of the image to be encrypted is blocked according to the size of the executed encryption matrix, and a blocked pixel matrix is obtained.

Fig. 8 is a pixel matrix of an image to be encrypted.

Fig. 9 is a pixel matrix after block filling of an image to be encrypted according to the size of an executed encryption matrix, where the matrix size is 4 × 4.

Step S710, if the rows and columns in the block pixel matrix have blank areas, character filling is carried out on the blank areas based on preset filling values.

As shown in fig. 9, the pixel matrix of fig. 8 is partitioned by 4 x 4, and the edge rows and columns are filled with 0 if the pixel matrix edge does not satisfy 4 x 4 size, which is increased by 2 columns 0 and 1 row 0 compared to fig. 8.

Step S712, multiply each block pixel matrix with the execution encryption matrix to obtain a plurality of encrypted blocks.

In step S714, the plurality of encrypted blocks are assembled in the order of blocks, and an encrypted image is generated.

At the image decryption end:

in step S716, an image feature value and an initial encryption matrix are obtained.

In step S718, the initial encryption matrix is divided by the pixel median (in the form of preserved fraction) to obtain an execution encryption matrix.

In step S720, the inverse matrix of the execution encryption matrix is determined as the decryption matrix.

In step S722, the encrypted image is blocked according to the size of the execution encryption matrix, and an encrypted block is obtained.

Step S724, multiplying each encrypted block by the decryption matrix to obtain a plurality of block pixel matrices.

In step S726, the pad character in the block pixel matrix is deleted.

In step S728, the block pixel matrices from which the padding characters are deleted are assembled to obtain a decrypted image.

In the embodiment, the scheme disclosed by the invention has the advantages that the image data security is improved by encrypting different images by using different encryption matrixes, the scheme is simple and easy to operate, and the complexity of the encryption and decryption process is greatly reduced.

It is to be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the method according to an exemplary embodiment of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.

An image encryption apparatus 1000 according to an embodiment of the present invention is described below with reference to fig. 10. The image encryption apparatus 1000 shown in fig. 10 is only an example, and should not bring any limitation to the functions and the range of use of the embodiment of the present invention.

The image encryption apparatus 1000 is represented in the form of a hardware module. The components of the image encryption apparatus 1000 may include, but are not limited to: an obtaining module 1002, configured to obtain an image feature value of an image to be encrypted; a generating module 1004 for generating a reversible execution encryption matrix based on the image feature values; a partitioning module 1006, configured to partition a pixel matrix of the image to be encrypted based on the number of rows and/or columns of the executed encryption matrix to obtain a plurality of partitioned pixel matrices; an encryption module 1008, configured to multiply each of the block pixel matrices with the execution encryption matrix to obtain a plurality of encrypted blocks; a combining module 1010, configured to assemble the plurality of encrypted blocks based on the order of the blocks, and generate an encrypted image.

An image decryption apparatus 1100 according to an embodiment of the present invention is described below with reference to fig. 11. The image decryption apparatus 1100 shown in fig. 11 is only an example, and should not bring any limitation to the functions and the range of use of the embodiment of the present invention.

The image decryption apparatus 1100 is represented in the form of a hardware module. The components of the image decryption device 1100 may include, but are not limited to: an obtaining module 1102, configured to obtain an image feature value when an encrypted image is not encrypted; a generating module 1104, configured to generate a reversible execution encryption matrix based on the image feature value; a determining module 1106, configured to determine an inverse matrix of the execution encryption matrix as a decryption matrix; a partitioning module 1108, configured to block the pixel matrix of the encrypted image based on the number of rows and/or columns of the executed encryption matrix to obtain a plurality of encrypted blocks; a decryption module 1110, configured to multiply each encrypted partition by the decryption matrix to obtain a plurality of partition pixel matrices; a combining module 1112 for assembling the plurality of block pixel matrices based on the order of the blocks to generate a decrypted image.

As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.

An electronic device 1200 according to this embodiment of the invention is described below with reference to fig. 12. The electronic device may be an image encryption terminal or an image decryption terminal, and the electronic device 1200 shown in fig. 12 is only an example and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.

As shown in fig. 12, the electronic device 1200 is embodied in the form of a general purpose computing device. The components of the electronic device 1200 may include, but are not limited to: the at least one processing unit 1210, the at least one memory unit 1220, and a bus 1230 connecting the various system components including the memory unit 1220 and the processing unit 1210.

Wherein the memory unit stores program code that is executable by the processing unit 1210 such that the processing unit 1210 performs steps according to various exemplary embodiments of the present invention as described in the above section "exemplary methods" of the present specification. For example, the processing unit 1210 may perform the scheme described in step S202 to step S210 shown in fig. 2.

The storage unit 1220 may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM)12201 and/or a cache memory unit 12202, and may further include a read only memory unit (ROM) 12203.

Storage unit 1220 may also include a program/utility 12204 having a set (at least one) of program modules 12205, such program modules 12205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.

Bus 1230 may be one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

The electronic device 1200 may also communicate with one or more external devices 1270 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 1200, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 1200 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 1250. Also, the electronic device 1200 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via the network adapter 1260. As shown, the network adapter 1260 communicates with the other modules of the electronic device 1200 via the bus 1230. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.

Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.

In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, aspects of the invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the invention described in the above section "exemplary methods" of the present description, when said program product is run on the terminal device.

According to the program product for realizing the method, the portable compact disc read only memory (CD-ROM) can be adopted, the program code is included, and the program product can be operated on terminal equipment, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.

The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.

Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).

It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.

Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.

Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.

Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

21页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:图形处理器资源的使用方法及装置、电子设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!