CN107424114A - A kind of image encryption method based on RC4 algorithms - Google Patents
A kind of image encryption method based on RC4 algorithms Download PDFInfo
- Publication number
- CN107424114A CN107424114A CN201710203809.8A CN201710203809A CN107424114A CN 107424114 A CN107424114 A CN 107424114A CN 201710203809 A CN201710203809 A CN 201710203809A CN 107424114 A CN107424114 A CN 107424114A
- Authority
- CN
- China
- Prior art keywords
- image
- secret
- key stream
- algorithms
- key
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/0021—Image watermarking
- G06T1/0092—Payload characteristic determination in a watermarking scheme, e.g. number of bits to be embedded
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Facsimile Transmission Control (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
A kind of encryption method of the Secret Image based on RC4 algorithms is claimed in the present invention, belongs to Information Hiding in Digital Image field.The present invention first has to determine the Secret Image image and host image to be encrypted.Then the state vector S and key K needed for RC4 algorithms are obtained from host image;After calculating interim vector T further according to RC4 algorithms, then calculate key stream k.The Secret Image that the key stream k and Secret Image XOR that calculate can be encrypted.The inventive method can protect Secret Image well.
Description
Technical field
The invention belongs to Information Hiding in Digital Image field, and in particular to a kind of secret information image encryption method.
Background technology
With the continuous development of society, transmission, the exchange of information are more and more frequent, and protection secret information is total to as people
With requirement.The birth of cryptography preferably protects secret information to a certain extent, and its operation principle is to make in plain text " becoming "
Impenetrable word, to reach the purpose of protection secret information.However, as the development of computer technology, this protection are secret
What the method for confidential information became is not so " unbreakable ".First time Information hiding seminar has been held within 1996 in London, has been marked
Will the birth of a new subject;Information hiding becomes a study hotspot, the hiding mechanism of research information since then
Also it is more and more.
At present, Information hiding includes the hidden algorithm of spatial information (si) hidden algorithm and transform domain information.Transform-domain algorithm:It is right
Host image carries out orthogonal transformation, hides secret information by changing conversion coefficient;Conventional transform-domain algorithm has:DFT (from
Dissipate Fourier transform), DCT (discrete cosine transform domain), DWT (wavelet transform domain).Spatial information (si) hidden algorithm has:
LSB (LSB algorithm), statistical nature insertion.These algorithm researches mainly include:Hold quantifier elimination to host (to hide more
More secret informations), research to the not sentience of image (whether seen in host image hiding information), to the Shandong of image
(purpose is in order to more for the research (can extract Secret Image well from host image) of rod and the research to image scrambling
Good hiding Secret Image).It is largely based on host image in these researchs, Secret Image is processed although having, than
Such as:The scramble of Secret Image, by changing the position of image pixel, so that Secret Image becomes to differentiate, but its purpose
It is hiding pretreatment, directly Secret Image is not protected, and the scramble of Secret Image has periodically, and pass through
After the scramble of certain number, it can recover original image again.
By above theory analysis, although existing algorithm research can preferably hide secret information, without good
Protect secret information.Therefore, a kind of algorithm that can protect Secret Image is studied to be of great significance tool.Information hiding
Technology is the focus of present age research, and simple Information hiding no longer can will well protect secret information.
The content of the invention
Present invention seek to address that above problem of the prior art.Propose it is a kind of can protect well Secret Image based on
The image encryption method of RC4 algorithms.Technical scheme is as follows:
A kind of image encryption method based on RC4 algorithms, described image include Secret Image and host image, and its feature exists
In comprising the following steps:
101st, the gray value of Secret Image is obtained, and the gray value is converted into corresponding binary number;
102nd, Secret Image is pre-processed, chooses the highest of each binary number of the binary system figure of Secret Image
Position, carry out a high position 0,1 and replace;
103rd, the gray value of host image is obtained, state vector S and interim vector are chosen according to the gray value of host image
T;
104th, according to RC4 algorithms, interim vector T is calculated by S and K, then key stream K is calculated by T and S, it is caused close
Key stream K and the pretreated Secret Image XOR of step 102, the image after XOR are the Secret Images of encryption, during decryption, then
By 0,1 displacement of the image highest order after XOR:Highest order was 0 originally, and it is changed into 1;If 1, then become 0, can obtain
To the original image of encrypted image.
Further, the encryption method based on RC4 algorithms, the step of the pretreatment of its step 101 Secret Image such as
Under:
Step 1-1:The position of Secret Image displacement is chosen, from eight bitmaps of image, a high position for image contains greatly
Partial image information, the highest order for choosing image are operated;
Step 1-2:Consider the displacement of highest order progress 0,1 for choosing image, i.e.,:If highest order be 0 this it become
Into 1, if highest order be 1 this it become 0.
Further, the determination step of key digit is also included between step 102 and step 103:
The highest three for choosing image is encrypted;Calculate the number of the pixel of image;Being determined by the number of pixel will
The number of encryption;The digit to be encrypted is determined according to the number of encryption.
Further, the step 103 chooses state vector S according to host image and interim vector T specifically includes:
Random tens or hundreds of numbers of selection from host image, as a state vector S;
More than ten of random selection or tens numbers from host image, as a secondary key K.
Further, after key stream is generated by state vector S and key K, the digit for the key stream that accumulation calculating goes out, and
Judge whether the digit of key stream meets to require, the digit of key stream is greater than or the digit equal to required key stream.
Further, after the digit for meeting key stream is more than or equal to the digit of required key stream, secret figure is chosen
As high three, the composition string number of each pixel;The numeral and key stream phase XOR of pixel composition;Obtained after XOR a string it is new
Numeral, every 3 numerals be one group, replace XOR before image pixel it is high three, so far, encryption complete.
Advantages of the present invention and have the beneficial effect that:
RC4 algorithms in combining cipher of the present invention, before Secret Image is transmitted, it is encrypted to Secret Image;Attack
Person is when obtaining Secret Image, it is impossible to simply cracks Secret Image using the periodicity of scramble.Attacker wants to crack secret
Close image just needs to know state vector S and key K value and length and key K length, key stream k and Secret Image
Which XOR and the process pre-processed.So the invention can protect Secret Image well.
Brief description of the drawings
Fig. 1 is the gray-value image that the present invention provides preferred embodiment Secret Image;
Fig. 2 is the binary picture (part sectional drawing) of the Secret Image of the present invention;
Fig. 3 is the encryption flow figure of the present invention;
Fig. 4 is the program of RC4 encryptions;
Fig. 5 is present invention decryption flow chart.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, detailed
Carefully describe.Described embodiment is only the part of the embodiment of the present invention.(understood by RC4 algorithms, it is necessary to first determine close
Key K and state vector S, then calculates interim vector T by K and S, finally calculates key stream k by S and T.To be specific below
Method carried out therewith.)
The present invention solve above-mentioned technical problem technical scheme be:
When being encrypted to Secret Image, it should consider that this is encrypted by what method first.Each image be by
Various pixel compositions, such as 512 × 512 image, are exactly to be made up of 512 × 512 pixel values;And pixel value can be with
Represented by numeral.Mathematically go to see that these pixel values just form a matrix, so as to by change the value of matrix with up to
To the purpose to image encryption.
Gray level image is made up of gray value, and gray value refers to the shade at black white image midpoint.Gray value is from 0 to 255, in vain
Color is 255, black 0, as shown in Figure 1.Metric gray value, it is unfavorable for changing gray value to reach the purpose of encryption.Ash
Angle value is up to 255 can be by 8 binary representations, as shown in Figure 2.Can by change binary a certain position or a few positions with
Reach the purpose of encryption.
With RC4 before being encrypted to Secret Image, it would be desirable to determine the length of key stream and added to which position
It is close.From 8 bitmaps of image, change of the high-order change to image is maximum, therefore our high positions to Secret Image are carried out
Encryption.High-order change can make obscuring, can not differentiating for image change.The determination of the length of key stream:Assuming that, it is necessary to 64 ×
3 high bit encryptions of 64 image (to change into binary system), then need 64 × 64 × 3 passwords.Next be exactly obtain it is close
Key stream, as shown in Figure 4:
1st, key stream is determined
We will determine state vector S and key K.It is all the (K determined at random to choose S and K length and size each time
Length be less than or equal to S length).The gray value of host image is obtained by program first, these gray values be exactly choose S and
The number of each in K sources, S and K is all random acquirement from this source.It is determined that after S and K, it would be desirable to according to S length
Key stream k is generated with K size, as shown in figure 4, and to cause k length to be equal to S length.Generation key in Fig. 4
Stream:Gone to replace S by T size and length, S is rearranged.The S rearranged again obtains key stream k and (changes into two to enter
System).The length of generation key stream is calculated, and judges whether length reaches our demand;If being not reaching to demand, this is another
Secondary determination S and K, the length of computation key stream;Conversely, then stopping algorithm, a following step is operated.
2nd, the pretreatment of Secret Image
The pretreatment of image is in order to which cipher round results are more preferable.Because an image high position includes more image informations, change
High-order binary number, it is possible to which preferably image thickens, and image information becomes to differentiate.Therefore, in image
During pretreatment, we change the binary number of a high position.High-order 1 it is changed to 0,0 at this and is changed to 1.
The binary system figure of image is chosen, the highest order of each binary number of binary system figure is chosen by program, is judged whether
For 1, it is changed into 0 if 1, it is changed into 1 if 0.Program is as follows:
Wherein, x is exactly to choose the highest order of Secret Image.
Explained below with example:
Such as:There are 0111001,1111100,1000110,0101011 this few string numeral, obtain this few string number first most
A high position, obtain:0110;Program on entering carries out computing, just obtains:1001, then this number is replaced original highest order
Number, can be obtained:1111001、0111100、0000110、1101011.So as to reach the purpose of the pretreatment of Secret Image.
3rd, encrypt
Can is encrypted to secret figure after key stream reaches requirement and Secret Image has been handled well.Key stream
XOR (XOR) is carried out with the image handled well.The characteristic of XOR is:It is all mutually 0, is not all 1.For example 1011 and 0101 (set it
For key) result of XOR is 1110, it can obtain 1011 with 0101 XOR again 1110.XOR can be very good to recover original
Beginning image.
The value of high three of each pixel is obtained, forms string number, then the numeral and the key stream phase XOR of generation.
String number after XOR forms new string number with being not engaged in the numeral of encryption, and this digital can regards encryption as
Image.For convenience of explanation, explained below with an example:
Such as:There are 1111001,1111100,1000110,1101011 this few string numeral, if key stream is:
001010111001.Choose first high the 3 of each numeric string be the numeral then elected for 111,111,100,110 these
Number.These arrays are changed into 111111100110 into string number, string numeral and key XOR:111111100110 XOR
001010111001 obtains 110101011111.Number after XOR is equally divided into 4 groups, is changed into 110,101,011,111, this
4 groups of numbers replace 4 groups of numbers before XOR, then original a few string numerals are just changed into:1101001、1011100、0110110、
1111011。
The decryption of secret encryption image, as shown in Figure 5.
Decrypting process is the inverse process of encryption.
1st, Secret Image is obtained
Secret encryption image is isolated from the image of transmission and obtains host image.
2nd, the key of decryption is obtained
Key stream is generated according to host image.
3rd, decrypt
The key stream of acquisition and Secret Image XOR.
4th, anti-pretreatment
Image highest order after XOR carries out 0,1 displacement.
State vector S and key K and key stream that they are generated and core Secret Image which XOR is decryption
It is also the most important thing of protection Secret Image information simultaneously.
Cipher round results:
On the premise of attacker has obtained the secret information of encryption and has known the algorithm encrypted to secret information, attack
Person will obtain key stream according to the algorithm.
First, attacker will determine state vector S, attacker to determine state vector S digit sum size and
Several sequences;
Secondly, key K will be determined by attacking this, determine key the K size of digit sum and the sequence of number;
Furthermore, attacker to determine key stream digit and key stream will and encrypted image which XOR.
The small change of above-mentioned each step, can all cause varying for key, so as to not crack Secret Image.
Have attack method of many documents published on RC4, such as [KNUD98], [MIST98], [MANT01]) but
Be when key length be more than 128 when, it is effective without which kind of attack method.Therefore, the algorithm protects secret information well.
The above embodiment is interpreted as being merely to illustrate the present invention rather than limited the scope of the invention.
After the content for having read the record of the present invention, technical staff can make various changes or modifications to the present invention, these equivalent changes
Change and modification equally falls into the scope of the claims in the present invention.
Claims (6)
1. a kind of image encryption method based on RC4 algorithms, described image includes Secret Image and host image, and its feature exists
In comprising the following steps:
101st, the gray value of Secret Image is obtained, and the gray value is converted into corresponding binary number;
102nd, Secret Image is pre-processed, chooses the highest order of each binary number of the binary system figure of Secret Image, enter
A row high position 0,1 is replaced;
103rd, the gray value of host image is obtained, state vector S and interim vector T are chosen according to the gray value of host image;
104th, according to RC4 algorithms, key stream K, caused key stream K and the pretreated secret of step 102 are calculated by S and T
Image XOR, the image after XOR are the Secret Images of encryption, during decryption, then 0,1 of the image highest order after XOR are put
Change:Highest order was 0 originally, and it is changed into 1;If 1, then become 0, the original image of encrypted image can be obtained.
2. the image encryption method according to claim 1 based on RC4 algorithms, it is characterised in that the step 101 is secret
The step of pretreatment of image, is as follows:
Step 1-1:The position of Secret Image displacement is chosen, from eight bitmaps of image, a high position for image contains major part
Image information, the highest order for choosing image operated;
Step 1-2:Consider the displacement of highest order progress 0,1 for choosing image, i.e.,:If highest order be 0 this it become 1,
If highest order be 1 this it become 0.
3. the image encryption method according to claim 2 based on RC4 algorithms, it is characterised in that in step 102 and step
Also include the determination step of key digit between 103:
The highest three for choosing image is encrypted;Calculate the number of the pixel of image;Determine to encrypt by the number of pixel
Number;The digit to be encrypted is determined according to the number of encryption.
4. the image encryption method according to claim 3 based on RC4 algorithms, it is characterised in that step 103 basis
Host image is chosen state vector S and key K and specifically included:
Random tens or hundreds of numbers of selection from host image, as a state vector S;
More than ten of random selection or tens numbers from host image, as a secondary key K.
5. the image encryption method according to claim 4 based on RC4 algorithms, it is characterised in that when by state vector S and
After key K calculates interim vector T, then generation key stream is calculated, the digit for the key stream that accumulation calculating goes out, and judge key stream
Digit whether meet to require, the digit of key stream is greater than or the digit equal to required key stream.
6. the image encryption method according to claim 5 based on RC4 algorithms, it is characterised in that when meeting key stream
After digit is more than or equal to the digit of required key stream, the high three of each pixel of Secret Image is chosen, forms string number;
The numeral and key stream phase XOR of pixel composition;A string of new numerals are obtained after XOR, every 3 numerals are one group, replace XOR
Preceding image pixel it is high three, so far, encryption complete.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710203809.8A CN107424114A (en) | 2017-03-30 | 2017-03-30 | A kind of image encryption method based on RC4 algorithms |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710203809.8A CN107424114A (en) | 2017-03-30 | 2017-03-30 | A kind of image encryption method based on RC4 algorithms |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107424114A true CN107424114A (en) | 2017-12-01 |
Family
ID=60423358
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710203809.8A Pending CN107424114A (en) | 2017-03-30 | 2017-03-30 | A kind of image encryption method based on RC4 algorithms |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107424114A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114172630A (en) * | 2021-12-24 | 2022-03-11 | 湖南大学 | Reversible information hiding method based on addition homomorphic encryption and multi-high-order embedding |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101123496A (en) * | 2006-08-11 | 2008-02-13 | 英特维有限公司 | Digital content protection method |
US20130322623A1 (en) * | 2011-02-15 | 2013-12-05 | P2S Media Group Oy | Quarantine method for sellable virtual goods |
CN103581683A (en) * | 2013-10-18 | 2014-02-12 | 宁波海韦斯智能技术有限公司 | Jpeg image encryption transmission method |
-
2017
- 2017-03-30 CN CN201710203809.8A patent/CN107424114A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101123496A (en) * | 2006-08-11 | 2008-02-13 | 英特维有限公司 | Digital content protection method |
US20130322623A1 (en) * | 2011-02-15 | 2013-12-05 | P2S Media Group Oy | Quarantine method for sellable virtual goods |
CN103581683A (en) * | 2013-10-18 | 2014-02-12 | 宁波海韦斯智能技术有限公司 | Jpeg image encryption transmission method |
Non-Patent Citations (4)
Title |
---|
任洪娥 等: "基于位平面变换的数字图像加密算法", 《计算机工程》 * |
宋杰: "Android智能手机上彩色图像的版权保护", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
赵文博 等: "基于信道编码和Henon映射的图像加密方法", 《西安邮电学院学报》 * |
雷超阳 等: "基于RC4算法的多冗余数字水印技术", 《长沙交通学院学报》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114172630A (en) * | 2021-12-24 | 2022-03-11 | 湖南大学 | Reversible information hiding method based on addition homomorphic encryption and multi-high-order embedding |
CN114172630B (en) * | 2021-12-24 | 2024-05-17 | 湖南大学 | Reversible information hiding method based on addition homomorphic encryption and multi-high-order embedding |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101706946B (en) | Digital image encryption method based on DNA sequence and multi-chaotic mapping | |
CN112714235B (en) | Image encryption method based on filling curve and adjacent pixel bit scrambling | |
Khan et al. | A new hybrid image encryption algorithm based on 2D-CA, FSM-DNA rule generator, and FSBI | |
Jose et al. | A separable reversible data hiding in encrypted image with improved performance | |
Arun et al. | Design of image steganography using LSB XOR substitution method | |
Wang et al. | A privacy-preserving and traitor tracking content-based image retrieval scheme in cloud computing | |
CN108898539A (en) | A kind of color image encrypting method of compatible JPEG compression standard | |
Chen et al. | Error-free separable reversible data hiding in encrypted images using linear regression and prediction error map | |
Bandekar et al. | LSB based text and image steganography using AES algorithm | |
Idakwo et al. | An extensive survey of digital image steganography: State of the art | |
Odat et al. | Image steganography using modified least significant bit | |
Jing et al. | Meaningful ciphertext encryption algorithm based on bit scrambling, discrete wavelet transform, and improved chaos | |
CN108833733A (en) | A kind of decryption method of the resume image based on chaos S box | |
Choudhary et al. | Competitive swarm improved invasive weed optimization-based secret sharing scheme for visual cryptography | |
Prashanti et al. | Data confidentiality using steganography and cryptographic techniques | |
Talukder et al. | An enhanced method for encrypting image and text data simultaneously using AES algorithm and LSB-based steganography | |
Karthikeyan et al. | An enhanced Hill cipher approach for image encryption in steganography | |
CN107424114A (en) | A kind of image encryption method based on RC4 algorithms | |
Abu-Alhaija | Crypto-Steganographic LSB-based System for AES-Encrypted Data | |
Zhu et al. | A visual security multi-key selection image encryption algorithm based on a new four-dimensional chaos and compressed sensing | |
Rajkamal et al. | Image and Text Hiding using RSA & Blowfish Algorithms with Hash-Lsb Technique | |
Su et al. | A color image encryption scheme based on 2D coupled chaotic system and diagonal scrambling algorithm | |
CN107590369B (en) | Homomorphic encrypted domain reversible information hiding method based on code division multiplexing and value expansion | |
Tang et al. | A new image encryption and steganography scheme | |
Kushwaha et al. | Secure image data by double encryption |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171201 |
|
RJ01 | Rejection of invention patent application after publication |