Image encryption method, image decryption method, device, electronic device and medium
By generating a reversible execution encryption matrix based on image feature values, the image is encrypted and decrypted in blocks, and the problem of complex encryption and decryption in the prior art is solved, and a simple and easy-to-use image encryption and decryption operation is realized, and the reliability and security of encryption are ensured.
Patent Information
- Application Number
- CN202111152767.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2041-09-29
AI Technical Summary
In the prior art, the image encryption and decryption process is complicated, and a complex key string is required to be correctly decrypted, resulting in cumbersome operations.
By obtaining the image characteristic values of the image to be encrypted, a reversible execution encryption matrix is generated, and the image is encrypted and decrypted based on the matrix to achieve dynamic encryption and decryption.
The encryption and decryption process is simplified and the ease of operation is improved. At the same time, since the encryption key is generated based on image feature values, the reliability and security of encryption are ensured.
Smart Images

Figure CN113793245B_ABST
Abstract
Description
Background Art
[0002] Currently used methods for image transmission encryption include chaotic matrix encryption. Chaotic matrix encryption introduces the inverse affine transformation on the integer domain and combines it with the two-dimensional logistic chaotic mapping phase to generate multiple groups of chaotic sequences. These chaotic sequences are used to control pixel scrambling transformation and gray value replacement to achieve image encryption. Although it has good security, the encryption and decryption processes based on chaotic matrix encryption are relatively complicated and require relatively complex key strings to correctly decrypt.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The purpose of the present disclosure is to provide an image encryption method, an image decryption method, an apparatus, a storage medium and an electronic device, which at least to a certain extent overcome the problem that the implementation of the encryption and decryption processes in the related art is relatively complicated.
[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0006] According to one aspect of the present disclosure, there is provided an image encryption method, comprising: obtaining image eigenvalues of an image to be encrypted; generating a reversible execution encryption matrix based on the image eigenvalues; dividing the pixel matrix of the image to be encrypted into blocks based on the number of rows and / or columns of the execution encryption matrix to obtain a plurality of block pixel matrices; multiplying each of the block pixel matrices by the execution encryption matrix to obtain a plurality of encryption blocks; and assembling the plurality of encryption blocks based on the order of the blocks to generate an encrypted image.
[0007] In one embodiment, before generating a reversible execution encryption matrix based on the image eigenvalues, it also includes: presetting a reversible initial encryption matrix; generating a reversible execution encryption matrix based on the image eigenvalues specifically includes: performing a mapping operation on the initial encryption matrix based on the image eigenvalues to generate the execution encryption matrix.
[0008] In one embodiment, performing a mapping operation on the initial encryption matrix based on the image eigenvalues to generate the execution encryption matrix specifically includes: performing at least one of four arithmetic operations on the initial encryption matrix and the image eigenvalues to perform a mapping operation on the initial encryption matrix to obtain the execution encryption matrix.
[0009] In one embodiment, the pixel matrix of the image to be encrypted is divided into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of block pixel matrices, specifically comprising: dividing the pixel matrix of the image to be encrypted into the block pixel matrices with the same length and the same width as the encryption matrix, wherein, in the block pixel matrix having blank areas, the blank areas are filled with characters based on a preset filling value.
[0010] In one embodiment, the image feature value is a pixel median and / or pixel mean of the image to be encrypted.
[0011] According to a second aspect of the present disclosure, there is provided an image decryption method, comprising: obtaining image eigenvalues of an encrypted image when it is not encrypted; generating a reversible execution encryption matrix based on the image eigenvalues; determining the inverse matrix of the execution encryption matrix as a decryption matrix; dividing the pixel matrix of the encrypted image into blocks based on the number of rows and / or columns of the execution encryption matrix to obtain a plurality of encrypted blocks; multiplying each of the encrypted blocks by the decryption matrix to obtain a plurality of block pixel matrices; and assembling the plurality of block pixel matrices based on the order of the blocks to generate a decrypted image.
[0012] In one embodiment, before generating a reversible execution encryption matrix based on the image eigenvalues, it also includes: obtaining a reversible initial encryption matrix; the generating a reversible execution encryption matrix based on the image eigenvalues specifically includes: performing a mapping operation on the initial encryption matrix based on the image eigenvalues to generate the execution encryption matrix.
[0013] In one embodiment, performing a mapping operation on the initial encryption matrix based on the image eigenvalues to generate the execution encryption matrix specifically includes: performing at least one of four arithmetic operations on the initial encryption matrix and the image eigenvalues to perform a mapping operation on the initial encryption matrix to obtain the execution encryption matrix.
[0014] In one embodiment, assembling the multiple block pixel matrices based on the order of blocks to generate a decrypted image also includes: scanning a character filling area in the block pixel matrix based on a preset filling value; when scanning the character filling area, deleting the filling characters in the character filling area to assemble the block pixel matrix with the filling characters deleted.
[0015] In one embodiment, the image feature value is a pixel median and / or pixel mean of the encrypted image when it is not encrypted.
[0016] According to a third aspect of the present disclosure, there is provided an image encryption device, comprising: an acquisition module, used to acquire image characteristic values of an image to be encrypted; a generation module, used to generate a reversible execution encryption matrix based on the image characteristic values; a segmentation module, used to divide the pixel matrix of the image to be encrypted into blocks based on the number of rows and / or columns of the execution encryption matrix to obtain a plurality of block pixel matrices; an encryption module, used to multiply each of the block pixel matrices with the execution encryption matrix to obtain a plurality of encrypted blocks; and a combination module, used to assemble the plurality of encrypted blocks based on the order of the blocks to generate an encrypted image.
[0017] According to a fourth aspect of the present disclosure, there is provided an image decryption device, comprising: an acquisition module, for acquiring image feature values of an encrypted image when it is not encrypted; a generation module, for generating a reversible execution encryption matrix based on the image feature values; a determination module, for determining the inverse matrix of the execution encryption matrix as a decryption matrix; a segmentation module, for dividing the pixel matrix of the encrypted image into blocks based on the number of rows and / or columns of the execution encryption matrix to obtain a plurality of encrypted blocks; a decryption module, for multiplying each of the encrypted blocks with the decryption matrix to obtain a plurality of block pixel matrices; and a combination module, for assembling the plurality of block pixel matrices based on the order of the blocks to generate a decrypted image.
[0018] According to a fifth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; the processor is configured to execute the above-mentioned image encryption method and / or image decryption method by executing the executable instructions.
[0019] According to a sixth aspect of the present disclosure, there is provided a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned image encryption method and / or image decryption method is implemented.
[0020] The image encryption method provided by the embodiments of the present disclosure extracts the eigenvalues of the image to be encrypted and generates a reversible execution encryption matrix based on the eigenvalues. Since different images to be encrypted have different eigenvalues, different execution encryption matrices can be used to encrypt different images, thereby realizing the dynamic generation of encryption keys.
[0021] Furthermore, the image to be encrypted is divided into blocks based on the size of the execution encryption matrix to obtain a block pixel matrix, and the block encryption of the image to be encrypted is realized by multiplication. The obtained encrypted blocks are assembled to obtain the encrypted image corresponding to the original matrix to be encrypted, thereby realizing dynamic encryption of the image to be encrypted. On the one hand, since the execution encryption matrix as the encryption key is generated based on the eigenvalue of the image to be encrypted, the reliability of the encryption operation and the security of the encrypted image are guaranteed. On the other hand, the encryption process of the image encryption scheme disclosed in the present invention is also simple and easy to operate. As long as the above-mentioned eigenvalue is obtained, the decryption operation of the encrypted image can be performed.
[0022] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0024] Figure 1 A flow chart of an image encryption method in an embodiment of the present disclosure is shown;
[0025] Figure 2 Another image encryption method flow chart in the embodiment of the present disclosure is shown;
[0026] Figure 3 Another image encryption method flow chart in the embodiment of the present disclosure is shown;
[0027] Figure 4 A flowchart of another image decryption method in an embodiment of the present disclosure is shown;
[0028] Figure 5 A flowchart of another image decryption method in an embodiment of the present disclosure is shown;
[0029] Figure 6 A flowchart of another image decryption method in an embodiment of the present disclosure is shown;
[0030] Figure 7 A flowchart of another image encryption and decryption method in an embodiment of the present disclosure is shown;
[0031] Figure 8 A schematic diagram showing a pixel matrix of an image to be encrypted in an embodiment of the present disclosure;
[0032] Fig. 9 The embodiment of the present disclosure shows Figure 8 A schematic diagram of a pixel matrix of blocks in which the pixel matrix of the image to be encrypted is divided into blocks;
[0033] Fig.10 A schematic diagram of an image encryption device in an embodiment of the present disclosure is shown;
[0034] Fig.11 A schematic diagram of an image decryption device in an embodiment of the present disclosure is shown;
[0035] Fig.12 A structural block diagram of a computer device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0036] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the 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.
[0037] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0038] The solution provided by the present application divides the image to be encrypted into blocks based on the size of the execution encryption matrix to obtain a block pixel matrix, and implements block encryption of the image to be encrypted by multiplication. The obtained encrypted blocks are assembled to obtain the encrypted image corresponding to the original matrix to be encrypted, thereby implementing dynamic encryption of the image to be encrypted. On the one hand, since the execution encryption matrix as the encryption key is generated based on the eigenvalue of the image to be encrypted, the reliability of the encryption operation and the security of the encrypted image are guaranteed. On the other hand, the encryption process of the image encryption scheme disclosed in the present application is also simple and easy to operate. As long as the above-mentioned eigenvalues are obtained, the decryption operation of the encrypted image can be performed.
[0039] Hereinafter, each step of the image encryption method and the image decryption method in this example implementation will be described in more detail with reference to the accompanying drawings and embodiments.
[0040] Figure 1 A flow chart of an image encryption method in an embodiment of the present disclosure is shown.
[0041] like Figure 1 As shown, according to an embodiment of the present disclosure, an image encryption method is applied to an image encryption end and includes the following steps:
[0042] Step S102, obtaining image feature values of the image to be encrypted.
[0043] The image feature value is used to represent the feature of the image to be encrypted. Different images have different features. The image feature value may be one or more.
[0044] In one embodiment, the image feature value of the image to be encrypted is the pixel median and / or pixel mean of the pixel points of the image to be encrypted.
[0045] Step S104: Generate a reversible execution encryption matrix based on the image eigenvalues.
[0046] Among them, a reversible execution encryption matrix is generated based on the image eigenvalue, and an encryption method of using different execution encryption matrices to encrypt different images is realized.
[0047] Furthermore, by generating an executable encryption matrix, the inverse matrix of the executable encryption matrix can be solved through inverse operation and used in the image decryption process.
[0048] Specifically, the generation of the encryption matrix includes but is not limited to the following implementations:
[0049] When there are multiple image eigenvalues, a reversible execution encryption matrix can be randomly generated based on the multiple image eigenvalues.
[0050] When there is one image eigenvalue, a specified operation is performed between the image eigenvalue and the initial encryption matrix to obtain an execution encryption matrix, wherein the initial encryption matrix can be a fixed matrix or a randomly generated matrix.
[0051] Step S106, dividing the pixel matrix of the image to be encrypted into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of block pixel matrices.
[0052] The encryption execution 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.
[0053] The pixel matrix of the image to be encrypted is divided into blocks based on the number of rows and / or columns of the encryption matrix. The blocks can be divided based on the number of rows to obtain square blocks, or based on the number of columns to obtain square blocks, or the image to be encrypted can be divided into block pixel matrices of the same size as the encryption matrix.
[0054] Step S108, multiplying each block pixel matrix by the execution encryption matrix to obtain multiple encrypted blocks.
[0055] Among them, each block pixel matrix is multiplied by the execution encryption matrix to realize the encryption process.
[0056] In addition, those skilled in the art will appreciate that addition, subtraction or division algorithms may be used instead of multiplication operations.
[0057] Step S110, assembling multiple encrypted blocks based on the order of the blocks to generate an encrypted image.
[0058] In this embodiment, the eigenvalues of the image to be encrypted are extracted, and a reversible execution encryption matrix is generated based on the eigenvalues. Since different images to be encrypted have different eigenvalues, different execution encryption matrices can be used to encrypt different images, thereby realizing dynamic generation of encryption keys.
[0059] Furthermore, the image to be encrypted is divided into blocks based on the size of the execution encryption matrix to obtain a block pixel matrix, and the block encryption of the image to be encrypted is realized by multiplication. The obtained encrypted blocks are assembled to obtain the encrypted image corresponding to the original matrix to be encrypted, thereby realizing dynamic encryption of the image to be encrypted. On the one hand, since the execution encryption matrix as the encryption key is generated based on the eigenvalue of the image to be encrypted, the reliability of the encryption operation and the security of the encrypted image are guaranteed. On the other hand, the encryption process of the image encryption scheme disclosed in the present invention is also simple and easy to operate. As long as the above-mentioned eigenvalue is obtained, the decryption operation of the encrypted image can be performed.
[0060] like Figure 2 As shown, according to another embodiment of the present disclosure, the image encryption method includes the following steps:
[0061] Step S202, preset a reversible initial encryption matrix.
[0062] Step S204, obtaining image feature values of the image to be encrypted.
[0063] Step S206: Perform a mapping operation on the initial encryption matrix based on the image eigenvalues to generate a reversible execution encryption matrix.
[0064] As a preferred mapping method, the initial encryption matrix can be divided by the above-mentioned image eigenvalues, and the result can be kept in fractional form to obtain the execution encryption matrix.
[0065] Step S208, dividing the pixel matrix of the image to be encrypted into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of block pixel matrices.
[0066] Step S210, multiplying each block pixel matrix by the execution encryption matrix to obtain multiple encrypted blocks.
[0067] Step S212, assembling multiple encrypted blocks based on the order of the blocks to generate an encrypted image.
[0068] In this embodiment, a reversible initial encryption matrix is preset, and a mapping operation is performed on the initial encryption matrix based on the eigenvalue to obtain an execution encryption matrix generated based on the eigenvalue. This method can embed the eigenvalue into the execution encryption matrix while making the generation process of the execution encryption matrix easy to implement and highly reliable.
[0069] In one embodiment, in step S206, a mapping operation is performed on the initial encryption matrix based on the image eigenvalue to generate a reversible execution encryption matrix, which specifically includes:
[0070] At least one of four arithmetic operations is performed on the initial encryption matrix and the image eigenvalue to perform a mapping operation on the initial encryption matrix to obtain an execution encryption matrix.
[0071] Those skilled in the art will appreciate that performing at least one of the four arithmetic operations may be any one of addition, subtraction, multiplication and division, or a combination of the above.
[0072] like Figure 3 As shown, according to another embodiment of the present disclosure, the image encryption method includes the following steps:
[0073] Step S302: preset a reversible initial encryption matrix.
[0074] Step S304: obtaining image feature values of the image to be encrypted.
[0075] Step S306: Perform a mapping operation on the initial encryption matrix based on the image eigenvalues to generate a reversible execution encryption matrix.
[0076] Step S308: dividing the pixel matrix of the image to be encrypted into block pixel matrices with the same length and width as the matrix to be encrypted.
[0077] Step S310: In a block pixel matrix having blank areas, characters are filled in the blank areas based on a preset filling value.
[0078] Step S312, multiplying each block pixel matrix by the execution encryption matrix to obtain multiple encrypted blocks.
[0079] Step S314, assembling multiple encrypted blocks based on the order of the blocks to generate an encrypted image.
[0080] In this embodiment, if the size of the generated block pixel matrix does not reach the size of the encryption matrix and thus there are blank rows or columns, padding is performed with 0 to ensure the reliability of the generation of the block pixel matrix.
[0081] Figure 4 A flow chart of an image decryption method in an embodiment of the present disclosure is shown.
[0082] like Figure 4 As shown, according to an embodiment of the present disclosure, an image decryption method is applied to an image decryption end and includes the following steps:
[0083] Step S402, obtaining the image feature value of the encrypted image when it is not encrypted.
[0084] The image feature value may be obtained by sending the image feature value from the image sending end to the image receiving end.
[0085] Step S404: Generate a reversible execution encryption matrix based on the image eigenvalues.
[0086] Among them, those skilled in the art can understand that the execution encryption matrix is the same as the execution encryption matrix generated by the encryption process.
[0087] Step S406: determine the inverse matrix of the encryption matrix as the decryption matrix.
[0088] Step S408, dividing the pixel matrix of the encrypted image into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of encryption blocks.
[0089] Step S410, multiply each encrypted block by the decryption matrix to obtain multiple block pixel matrices.
[0090] Step S412, assembling multiple block pixel matrices based on the order of blocks to generate a decrypted image.
[0091] In this embodiment, the eigenvalues of the unencrypted image are extracted, and a decryption matrix is generated based on the eigenvalues. Since different unencrypted images have different eigenvalues, different decryption matrices can be used for decryption of different images, thereby realizing dynamic generation of decryption keys.
[0092] Furthermore, the encrypted image is divided into blocks based on the size of the execution encryption matrix to obtain encrypted blocks, and the encrypted blocks are decrypted by multiplying each encrypted block with the decryption matrix. The obtained block pixel matrix is assembled to obtain the decrypted image, thereby realizing dynamic decryption of the encrypted image. On the one hand, since the execution encryption matrix as the decryption key is generated based on the eigenvalue of the encrypted image, the reliability of the decryption operation is guaranteed. On the other hand, the decryption operation of the image decryption scheme disclosed in the present invention can be performed as long as the above-mentioned eigenvalue is obtained, so it is highly feasible and practical.
[0093] like Figure 5 As shown, according to another embodiment of the present disclosure, an image decryption method is applied to an image decryption end and includes the following steps:
[0094] Step S502, obtaining the image feature value of the unencrypted encrypted image and the reversible initial encryption matrix.
[0095] Step S504: performing a mapping operation on the initial encryption matrix based on the image eigenvalues to generate a reversible execution encryption matrix.
[0096] Step S506: determine the inverse matrix of the encryption matrix as the decryption matrix.
[0097] Step S508, dividing the pixel matrix of the encrypted image into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of encryption blocks.
[0098] Step S510, multiply each encrypted block by the decryption matrix to obtain multiple block pixel matrices.
[0099] Step S512, assembling multiple block pixel matrices based on the order of blocks to generate a decrypted image.
[0100] In one embodiment, a mapping operation is performed on the initial encryption matrix based on the image eigenvalue to generate a reversible execution encryption matrix, specifically including:
[0101] At least one of four arithmetic operations is performed on the initial encryption matrix and the image eigenvalue to perform a mapping operation on the initial encryption matrix to obtain an execution encryption matrix.
[0102] In this embodiment, at the decryption end, by obtaining a preset initial encryption matrix and performing a mapping operation on the initial encryption matrix based on the eigenvalue, an execution encryption matrix generated based on the eigenvalue is obtained. This method can embed the eigenvalue into the execution encryption matrix while making the generation process of the execution encryption matrix easy to implement and highly reliable.
[0103] like Figure 6As shown, according to another embodiment of the present disclosure, an image decryption method is applied to an image decryption end and includes the following steps:
[0104] Step S602, obtaining the image eigenvalues of the unencrypted encrypted image and a reversible initial encryption matrix.
[0105] Step S604: performing a mapping operation on the initial encryption matrix based on the image eigenvalues to generate a reversible execution encryption matrix.
[0106] Step S606: determine the inverse matrix of the encryption matrix as the decryption matrix.
[0107] Step S608, dividing the pixel matrix of the encrypted image into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of encrypted blocks.
[0108] Step S610, multiply each encrypted block by the decryption matrix to obtain multiple block pixel matrices.
[0109] Step S612, scanning the character filling area in the block pixel matrix based on the filling value.
[0110] The acquisition of the character filling area may be achieved through a scanning operation, or may be achieved by transmitting the filling area from the encryption end to the decryption end in the form of information.
[0111] Step S614, when the character filling area is scanned, the filling characters in the character filling area are deleted to assemble the block pixel matrix with the filling characters deleted.
[0112] In one embodiment, the image feature value is a pixel median and / or pixel mean when the encrypted image is not encrypted.
[0113] In this embodiment, the filling area in the block pixel matrix is obtained and the filling characters are deleted to ensure the reliability of the generation of the block pixel matrix during the decryption process, thereby achieving a reliable decryption operation of the encrypted image.
[0114] like Figure 7 As shown, the whole process of image encryption and decryption according to an embodiment of the present disclosure, based on the interactive operation between the encryption end and the decryption end, includes the following steps:
[0115] On the image encryption side:
[0116] Step S702: preset a reversible initial encryption matrix.
[0117] Step S704, obtaining the pixel median of the image to be encrypted.
[0118] Step S706, dividing the initial encryption matrix by the pixel median (keeping the fractional form) to obtain the execution encryption matrix.
[0119] Step S708, dividing the pixel matrix of the image to be encrypted into blocks according to the size of the encryption matrix to obtain a block pixel matrix.
[0120] Figure 8 is the pixel matrix of the image to be encrypted.
[0121] Fig. 9 It is the pixel matrix after the encrypted image is divided into blocks and filled according to the size of the encryption matrix. The matrix size is 4*4.
[0122] Step S710: If there are blank areas in the rows and columns of the block pixel matrix, fill the blank areas with characters based on a preset filling value.
[0123] like Fig. 9 As shown, Figure 8 The pixel matrix in the example is divided into 4*4 blocks. If the pixel matrix edge does not meet the 4*4 size, the edge rows and columns are filled with 0. Figure 8 Compared to , 2 column 0s and 1 row 0 are added.
[0124] Step S712, multiplying each block pixel matrix by the execution encryption matrix to obtain multiple encrypted blocks.
[0125] Step S714, assembling multiple encrypted blocks based on the order of the blocks to generate an encrypted image.
[0126] On the image decryption side:
[0127] Step S716, obtaining image eigenvalues and an initial encryption matrix.
[0128] Step S718, dividing the initial encryption matrix by the pixel median (keeping the fractional form) to obtain the execution encryption matrix.
[0129] Step S720: determine the inverse matrix of the encryption matrix as the decryption matrix.
[0130] Step S722, dividing the encrypted image into blocks according to the size of the encryption matrix to obtain encrypted blocks.
[0131] Step S724, multiply each encrypted block with the decryption matrix to obtain multiple block pixel matrices.
[0132] Step S726, deleting the filling characters in the block pixel matrix.
[0133] Step S728, assembling the block pixel matrix with the padding characters deleted to obtain a decrypted image.
[0134] In this embodiment, the solution disclosed in the present invention improves the security of image data by using different encryption matrices to encrypt different images. In addition, the solution is simple and easy to operate, which greatly reduces the complexity of the encryption and decryption process.
[0135] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0136] Refer to the following Fig.10 The image encryption device 1000 according to the embodiment of the present invention will be described. Fig.10 The image encryption device 1000 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0137] The image encryption device 1000 is in the form of a hardware module. The components of the image encryption device 1000 may include but are not limited to: an acquisition module 1002, used to acquire the image feature value of the image to be encrypted; a generation module 1004, used to generate a reversible execution encryption matrix based on the image feature value; a segmentation module 1006, used to block the pixel matrix of the image to be encrypted based on the number of rows and / or columns of the execution encryption matrix to obtain multiple block pixel matrices; an encryption module 1008, used to multiply each of the block pixel matrices with the execution encryption matrix to obtain multiple encrypted blocks; a combination module 1010, used to assemble the multiple encrypted blocks based on the order of the blocks to generate an encrypted image.
[0138] Refer to the following Fig.11 The image decryption device 1100 according to the embodiment of the present invention will be described. Fig.11 The image decryption device 1100 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0139] The image decryption device 1100 is in the form of a hardware module. The components of the image decryption device 1100 may include but are not limited to: an acquisition module 1102, used to obtain the image feature value of the encrypted image when it is not encrypted; a generation module 1104, used to generate a reversible execution encryption matrix based on the image feature value; a determination module 1106, used to determine the inverse matrix of the execution encryption matrix as the decryption matrix; a segmentation module 1108, used to block the pixel matrix of the encrypted image based on the number of rows and / or columns of the execution encryption matrix to obtain multiple encrypted blocks; a decryption module 1110, used to multiply each of the encrypted blocks with the decryption matrix to obtain multiple block pixel matrices; a combination module 1112, used to assemble the multiple block pixel matrices based on the order of the blocks to generate a decrypted image.
[0140] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0141] Refer to the following Fig.12 The electronic device 1200 according to this embodiment of the present invention is described below. The electronic device may be an image encryption terminal or an image decryption terminal. Fig.12 The electronic device 1200 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0142] like Fig.12 As shown, the electronic device 1200 is in the form of a general computing device. The components of the electronic device 1200 may include but are not limited to: at least one processing unit 1210, at least one storage unit 1220, and a bus 1230 connecting different system components (including the storage unit 1220 and the processing unit 1210).
[0143] The storage unit stores program codes, which can be executed by the processing unit 1210, so that the processing unit 1210 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1210 can perform the following steps: Figure 2 The scheme described in steps S202 to S210 shown in FIG.
[0144] The storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 12201 and / or a cache storage unit 12202 , and may further include a read-only storage unit (ROM) 12203 .
[0145] The 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 may include an implementation of a network environment.
[0146] Bus 1230 may represent 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.
[0147] The electronic device 1200 may also communicate with one or more external devices 1270 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1200, and / or communicate with any device that enables the electronic device 1200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1250. In addition, the electronic device 1200 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1260. As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via a bus 1230. It should be understood that, although not shown in the figure, 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.
[0148] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0149] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0150] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0151] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0152] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0153] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0154] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type 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).
[0155] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0156] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0157] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0158] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. An image encryption method, characterized in that: include: Obtain image feature values of the image to be encrypted; Generating a reversible execution encryption matrix based on the image eigenvalues, comprising: performing at least one of four arithmetic operations on a preset initial encryption matrix and the image eigenvalues to perform a mapping operation on the initial encryption matrix to obtain the execution encryption matrix; Dividing the pixel matrix of the image to be encrypted into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of divided pixel matrices; Multiplying each of the block pixel matrices by the execution encryption matrix to obtain a plurality of encryption blocks; The plurality of encrypted blocks are assembled based on the order of the blocks to generate an encrypted image.
2. The image encryption method according to claim 1, characterized in that: Before generating a reversible execution encryption matrix based on the image feature value, the method further includes: Preset reversible initial encryption matrix.
3. The image encryption method according to claim 1, characterized in that: The step of dividing the pixel matrix of the image to be encrypted into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of block pixel matrices specifically includes: The pixel matrix of the image to be encrypted is divided into the block pixel matrices having the same length and width as the encryption matrix. Wherein, in the block pixel matrix having blank areas, characters are filled in the blank areas based on a preset filling value.
4. The image encryption method according to any one of claims 1 to 3, characterized in that: The image feature value is a pixel median and / or pixel mean of the image to be encrypted.
5. An image decryption method, characterized in that: include: Get the image feature value of the encrypted image when it is not encrypted; Generating a reversible execution encryption matrix based on the image eigenvalue, comprising performing at least one of four arithmetic operations on a preset initial encryption matrix and the image eigenvalue to perform a mapping operation on the initial encryption matrix to obtain the execution encryption matrix; Determine the inverse matrix of the execution encryption matrix as a decryption matrix; Dividing the pixel matrix of the encrypted image into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of encrypted blocks; Multiplying each of the encrypted blocks with the decryption matrix to obtain a plurality of block pixel matrices; The plurality of block pixel matrices are assembled based on the order of the blocks to generate a decrypted image.
6. The image decryption method according to claim 5, characterized in that: Before generating a reversible execution encryption matrix based on the image feature value, the method further includes: Get the reversible initial encryption matrix.
7. The image decryption method according to claim 5, characterized in that: The step of assembling the plurality of block pixel matrices based on the order of the blocks to generate a decrypted image further includes: Scanning a character filling area in the block pixel matrix based on a preset filling value; When the character filling area is scanned, the filling characters in the character filling area are deleted to assemble the block pixel matrix with the filling characters deleted.
8. The image decryption method according to any one of claims 5 to 7, characterized in that: The image feature value is a pixel median and / or pixel mean when the encrypted image is not encrypted.
9. An image encryption device, characterized in that: include: An acquisition module, used for acquiring image feature values of the image to be encrypted; A generating module, configured to generate a reversible execution encryption matrix based on the image eigenvalue, comprising: performing at least one of four arithmetic operations on a preset initial encryption matrix and the image eigenvalue to perform a mapping operation on the initial encryption matrix to obtain the execution encryption matrix; A segmentation module, used for dividing the pixel matrix of the image to be encrypted into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of block pixel matrices; An encryption module, used for multiplying each of the block pixel matrices by the execution encryption matrix to obtain a plurality of encrypted blocks; The combination module is used to assemble the multiple encrypted blocks based on the order of the blocks to generate an encrypted image.
10. An image decryption device, characterized in that: include: An acquisition module, used for acquiring image feature values of an encrypted image when it is not encrypted; A generating module, configured to generate a reversible execution encryption matrix based on the image eigenvalue, comprising: performing at least one of four arithmetic operations on a preset initial encryption matrix and the image eigenvalue to perform a mapping operation on the initial encryption matrix to obtain the execution encryption matrix; A determination module, used to determine the inverse matrix of the execution encryption matrix as a decryption matrix; A segmentation module, used for dividing the pixel matrix of the encrypted image into blocks based on the number of rows and / or columns of the encryption matrix to obtain a plurality of encrypted blocks; A decryption module, used for multiplying each of the encrypted blocks with the decryption matrix to obtain a plurality of block pixel matrices; The combination module is used to assemble the multiple block pixel matrices based on the order of the blocks to generate a decrypted image.
11. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the image encryption method described in any one of claims 1 to 4 and / or the image decryption method described in any one of claims 5 to 8 by executing the executable instructions.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image encryption method described in any one of claims 1 to 4 and / or the image decryption method described in any one of claims 5 to 8 are implemented.