Title: Image Encryption
1Image Encryption
- Kane Iverson
- John Vreugdenhil SD0807
Advisors Rajesh Kavaserri Rajendra Katti
2Introduction
- Encryption - The process of transforming
information (plaintext) using an
algorithm (called a cipher) to make it unreadable
to anyone except those possessing
special knowledge, usually referred to as a key. - Why do we need Image Encryption?
- To safely and securely transfer images for the
following uses - 1.) Military
- 2.) Health Care
- 3.) Mapping and Positioning
- 4.) Picture messaging on Cell Phones
- 5.) Privacy
- 6.) Government Documents
3Requirements
- Project Requirements
- 1.) Project must be capable to encrypt/decrypt
images - 2.) Project must incorporate pseudo random
number generation into cipher - 3.) Each pixel in the original image must have
its value changed - 4.) Each pixel in the original image must have
its position changed - 5.) Project must be capable to work on
grayscale - 6.) Have good background on existing image
encryption systems - 7.) Project should be resistant to
chosen-plaintext attacks - 8.) Project should be implemented using a
programmable language - 9.) Minimize non-uniformity in the cipher
images - 10.) Minimize pixel correlation within the
plain image
4ENCRYPTION (General)
5Hacking The Cipher
- Mask Method
- The Mask Method takes advantage of the fact that
most ciphers use the Boolean operation of XORING
to break the cipher. - Process
- 1.) You need to create a mask. To do this, you
need to XOR an encrypted image with a - plain-text image.
- 2.) You then need to XOR the mask with another
encrypted image and you should be able to
recover the original image. - Creating the Mask
XOR
Encrypted
Mask
Plain
6Importing Image Into MATLAB
- In order to import images in to MATLAB we used
the following function - Image imread()
- This function reads in the desired image as a
Xdist by Ydist by 3 matrix with the elements
being integers represented by 8-bit binary
numbers. - The read in image was a color image. To convert
the image to a Xdist by Ydist by 1matrix
(grayscale) we needed to combine the 3 primary
colors with each one weighted differently. -
- Grayscale(y,x) .2989F(y,x,1)
.5870F(y,x,2) .1140F(y,x,3) -
- This function had to be looped to convert each
pixel from - color to grayscale.
-
-
7Pseudorandom Number Generator
- Eventually we will be supplied with a
replacement from our advisors, but for our
research and data collected thus far, we have
used the following -
- We used the following function to create a
sequence of random numbers - x(n1) u x(n)(1-x(n))
- Note We needed to pick two initial
conditions for this function - 1.) x(1) Value between 0 and 1
- 2.) u Value between 3.57 and 4
- Once we had the sequence of random numbers, we
used an algorithm to take the 24-bit
representation of the sequence resulting in a
pseudorandom number sequence composed of 1s and
0s. - This binary random number sequence is compiled
of 12XdistYdist/2 elements. - Note We reference this sequence as the
function b.
8Seeds (8-bit)
- We used our b function to create two Seeds.
- To accomplish this, we sectioned off our b
function into 8-bit chunks in two different
ways - 1.) Seed1(bit(x)) b(24(k-1) x)
- 2.) Seed2(bit(x)) b(24(k-1) 8 x)
- Once we had 8 binary numbers drawn from the b
function, we multiplied them by the - corresponding values associated
with the binary number system and we were left - with a Seed.
- Ex. Seed1 1128 064 132 116 18
04 02 11 185 - Using this method, we created XdistYdist/4
elements for Seed1 and Seed2 - The Seeds then are used as Keys each Seed
gives you two Keys.
9D Function
- In order to have a selective process that is
dependent only on the random number generator, we
- created the D function.
- To do this, we apply weights to two values of
our b function as following - D 2b(24(k - 1) j ) b(24(k-1) j 1)
- Thus D can have the following values 0, 1, 2,
or 3. - Note The variables j and k are incorporated
in the for loops containing the - D function.
- Using the D function, we can now have our
Cipher more dependent on the random number
generator. -
10Chaotic Key-Based Algorithm (CKBA)
- Cipher
- Pros
- Very fast to encrypt/decrypt
- Easy to implement
- Cons
- Very easy to break the encryption
- Only uses 4 keys
- Does not reassign pixels to different positions
- Encrypted image is semi-distinguishable
Use the D (b) function to assign each individual
pixel a D value of 0, 1, 2, or 3
The corresponding value of D will determine which
of the four keys the pixel will be XORED with
The entire image will be ran though this process
until the end result is found an encrypted image
11Chaotic Key-Based Algorithm (CKBA)
- Results
- 1.) The original image read into MATLAB
- 2.) The Encrypted image
- 3.) Recovered image using the Mask Method
3
2
1
12Random Control Encryption System (RCES)
Runs through the image and swaps adjacent pixels
according to the b function
Generates a separate set of Seeds for each block
of 16 pixels
Breaks the image vector into 16-pixel blocks
Turns the image into a vector
Uses the D function to determine which of the
four Keys for that Seed to be XORED with
Takes the determined Key and XORS it with the
entire 16 pixel block
Generates a separate set of Seeds for each block
of 16 pixels
13Random Control Encryption Subsystem (RCES)
- Cipher
- Pros
- More complex than the CKBA encryption method
- Encrypted image is non-distinguishable
- Cipher is more dependent on the random number
generator - Implements a method to change the position of
the individual pixels - Fast encryption/decryption
- Dramatically increases the number of keys used
from four to XdistYdist/16 - Cons
- Most of the image can be recovered from the Mask
Method - When a pixel is moved, it is only moved one spot
to the right or left - If you acquired the ciphers code, you could
create a fixed mask - Not secure enough due to the lack change in the
position of a majority of the pixels
14Random Control Encryption Subsystem (RCES)
- Results
- 1.) Original Plain-text image
- 2.) Encrypted image
- 3.) Second Plain-text image
- (unknown to attacker)
- 4.) Second encrypted image
- 5.) Hacked second image using
- Mask Method
- 6.) Unrecovered pixels by the
- Mask Method
- (8.65)
1
2
3
4
4
5
6
15Our Proposed Cipher (In Detail)
- Cipher (Step 1)
- Selective Toggling and Shifting of Original
Image - 1.) First, we created a Look-Up table by
using Seed1 and Seed2 to create - a XdistYdist size vector referred
to as VLT. - 2.) We then reshaped our Original Image into
a vector VGF. - 3.) Next, using for loops, we compared each
bit of each element of VGF and VLT. - 4.) Whenever a bit of VLT was a 1, we would
toggle the corresponding bit - of VGF and increment a variable
Shift by one. - 5.) Once 8-bits were compared, we then
shifted that 8-bit number Shift times to the
right.
16Our Proposed Cipher (Graphical)
- Cipher (Step 1)
- Selective Toggling and Shifting of Original
Image -
10001111
"VLT"
Shift 5
11101001
"VGF"
________
01100110
00110011
After Toggle
17Our Proposed Cipher (In Detail)
- Cipher (Step 2)
- Vector Look-up Table and Temp Pixel XORING
- 1.) First, we create a vector Look-Up VLT2
(only 255 elements) table using the look-up
table from the Selective Toggling and Shifting of
Original Image step and Seed2. - 2.) Next, we create a Seed-generated Key
Vector the same size as our Original Image
Vector IV. - 3.) We then XOR each element in the VLT2
and the IV to leave us - with our Temp Pixel Vector TPV.
- 4.) Now we take 8-bit integer value of each
element of TPV and XOR it with the
corresponding element of the VLT2(TPV). -
18Our Proposed Cipher (Graphical)
- Cipher (Step 2)
- Vector Look-up Table and Temp Pixel XORING
-
10110011
01001110
11111101
Ã…
Key
Image Pixel
Temp Pixel
253
11111101
11011001
00100100
Ã…
Element Number
____ ____
255
1
X
......
Vector Look-Up Table
19Our Proposed Cipher (In Detail)
- Cipher (Step 3)
- Seed1 Shuffle/ Seed2 Shuffle
- 1.) First we reshaped Seed1 and our image
into vectors. - 2.) We then rip apart our Image vector into
two separate vectors, the bit values of the
Seed1 vector determine how the 8-bit elements of
our image vector are separated into the two
sub-vectors. - 3.) Once we have successfully spilt the image
vector into two vectors, we then tie them back
together. - 4.) Next, we repeat the process once more,
but this time the Seed2 vector will determine
how the image vector is split up. -
20Our Proposed Cipher (Graphical)
- Cipher (Step 3)
- Seed1 Shuffle/ Seed2 Shuffle
-
...1101...
...11101001,10001001,10001011,00000110...
Vector 1
Vector 1
Vector 1
Vector 0
____
________
____
Vector 0
Vector 1
Shuffled Vector
21Our Proposed Cipher (In Detail)
- Cipher (Step 4)
- D Function Block XORING
- 1.) First, we take our image vector and break
it into blocks of 16 pixels. - 2.) Then, we assign four different Seed-based
Keys to each block. Each Key is mapped to a
value of the D Function. - 3.) Next, we use the D Function and the
head pixel of the block to decide which of the
four Keys should be XORED with the block. - 4.) We have also designed a small routine
that is embedded in this section of code that
sets a flag whenever D is equal to zero it
remaps how the Keys relate to the D Function. - 5.) Block by block, the entire image vector
is XORED with the Seed generated Keys.
22Our Proposed Cipher (Graphical)
- Cipher (Step 4)
- D Function Block XORING
-
Key 1
D0
Key 1
D0
Key 2
D1
Key 2
D1
If D0
Key 3
D2
Key 3
D2
Key 4
D3
Key 4
D3
Ã…
10111010
________________
_
Block
Head Pixel
Key that is Mapped to Head Pixel's D Value
23Our Proposed Cipher (In Detail)
- Cipher (Step 5)
- D Function Block Swapping Using Head Pixel
- 1.) With our image still in vector form, we
create eight 16-element - vectors.
- 2.) We then loop through the vector image
recording the D values of the blocks of 16
pixels until it found two of the same value. - 3.) Once we found two head pixels with the
same value, we swapped the two blocks positions
in the image vector and reset that D values
counter. - 4.) This process is continued though the
entire image vector. - 5.) While the blocks of pixels aren't being
moved a large distance relative to the size of
the image vector (usually only 48-96 pixels), it
makes a big impact considering that we placed it
at the end of the Cipher, after all of the Seed
shuffles.
24Our Proposed Cipher (Graphical)
- Cipher (Step 5)
- D Function Block Swapping Using Head Pixel
-
D0
Head Pixel
Block
Image Vector
_
_
_
_
_
_
_
_
_
_
1
9
8
7
6
5
4
3
2
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
D3
D1
D2
D3
Left Unchanged Until Another D3 Head Pixel
_
_
_
_
_
_
_
_
_
_
1
9
8
7
6
5
4
3
2
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
Swapped Image Vector
25Our Proposed Cipher
Results 1.) Original Color 2.) Original
Grayscale 3.) Ciphered Image 4.) Original
Grayscale 5.) Ciphered Image 6.) Mask 7.) 2nd
Ciphered Image 8.) Attack Result 9.) 2nd Original
Grayscale
3
2
1
Ã…
6
5
4
Ã…
8
7
6
9
26Our Proposed Cipher (Results)
- Pros
- Increased complexity
- Resistant to basic chosen-plaintext attacks
- Cipher is more dependent on the Random Number
Generator - Dramatically increased how a pixels position is
changed - Encrypted image is non-distinguishable
- Attack via Mask Method is non-distinguishable
- Easy to switch out Seeds if needed (New u and
x(1) values)
- Cons
- Cipher currently takes too long to encrypt
- Vector Look-up Table and Temp Pixel XORING needs
more work - Cipher is composed of a lot of steps (Adding to
time issue) - Cipher currently only works in grayscale
27Budget
28Next Semester
- Things to Do
- Work on Time Issues in code
- Work on Symmetry of Look-Up Table
- Use Cryptanalysis to determine Cipher Security
- Tweak Cipher to Handle Color Images
- Test Each Individual Step of Cipher
- Take Out Non-Efficient Steps of Cipher
- Enable Cipher to Encrypt Images of Varying Sizes
- Make Cipher into Executable File
-
29Revised Time Line
- Week1 - Week4 ? Use Cryptanalysis to Determine
Cipher Security - Week5 ? Work on Symmetry of Look-Up Table
- Week6 ? Work on Time Issues in Code
- Week7 Week8? Test Each Individual Step of
Cipher - Week9 ? Take Out Non-Efficient Steps of Cipher
- Week10 Week12 ? Tweak Cipher to Handle Color
Images - Week13 ? Make Cipher into Executable File
- Week14? Clean Up Code and Make Sure Everything is
Running Smoothly - Week15 ? Present Project
30Summary
- Recap CKBA
- Recap RCES
- Recap Our Proposed Cipher
- Whats Left to Do
31Questions?
????????