CN117714613A - Image encryption method and device, electronic equipment and storage medium - Google Patents
Image encryption method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117714613A CN117714613A CN202311694479.9A CN202311694479A CN117714613A CN 117714613 A CN117714613 A CN 117714613A CN 202311694479 A CN202311694479 A CN 202311694479A CN 117714613 A CN117714613 A CN 117714613A
- Authority
- CN
- China
- Prior art keywords
- image
- encrypted
- dna
- algorithm
- determining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 230000000739 chaotic effect Effects 0.000 claims abstract description 86
- 239000011159 matrix material Substances 0.000 claims abstract description 72
- 238000013507 mapping Methods 0.000 claims abstract description 30
- 238000004458 analytical method Methods 0.000 claims description 12
- 238000006243 chemical reaction Methods 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 5
- 238000013501 data transformation Methods 0.000 claims description 5
- 108020004414 DNA Proteins 0.000 description 68
- 102000053602 DNA Human genes 0.000 description 68
- 230000003287 optical effect Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 238000009792 diffusion process Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 108091028043 Nucleic acid sequence Proteins 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012549 training Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/44—Secrecy systems
- H04N1/448—Rendering the image unintelligible, e.g. scrambling
- H04N1/4486—Rendering the image unintelligible, e.g. scrambling using digital data encryption
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/001—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using chaotic signals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/46—Colour picture communication systems
- H04N1/56—Processing of colour picture signals
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Storage Device Security (AREA)
Abstract
The embodiment of the invention discloses an image encryption method, an image encryption device, electronic equipment and a storage medium. The method comprises the following steps: acquiring an image to be encrypted, and obtaining an external key and 3 color matrixes of the image to be encrypted based on the image to be encrypted; determining a key matrix of an image to be encrypted based on an external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping; and determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix. The method can combine the chaotic encryption algorithm and the DNA code to encrypt the image, improves the randomness and the safety of the image encryption, further ensures that the image information of the user cannot be leaked, improves the efficiency of the image encryption and improves the user experience.
Description
Technical Field
The embodiment of the invention relates to the field of image processing, in particular to an image encryption method, an image encryption device, electronic equipment and a storage medium.
Background
Image encryption is a technology for protecting the security and privacy of image data, and by performing encryption conversion on an image, unauthorized persons cannot acquire the content of the image. The image encryption technology has important application in the fields of information security, privacy protection and the like, and can effectively protect confidentiality and integrity of image data. In the financial industry, for example, information security is a critical issue for banks; for clients, when a bank provides services for the clients, accuracy, reliability and safety of provided information must be ensured. The bank information data not only comprises various core business reports, customer relation data and other text formats, but also comprises image formats with larger data volume, and the information is rarely encrypted before information transmission on various systems of the bank. When this important information is once hacked, it may cause a huge loss to the bank. Therefore, a secure and reliable image encryption algorithm is needed to secure customer information.
The existing image encryption method generally adopts only a single DNA code, algorithm and the like to encrypt the image. The image encryption algorithm cannot resist clear text attack and has single type in DNA coding encryption operation, so that the randomness and safety of the encrypted image of the encryption algorithm are insufficient, the encrypted image has low safety and is easy to attack, and the efficiency of image encryption is reduced.
Disclosure of Invention
The image encryption method, the device, the electronic equipment and the storage medium can combine the chaotic encryption algorithm and the DNA code to encrypt the image, so that the randomness and the safety of the image encryption are improved, the image information of a user is further ensured not to be leaked, the image encryption efficiency is improved, and the user experience is improved.
In a first aspect, an embodiment of the present invention provides an image encryption method, including:
acquiring an image to be encrypted, and obtaining an external key and 3 color matrixes of the image to be encrypted based on the image to be encrypted;
determining a key matrix of the image to be encrypted based on the external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping;
and determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix.
In a second aspect, an embodiment of the present invention further provides an image encryption apparatus, including:
the image acquisition module is used for acquiring an image to be encrypted and obtaining an external secret key and 3 color matrixes of the image to be encrypted based on the image to be encrypted;
the matrix determining module is used for determining a key matrix of the image to be encrypted based on the external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping;
and the image encryption module is used for determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement an image encryption method as provided by any embodiment of the present invention.
In a fourth aspect, embodiments of the present invention further provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements an image encryption method as provided by any of the embodiments of the present invention.
In the embodiment of the invention, an image to be encrypted is obtained, and an external secret key and 3 color matrixes of the image to be encrypted are obtained based on the image to be encrypted; determining a key matrix of an image to be encrypted based on an external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping; and determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix. In the embodiment of the invention, the chaotic encryption algorithm and the DNA code can be combined to encrypt the image, so that the randomness and the safety of the image encryption are improved, the image information of a user is further ensured not to be leaked, the image encryption efficiency is improved, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a first flowchart of an image encryption method according to an embodiment of the present invention;
FIG. 2 is a second flowchart of an image encryption method provided by an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an image encryption device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a first flowchart of an image encryption method provided by the embodiment of the invention, and the method of the embodiment can combine a chaotic encryption algorithm and DNA encoding to encrypt an image, thereby improving the randomness and the security of image encryption, further ensuring that the image information of a user cannot be leaked, improving the efficiency of image encryption and improving the user experience.
The method may be performed by the image encryption apparatus in the embodiment of the present invention, and the apparatus may be integrated in an electronic device, which may be a server, and the method may be implemented in software and/or hardware. The image encryption method provided by the embodiment specifically comprises the following steps:
step 101, obtaining an image to be encrypted, and obtaining an external key and 3 color matrixes of the image to be encrypted based on the image to be encrypted.
Wherein the image to be encrypted is an image that needs to be encrypted, such as an authentication image for authenticating the identity of the user, etc. The external key is a key for encrypting the image to be encrypted according to HMAC-SHA256 (Hash-based Message Authentication Code with SHA-256) algorithm, which is set according to the size of the image to be encrypted, the actual operating environment, and the like. The external key may be a key of any length, and in practical applications, it is recommended to set a key of a length exceeding 256 bits. The 3 color matrices are 3 matrices obtained by decomposing three colors of red, yellow and blue of an image to be encrypted.
In an alternative embodiment, after the image to be encrypted is acquired, the image to be encrypted is subjected to format conversion into an image P of size mxn×3, where M represents the number of horizontal pixels in the image and N represents the number of vertical pixels. Three empty matrices R, G and B are defined according to the image to be encrypted, which have a size of mxn. The pixel point of the image P is represented by (i, j), and the red channel value P (i, j, 1) is extracted from P and assigned to the matrix R. Green channel values P (i, j, 2) are extracted from P and assigned to the matrix G. Blue channel values P (i, j, 3) are extracted from P and assigned to matrix B. Further, the 3 color matrixes of the image to be encrypted are obtained as follows
Step 102, determining a key matrix of an image to be encrypted based on the external key and a predetermined chaotic system.
The chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping. The piecewise linear chaotic mapping (Piecewise Linear Chaotic Map, PWLCM) is a chaotic mapping method, and the PWLCM can generate pseudo-random number sequences and is widely applied to the fields of encryption algorithm, random number generation and the like. The mixed chaotic map may be an improved LSS chaotic map, including a Logistic chaotic map and a Sine chaotic map. The improved LSS chaotic system is obtained by taking Logistic chaotic map and Sine chaotic map as sub-maps and obtaining a new chaotic system model obtained in advance.
In this embodiment, optionally, the determining the key matrix of the image to be encrypted based on the external key and the predetermined chaotic system includes the following steps A1-A3:
step A1: and calculating the image to be encrypted based on the external key through a message authentication code algorithm to obtain an initial value of the image to be encrypted.
The message authentication code algorithm may be, among other things, the HMAC-SHA256 (Hash-based Message Authentication Code with SHA-256) algorithm, the HMAC-SHA256 generating a fixed length output by combining the external key with the message and applying a Hash function, which output may be used to verify the integrity and authenticity of the message.
In an alternative embodiment, after the external key is obtained, the external key and the PWLCM generated random sequence are concatenated together and the HMAC-SHA256 algorithm is used to calculate the hash value. The length of the hash value is fixed as known from the nature of the HMAC-SHA256 algorithm. Further, the first N bits of the hash value may be selected as an initial value of the image to be encrypted according to the actual environment, specific requirements, and the like.
Step A2: and generating a linear random sequence corresponding to the linear chaotic map and a mixed random sequence corresponding to the mixed chaotic map based on the initial value through the chaotic system.
The chaotic system comprises PWLCM and mixed chaotic map. In an alternative embodiment, after obtaining the initial value of the image to be encrypted, the PWLCM takes the initial value of the image to be encrypted as input, generates a sequence by iterative operation, and determines the sequence as a linear random sequence. Further, an initial value of the image to be encrypted is input into the hybrid chaotic map, and in the scheme, a parameter r of the hybrid chaotic map is set to r= 3.99999999..
Step A3: and performing data conversion on the linear random sequence to obtain a key matrix of the image to be encrypted.
Specifically, after obtaining a linear random sequence generated by PWLCM, converting a sequence value in the sequence into a random integer between 0 and 256, and determining a key matrix corresponding to the image to be encrypted according to the obtained random integer. Illustratively, the PWLCM generates a linear random sequence of { y } i E.g. formula }, e.gWill { y } i Each element in the sequence is multiplied by 256, and the multiplied result is rounded to obtain an integer ki corresponding to each element. Further, ki is determined as a key matrix of the image to be encrypted.
In the above steps, the image to be encrypted and the external key can be generated into the initial value condition of chaotic mapping through the HMAC-SHA256 algorithm, so that the image encryption algorithm and the image to be encrypted are closely related, powerful attack of selecting plaintext is sufficiently resisted, and the safety of the encrypted image is improved.
And step 103, determining a ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix.
Wherein the DNA image encoding algorithm includes a DNA encoding rule, which is an encryption means for image encryption, which designs the encryption algorithm using the encoding characteristics of the bio-molecular DNA. The predetermined DNA image coding algorithm is a DNA image coding algorithm which obtains the optimal parameters after training. The ciphertext image is an image that is encrypted with respect to the image to be encrypted.
In an alternative embodiment, after obtaining 3 color matrixes and key matrixes of the image to be encrypted, respectively encoding the key matrixes and the mixed random sequence based on the 3 color matrixes to obtain a pixel matrix corresponding to the key matrixes and 3 encoding matrixes corresponding to the mixed random sequence; carrying out data transformation on the mixed random sequence according to a predetermined rule determination formula to obtain a DNA algorithm; performing characteristic analysis on the mixed random sequence to obtain an analysis result, and determining a decoding rule based on the analysis result; according to the DNA algorithm, the pixel matrix and the 3 coding matrixes are operated to obtain 3 intermediate images corresponding to the image to be encrypted; decoding the 3 intermediate images based on a decoding rule to obtain 3 decoded images; rotating the 3 decoded images by 90 degrees anticlockwise to obtain 3 rotated images corresponding to the 3 decoded images; obtaining 3 rotation intermediate images based on the DNA coding rule and the 3 rotation images, and decoding the 3 rotation intermediate images; and obtaining a ciphertext image based on the decoded 3 rotation intermediate images.
In the scheme of the embodiment of the invention, an image to be encrypted is obtained, and an external secret key and 3 color matrixes of the image to be encrypted are obtained based on the image to be encrypted; determining a key matrix of an image to be encrypted based on an external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping; and determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix. The method of the embodiment can combine the chaotic encryption algorithm and the DNA code to encrypt the image, thereby improving the randomness and the safety of the image encryption, further ensuring that the image information of the user cannot be leaked, improving the efficiency of the image encryption and improving the user experience.
Fig. 2 is a second flowchart of an image encryption method according to an embodiment of the present invention, as shown in fig. 2, the method mainly includes the following steps:
step 201, an image to be encrypted is obtained, and an external key and 3 color matrixes of the image to be encrypted are obtained based on the image to be encrypted.
Step 202, determining a key matrix of an image to be encrypted based on an external key and a predetermined chaotic system.
The chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping.
Step 203, according to the DNA encoding rule, encoding the key matrix and the mixed random sequence based on the 3 color matrices, respectively, to obtain a pixel matrix corresponding to the key matrix and 3 encoding matrices corresponding to the mixed random sequence.
Specifically, after obtaining the linear random sequence and the mixed random sequence, the mixed random sequence { x } i The } is according to the formula:obtaining a DNA encoding RULE, wherein RULE i Is an integer between 1 and 8, corresponding to the 8 different DNA encoding rules of Table 1, respectively. R1 to R8 represent 8 integers, A, T, C and G represent different values or characters, and A, T, C and G can be used to convert numbers or other data into DNA sequences.
Rules of | R1 | R2 | R3 | R4 | R5 | R6 | R7 | R8 |
A | 00 | 00 | 11 | 11 | 10 | 01 | 10 | 01 |
T | 11 | 11 | 00 | 00 | 01 | 10 | 01 | 10 |
C | 10 | 01 | 10 | 01 | 00 | 00 | 11 | 11 |
G | 01 | 10 | 01 | 10 | 11 | 11 | 00 | 00 |
TABLE 1
Coding the image to be encrypted line by line according to the line elements, and coding the DNA (deoxyribonucleic acid) of the line elements of the 3 color matrixes R, G and B and RULE i Are identical. Further, according to the DNA coding rule, DNA coding is performed based on the 3 color matrixes and the mixed random sequence, so that 3 coding matrixes corresponding to the mixed random sequence are obtained and respectively marked as EIR, EIG and EIB. By adopting the same method, the key matrix ki is subjected to DNA coding according to the DNA coding rule, and a pixel matrix corresponding to the key matrix is obtained.
Step 204, determining a DNA algorithm and a decoding rule based on the mixed random sequence.
Wherein the DNA algorithm comprises three algorithms of addition, subtraction and exclusive OR. In this embodiment, optionally, determining the DNA algorithm and the decoding rule based on the mixed random sequence includes: carrying out data transformation on the mixed random sequence according to a predetermined rule determination formula to obtain a DNA algorithm; and carrying out characteristic analysis on the mixed random sequence to obtain an analysis result, and determining a decoding rule based on the analysis result.
Specifically, when a mixed random sequence { x } is obtained i After { x } i -determining the formula according to the rules:data transformation is performed, and { x } i Conversion to an integer between 1 and 3, and determining the DNA algorithm based on the resulting integer. When operating i When=1, the DNA algorithm is determined to be an exclusive or operation. When operating i When=2, the DNA algorithm is determined to be an addition operation. When operating i When=3, the DNA algorithm is determined as a subtraction operation.
In an alternative embodiment, after the mixed random sequence is obtained, the method is based onDNA encoding rules were obtained. Further, a corresponding decoding rule is determined based on the random features of the mixed random sequence and the DNA encoding rule. Since the mixed random sequence has the characteristic of randomness, the decoding rule determined according to the mixed random sequence also has randomness, so that the decoding rule is difficult to successfully match with the corresponding coding type in the coding operation in the actual decoding operation. Therefore, the DNA decoding operation can achieve the effect of image pixel diffusion, and the randomness of ciphertext is enhanced.
Step 205, determining the ciphertext image of the image to be encrypted according to the pixel matrix, the 3 encoding matrices, the DNA algorithm and the decoding rule.
The ciphertext image is an image after the image to be encrypted is encrypted. In this scheme, optionally, determining the ciphertext image of the image to be encrypted according to the pixel matrix, the 3 encoding matrices, the DNA algorithm and the decoding rule includes the following steps B1-B3:
step B1: and carrying out operation on the pixel matrix and the 3 coding matrixes according to the DNA algorithm to obtain 3 intermediate images corresponding to the image to be encrypted.
After determining the DNA algorithm, the DNA algorithm is performed on the 3 coding matrixes and the pixel matrixes to perform dynamic DNA operation, so as to obtain 3 intermediate matrixes. In an alternative embodiment, the 3 encoding matrices and pixels may be added, subtracted, and exclusive-ored on a row-by-row basis to obtain three matrices CER, CEG, and CEB, which may be multiplied element-by-element with the original three color matrices R, G and B. Further, performing element-by-element modular operation on three matrixes of CER, CEG and CEB after multiplication operation to ensure that elements in a result matrix are between 0 and 6, obtaining three final matrixes of CER, CEG and CEB, and determining the three matrixes as 3 intermediate images corresponding to the image to be encrypted.
Step B2: and decoding the 3 intermediate images based on the decoding rule to obtain 3 decoded images, and rotating the 3 decoded images by 90 degrees anticlockwise to obtain 3 rotated images corresponding to the 3 decoded images.
Specifically, after obtaining 3 intermediate images, DNA decoding is automatically performed on the 3 intermediate images according to the determined decoding rule. Since the mixed random sequence has the characteristic of randomness, the decoding rule determined according to the mixed random sequence also has randomness, so that the decoding rule is difficult to successfully match with the corresponding coding type in the coding operation in the actual decoding operation. Therefore, the DNA decoding operation can achieve the effect of image pixel diffusion, and the randomness of ciphertext is enhanced.
Further, after obtaining 3 decoded images, the 3 decoded images are rotated 90 degrees counterclockwise, so as to obtain 3 rotated images corresponding to the 3 decoded images.
Step B3: obtaining 3 rotation intermediate images based on the DNA coding rule and the 3 rotation images, and decoding the 3 rotation intermediate images; and obtaining a ciphertext image based on the decoded 3 rotation intermediate images.
Specifically, after obtaining 3 rotation images, the images are decoded according to a decoding rule to obtain 3 decoded intermediate images. And performing secondary encryption on the 3 decoding intermediate images according to the DNA coding rule, namely performing the step of respectively coding the key matrix and the mixed random sequence based on the 3 decoding intermediate images according to the DNA coding rule to obtain a pixel matrix corresponding to the key matrix and 3 coding matrices corresponding to the mixed random sequence, finally obtaining 3 cipher images corresponding to the 3 decoding images, and integrating the 3 cipher images together to obtain a ciphertext image corresponding to the image to be encrypted.
In this embodiment, optionally, decrypting the ciphertext image includes: acquiring an image to be decrypted, and splitting the image to be decrypted into 3 component matrixes; obtaining 3 decrypted component images corresponding to the 3 component matrixes based on a preset decoding rule and a DNA image coding algorithm; a decrypted image is determined based on the 3 decrypted component images.
Wherein the image to be decrypted is an image to be decrypted. Specifically, the image encryption algorithm of the scheme is a symmetrical cryptosystem, so the image decryption algorithm is a reverse encryption process. In an alternative embodiment, after the image to be decrypted is acquired, the image to be decrypted is split into 3 component matrices according to 3 colors of red, yellow and blue. Decoding 3 component matrixes of the image to be decrypted according to a decoding rule determined in the encryption process. And generating a key matrix of the image to be decrypted through piecewise linear chaotic mapping, and performing DNA encoding on the key matrix. And performing DNA inverse operation of pairing the coded key matrix with 3 coding matrixes corresponding to the 3 component matrixes respectively. And decoding the 3 matrixes subjected to the inverse operation to obtain 3 decoding matrixes. Finally, the 3 decoding matrices are rotated clockwise by 90 °. Repeating the encryption step in the corresponding encryption process, repeating the decoding step by the 3 decoding matrixes to finally obtain 3 decrypted component images, and integrating the 3 decrypted component images to obtain a decrypted image corresponding to the image to be decrypted.
In the steps, the image to be decrypted can be decrypted according to the encryption process, and the effectiveness and reliability of data transmission in the image decryption process are improved.
According to the image encryption method provided by the embodiment of the invention, the image to be encrypted is obtained, and the external secret key and the 3 color matrixes of the image to be encrypted are obtained based on the image to be encrypted. Determining a key matrix of an image to be encrypted based on an external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping. And extracting key data in the operation data according to a preset screening rule, and preprocessing the key data to obtain preprocessed key data. And respectively encoding the key matrix and the mixed random sequence based on the 3 color matrixes according to the DNA encoding rule to obtain a pixel matrix corresponding to the key matrix and 3 encoding matrixes corresponding to the mixed random sequence. The DNA algorithm and decoding rules are determined based on the mixed random sequence. And determining the ciphertext image of the image to be encrypted according to the pixel matrix, the 3 coding matrixes, the DNA algorithm and the decoding rule. According to the technical scheme, the chaotic encryption algorithm and the DNA code can be combined to encrypt the image, so that the randomness and the safety of image encryption are improved, the image information of a user is further ensured not to be leaked, the image encryption efficiency is improved, and the user experience is improved.
The data acquisition, storage, use, processing and the like in the technical scheme meet the relevant regulations of national laws and regulations.
Fig. 3 is a schematic structural diagram of an image encryption device according to an embodiment of the present invention. An embodiment of the present invention provides an image encryption apparatus, including:
an image obtaining module 301, configured to obtain an image to be encrypted, and obtain an external key and 3 color matrices of the image to be encrypted based on the image to be encrypted;
a matrix determining module 302, configured to determine a key matrix of the image to be encrypted based on the external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping;
an image encrypting module 303, configured to determine a ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrices, and the key matrix.
Optionally, the matrix determining module 302 is specifically configured to: calculating the image to be encrypted based on the external key through a message authentication code algorithm to obtain an initial value of the image to be encrypted;
generating a linear random sequence corresponding to the linear chaotic map and a mixed random sequence corresponding to the mixed chaotic map based on the initial value through the chaotic system;
and performing data conversion on the linear random sequence to obtain a key matrix of the image to be encrypted.
Optionally, the DNA image encoding algorithm includes a DNA encoding rule, and the image encrypting module 303 is specifically configured to: respectively encoding the key matrix and the mixed random sequence based on the 3 color matrixes according to the DNA encoding rule to obtain a pixel matrix corresponding to the key matrix and 3 encoding matrixes corresponding to the mixed random sequence;
determining a DNA algorithm and a decoding rule based on the mixed random sequence;
and determining the ciphertext image of the image to be encrypted according to the pixel matrix, the 3 coding matrixes, the DNA algorithm and the decoding rule.
Optionally, the image encryption module 303 is further configured to: carrying out data transformation on the mixed random sequence according to a predetermined rule determination formula to obtain the DNA algorithm;
and carrying out characteristic analysis on the mixed random sequence to obtain an analysis result, and determining the decoding rule based on the analysis result.
Optionally, the image encryption module 303 is further configured to: performing operation on the pixel matrix and the 3 coding matrixes according to the DNA algorithm to obtain 3 intermediate images corresponding to the image to be encrypted;
decoding the 3 intermediate images based on the decoding rule to obtain 3 decoded images;
and obtaining the ciphertext image according to the 3 decoded images.
Optionally, the image encryption module 303 is further configured to: rotating the 3 decoded images by 90 degrees anticlockwise to obtain 3 rotated images corresponding to the 3 decoded images;
obtaining 3 rotation intermediate images based on the DNA coding rule and the 3 rotation images, and decoding the 3 rotation intermediate images;
the ciphertext image is obtained based on the decoded 3 rotated intermediate images.
Optionally, the image encryption module 303 is further configured to: acquiring an image to be decrypted, and splitting the image to be decrypted into 3 component matrixes;
obtaining 3 decrypted component images corresponding to the 3 component matrixes based on a preset decoding rule and the DNA image coding algorithm;
a decrypted image is determined based on the 3 decrypted component images.
The image encryption device provided by the embodiment of the invention can execute the image encryption method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and referring to fig. 4, a schematic structural diagram of a computer system 12 of an electronic device suitable for implementing an embodiment of the present invention is shown. The electronic device shown in fig. 4 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments of the invention. Components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard disk drive"). Although not shown in fig. 4, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the electronic device 12, and/or any devices (e.g., network card, modem, etc.) that enable the electronic device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. In the electronic device 12 of the present embodiment, the display 24 is not provided as a separate body but is embedded in the mirror surface, and the display surface of the display 24 and the mirror surface are visually integrated when the display surface of the display 24 is not displayed. Also, the electronic device 12 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 over the bus 18. It should be appreciated that although not shown in fig. 4, other hardware and/or software modules may be used in connection with electronic device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and image encryption by running a program stored in the system memory 28, for example, implementing an image encryption method provided by an embodiment of the present invention: acquiring an image to be encrypted, and obtaining an external key and 3 color matrixes of the image to be encrypted based on the image to be encrypted; determining a key matrix of the image to be encrypted based on the external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping; and determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix.
The embodiments of the present invention provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements an image encryption method as provided by all the embodiments of the present invention: acquiring an image to be encrypted, and obtaining an external key and 3 color matrixes of the image to be encrypted based on the image to be encrypted; determining a key matrix of the image to be encrypted based on the external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping; and determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, 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. In this document, a computer 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 computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer 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 computer 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.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ 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 computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.
Claims (10)
1. An image encryption method, the method comprising:
acquiring an image to be encrypted, and obtaining an external key and 3 color matrixes of the image to be encrypted based on the image to be encrypted;
determining a key matrix of the image to be encrypted based on the external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping;
and determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix.
2. The method of claim 1, wherein determining the key matrix of the image to be encrypted based on the external key and a predetermined chaotic system comprises:
calculating the image to be encrypted based on the external key through a message authentication code algorithm to obtain an initial value of the image to be encrypted;
generating a linear random sequence corresponding to the linear chaotic map and a mixed random sequence corresponding to the mixed chaotic map based on the initial value through the chaotic system;
and performing data conversion on the linear random sequence to obtain a key matrix of the image to be encrypted.
3. The method of claim 1, wherein the DNA image encoding algorithm includes DNA encoding rules, determining the ciphertext image of the image to be encrypted based on a predetermined DNA image encoding algorithm, the 3 color matrices, and the key matrix, comprising:
respectively encoding the key matrix and the mixed random sequence based on the 3 color matrixes according to the DNA encoding rule to obtain a pixel matrix corresponding to the key matrix and 3 encoding matrixes corresponding to the mixed random sequence;
determining a DNA algorithm and a decoding rule based on the mixed random sequence;
and determining the ciphertext image of the image to be encrypted according to the pixel matrix, the 3 coding matrixes, the DNA algorithm and the decoding rule.
4. A method according to claim 3, wherein determining DNA algorithms and decoding rules based on the mixed random sequence comprises:
carrying out data transformation on the mixed random sequence according to a predetermined rule determination formula to obtain the DNA algorithm;
and carrying out characteristic analysis on the mixed random sequence to obtain an analysis result, and determining the decoding rule based on the analysis result.
5. The method of claim 4, wherein determining the ciphertext image of the image to be encrypted based on the pixel matrix, the 3 encoding matrices, the DNA algorithm, and the decoding rules comprises:
performing operation on the pixel matrix and the 3 coding matrixes according to the DNA algorithm to obtain 3 intermediate images corresponding to the image to be encrypted;
decoding the 3 intermediate images based on the decoding rule to obtain 3 decoded images;
and obtaining the ciphertext image according to the 3 decoded images.
6. The method of claim 5, wherein deriving the ciphertext image from the 3 decoded images comprises:
rotating the 3 decoded images by 90 degrees anticlockwise to obtain 3 rotated images corresponding to the 3 decoded images;
obtaining 3 rotation intermediate images based on the DNA coding rule and the 3 rotation images, and decoding the 3 rotation intermediate images;
the ciphertext image is obtained based on the decoded 3 rotated intermediate images.
7. The method according to claim 1, wherein the method further comprises:
acquiring an image to be decrypted, and splitting the image to be decrypted into 3 component matrixes;
obtaining 3 decrypted component images corresponding to the 3 component matrixes based on a preset decoding rule and the DNA image coding algorithm;
a decrypted image is determined based on the 3 decrypted component images.
8. An image encryption apparatus, characterized in that the apparatus comprises:
the image acquisition module is used for acquiring an image to be encrypted and obtaining an external secret key and 3 color matrixes of the image to be encrypted based on the image to be encrypted;
the matrix determining module is used for determining a key matrix of the image to be encrypted based on the external key and a predetermined chaotic system; the chaotic system comprises piecewise linear chaotic mapping and mixed chaotic mapping;
and the image encryption module is used for determining the ciphertext image of the image to be encrypted according to a predetermined DNA image encoding algorithm, the 3 color matrixes and the key matrix.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the image encryption method according to any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements an image encryption method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311694479.9A CN117714613A (en) | 2023-12-11 | 2023-12-11 | Image encryption method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311694479.9A CN117714613A (en) | 2023-12-11 | 2023-12-11 | Image encryption method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117714613A true CN117714613A (en) | 2024-03-15 |
Family
ID=90145506
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311694479.9A Pending CN117714613A (en) | 2023-12-11 | 2023-12-11 | Image encryption method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117714613A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118075036A (en) * | 2024-04-25 | 2024-05-24 | 江西省外经贸融资担保有限公司 | Authentication method, system and computer readable storage medium for electronic letter |
CN119544184A (en) * | 2025-01-22 | 2025-02-28 | 浪潮通用软件有限公司 | A chaotic block encryption method, system and medium based on random selection of models |
-
2023
- 2023-12-11 CN CN202311694479.9A patent/CN117714613A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118075036A (en) * | 2024-04-25 | 2024-05-24 | 江西省外经贸融资担保有限公司 | Authentication method, system and computer readable storage medium for electronic letter |
CN119544184A (en) * | 2025-01-22 | 2025-02-28 | 浪潮通用软件有限公司 | A chaotic block encryption method, system and medium based on random selection of models |
CN119544184B (en) * | 2025-01-22 | 2025-05-16 | 浪潮通用软件有限公司 | Chaotic block encryption method, system and medium based on model random selection |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9489521B2 (en) | Format preserving encryption methods for data strings with constraints | |
CN109840425B (en) | File encryption method and device | |
CN117714613A (en) | Image encryption method and device, electronic equipment and storage medium | |
CN110084599B (en) | Key processing method, device, equipment and storage medium | |
CN111475690B (en) | Character string matching method and device, data detection method and server | |
CN104917617A (en) | Confounding method of encrypted group signatures | |
CN111177763A (en) | Two-dimensional code electronic encryption and decryption management system and method for file multiple encryption | |
CN114760052B (en) | Bank internet of things platform key generation method and device, electronic equipment and medium | |
CN112199730A (en) | Method and device for processing application data on terminal and electronic equipment | |
CN112614557A (en) | Electronic medical record encryption archiving method | |
Alenizi et al. | A Review of Image Steganography Based on Multiple Hashing Algorithm. | |
US20240338478A1 (en) | Protecting membership for secure computation and communication | |
Mohammed | A new approach to hide texts into images and audio files using steganography and cryptography techniques | |
CN117834186A (en) | Data encryption transmission method and system | |
Rajendran et al. | An update on medical data steganography and encryption | |
WO2018171302A1 (en) | Method and apparatus for use in information processing | |
CN116049792A (en) | Face registration and recognition method and face data protection system | |
CN113904865A (en) | Log transmission method and device based on asymmetric algorithm | |
CN114172710A (en) | Data decryption method, device, equipment and storage medium | |
CN112260998A (en) | Answer protection method and device for network questions | |
CN115242540B (en) | Data processing method and system | |
CN119203179B (en) | Data security protection method and system | |
Achriadi et al. | Encryption and Description of RGB Values in Images Using the Hill Chiper Algorithm | |
US12231563B2 (en) | Secure computation and communication | |
CN116566588B (en) | White box SM4 algorithm protection method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |