Encryption of logistic chaotic sequences for image processing

Source: Internet
Author: User

Preface: This article was originally published in Sina blog http://blog.sina.com.cn/s/blog_b27f71160101h5bm.html, is now Sina blog to move to Csdn, the original Sina blog stopped updating.

① after applying for move, delay to receive the code to move

② a little bit more familiar with the algorithm

③ Contact Keyboard Typing

Based on the three points above, the blog post is knocked over again.


Logistic chaotic scrambling, not to mention how complex, in fact, is very simple.

The Logistic function is derived from a demographic dynamics system with the following system equations:

x (k+1) = U * X (k) * [1-x (k)],(k=0,1,..., n)

Do not have to tube this equation is how to come out, feel uncomfortable words own Baidu go. It can be seen that this equation is non-linear, iterative in form. To use it, we need to know two things:

①        initial value: X (0)

②        parameters: u

Why is this equation called chaos? When is it a chaotic system? This is also conditional:

①&NBSP;      0&NBSP; &NBSP; <&NBSP; x (0)   < 1

②&NBSP;    3.5699456 ... & nbsp   &NBSP; u <=4

When these two conditions are met, logistic< Span style= "word-wrap:normal; Word-break:normal; Font-family: The song Body "> function works in the chaotic state. These two conditions are how to come to please Baidu, we here only say algorithm and implementation. What is chaotic state: As the name implies is a disorderly, unpredictable, chaotic, touch the head, can not touch the state of the tail. What happens when a chaotic state occurs, let's take the following argument:

①&NBSP;      x (0) = 0.1

② u = 4

when the iterationNTimes, we get the x(1), X (2) 、..., x (n)soNa value. So this is a chaotic sequence, which is a one-dimensional sequence calledA, which is the sequence we want to get, inMatlab, you can seeX (i)(i=1,2,..., N) is the value of the(0,1)between--this is a good feature, just like the image grayscale value is in the(0,255)between the same. So let's get this one-dimensional sequence normalized to(0,255)get a sequence betweenB.

then look at the encryption process. For a piece ofM*nthe size of the image (temporarily calledPicture), we need to generate a matrix of the same size to encrypt it. So, you just need to iterateM*ntimes to get the sequenceA, then turn into sequenceB, this time the sequenceBis one-dimensional, transforming it intoM*na two-dimensional matrix (temporarily calledFuck). Therefore, withFuckwith thePicutrea new image can be obtained by making an XOR, calledRod, this completes the image encryption once, the encrypted image isRod.

Rod=picture⊙fuck(⊙ denotes xor )

So the secret key in our hands is: U X (0)

This type of encryption, known as sequence encryption, shows that this encryption changes the grayscale of the next pixel (the histogram changes) without changing the position. Decrypt the same truth:picture = Rod⊙fuck.

The code is as follows:

Using logistic chaotic mapping, the sequence encryption function V=lock_logistic_gray (picture,x0,u) [M,n]=size (picture) of the grayscale image is performed, and x=x0;% iterates 500 times, Achieve full chaotic state for i=1:500    x=u*x* (1-x); end% produce one-dimensional chaotic encryption sequence A=zeros (1,M*N); A (1) =x;for i=1:m*n-1a (i+1) =u*a (i) * (1-a (i)), end% normalized sequence b=uint8 (255*a),% converted to two-dimensional chaotic encryption sequence Fuck=reshape (B,M,N); Rod=bitxor (picture,fuck);% XOR operation Encryption V=rod;figure;imshow ([picture,v]);% complete

Histogram encryption after encryption before encryption


Encryption of logistic chaotic sequences for image processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.