You are on page 1of 17

i

ii

ABSTRACT
I mage encryption based on Cipher Block Chaining (CBC) algorithm and
Chaotic Tent Map (CTM)

By : Maklon Jacob Frare
0906082547

* Adriana Fanggidae, ST., M.Cs (First supervisor)
**Bertha S. Djahi , S.Kom., MT (Second supervisor)


To used convensional algorithm like IDEA, DES, AES and RSA not
suitable to image of encryption because the image have characteristic is data of
redundancy, correlation that powerful in the pixels is nearly and not sensitive then
text data. Combination of CBC algorithm and CTM function already modificate
with take first valve from thecnique session keys can to be over that characteristic.
Result of experiment use four test to 40 image grayscale and 40 image true color
that to see algorithm that suggested have good quality and save to many attack . It
is proved with level a test to see cipher-image with its histogram visualy see of
one kindful, level totally of value a correlation coeffecient = 0,001149, PSNR =
7.838888 dB, NPCR = 99,60383%, UACI = 33,4855%, MAE = 85,99817%,
sensitive to small change of keys and dispute value of correlation coeffecient in
the original image and decryption image resullt = 0. It is that system can to return
original image.

Keywords: Digital image, encryption, CBC, CTM, session keys
iii

TABEL OF CONTENTS
ABSTRACT ...................................................................................................... ii
BAB I Introduction .......................................................................................... 1
BAB II Landasan Teori ................................................................................... 2
2.1 CBC algorithm ........................................................................................ 2
2.2 Session keys thecnique ............................................................................ 2
2.3 Cutter function ........................................................................................ 2
2.4 CTM function .......................................................................................... 3
BAB III Research Method ................................................................................ 3
3.1 Research data ......................................................................................... 3
3.2 Modification CBC algorithm .................................................................. 3
3.2.1 Session keys ................................................................................... 4
3.2.2 Generating keys .............................................................................. 4
3.2.3 Encryption and decryption ............................................................. 5
BAB IV Results and disscusion ........................................................................ 6
4.1 Results .................................................................................................... 6
4.1.1 Encryption and decryption ............................................................. 7
4.2 Disscusion ............................................................................................... 7
4.2.1 Measurement of encryption quality ................................................ 8
4.2.2 Correlation coeffesien analysis ...................................................... 8
4.2.3 Different attack ............................................................................... 10
4.2.4 Sensitivity analysis ......................................................................... 11
4.2.5 Authentic image analysis ............................................................... 12
BAB V Conclusion and Suggest ....................................................................... 12
5.1 Conclusion .............................................................................................. 12
5.2 Suggest .................................................................................................... 13
REFERENCES .................................................................................................. 14

1

BAB I Introduction
Data encryption techniques with conventional algorithms such as IDEA,
DES, AES) and RSA encryption are less suitable for the digital image in real time
communication (Pareek et al., 2006). This occurs because the digital image that
has some characteristic is data redundancy, strong correlation between adjacent
pixels and less sensitive than text data so that a small change in the value of a
pixel image would not drastically degrade image quality and capacity (Pareek et
al., 2006). The solution to this problem is a block cipher algorithm. One form a
block cipher algorithm is Cipher Block Chaining (CBC).
CBC algorithm is a block cipher algorithms that implement feedback
mechanisms on a block by performing an XOR function between the plain-image
with a key. This algorithm still has a weakness in the key, which is used key is
always the same in each block of plain-image so as not to reduce the redundancy
of data and correlation of the pixels in a digital image while performing
encryption (Munir, 2012). Therefore, the solution to this problem is to add a
random number at the key so that each block of plain-image and cipher-image has
a different key. One method for generating random numbers is chaos.
According to Munir (2012), chaos becomes an attractive topic in
cryptography because of three reasons: (i) sensitive to the conditions, (ii) random
behavior and (iii) does not have a recurring period. One form of chaos functions
are Chaotic Tent Map (CTM), which is a mapping function that is capable of
performing one-dimensional random motion resulting in the unique conditions of
each initial condition (Borujeni & Eshghi, 2009). CTM method still has the
disadvantage of random numbers are generated while the numerical keys required
for encryption-decryption must be shaped characters or letters. These weaknesses
can be overcome with the use of a technique session keys, where the technique is
used to change the key of the form of characters or letters into a numerical form
(Pareek et al., 2006).


2

BAB II Landasan Teori
2.1 Algoritma CBC
CBC including the symmetric algorithms that operate in the block cipher.
This mode implements a feedback mechanism on a block, which in this case
results in the encryption of the previous block-bait-turn into the encryption of the
current block (current) (Munir, 2004). Scheme of CBC mode can be seen in
Figure 1.

Figure 1 CBC mode (Stallings, 2005)
where:
i = Time = block of plaintext and ciphertext
(1,,N).
Ci-1 = ciphertext before Ci.
K = Key.
N = many of block E = Encryption
Pi = plaintext to-i. D = Decryption
Ci = ciphertext to-i.
2.2 Session keys thecnique
These weaknesses can be overcome with the use of a technique session
keys, where the technique is used to change the key of the form of characters or
letters into a numerical form (Pareek et al., 2006).
2.3 Cutter function
Cutter function is a technique to convert a real number into an integer form
(Munir, 2006. Calculation for cutter function can be found using the formula
(Munir, 2012):
(, ) = 10

, 0 (2.1)
3

where T is a function of x and size, x [0,1], size is the length of the desired
integer value of x while the count is 1 and incremented by 1 until x * 10count >
10 size 1.
2.4 CTM function
Tent map included in the one-dimensional mapping system means being
able to do simple irregular motion (Klages, 2008). CTM function can be defined
as follows (Borujeni & Eshghi, 2009):

+1
=

, 0

1
,

1
(2.2)
where xk [0,1], x0 is the initial condition and the value of a system parameter p
where p [0,1]. Function of equation (2.2) will be said to be chaotic if 0 <p <1
and p 0.5 (Borujeni & Eshghi, 2009).

BAB III Research Method
3.1 Research data
The data used in this study is that the original image is obtained from the
internet, where the image is entered by the user in the form of 40 grayscale images
and 40 RGB color image with varying sizes, ranging in size from 100 x 100 to
1024 x 1024.
3.2 Modification CBC algorithm
Pada In the original CBC mode, the keys used in each block of the same.
Therefore, the proposed CBC mode using a different key each block. Each key is
derived from the random numbers generated by chaos function (CTM). Schematic
of the CBC mode is made can be seen as in figure 2 and figure 3.
3.2.1 Session keys
This section will discuss the steps to change the key characters into a
numeric value is used in the function aka CTM. The proposed algorithm uses a
key length of 16 characters for decimal or 128-bit.
=
1
,
2
, ,
16

Where
1
,
16
is a key character used. The steps used to find
0
is as follows:

4

1) Each character is converted into a form ASCCI.
=
1
,
2
,
16

where,
1
until
16
present 8-bit binary of each character key.

2) Cut 16 karkter the key of each piece that is 4 karakter.Potongan i =

1

2

3

4
pieces ii =
5

6

7

8
, pieces iii =
9

10

11

12
, pieces v
=
13

14

15

16
.
3) Looking
01
,
02
,
03
dan
04
using these pieces. Here is presented a
search
01
pieces i.

01
= (
1,1
2
0
+
1,2
2
1
++
1,8
2
7
+
2,1
2
8
+
2,2
2
9
+
+
2,8
2
15
+
3,1
2
16
+
3,2
2
17
++
3,8
2
23

Looking
01
using
01
,
02
,
03
,
04
following: ()

0
= (
01
+
02
+
03
+
04
) 1
3.2.2 Generating keys
Key generation steps can be explained as follows:
1) Determination of the initial iteration using equation (2.1).
2) Generating random numbers using the key equation (2.2).
3) Generating random numbers is a total shift bits image pixel using equation
(2.2). To obtain the first random number, the value of x0 which has gained
inserted into equation (2.2) to produce a value CTM1 obtained through the
initial iteration of step 1, then the value CTM1 cut with equation (2.1) with
the desired size. To obtain the amount of random numbers next shift, then
x0 is a key value of CTM second and so on until CTMN.

3.2.3 Enkripsi dan dekripsi
This section will describe the algorithm for encryption and decryption.
1) Algoritma enkripsi
a. Put plain-image, key and block sizes,
b. For plain-image blocks according to the size of the block,
5

c. Perform functions of CTM and cutting functions to generate
random number key row and the total shift,
d. Perform CBC operations and pixel shift to the right by a total shift,
e. Results encryption (cipher-image).

2) Algoritma dekripsi
a. Put cipher-image, and the key block size,
b. For plain-image block according to the block size,
c. Perform CBC operation and shift pixels to the left of the total shift,
d. Perform functions of CTM and cutting functions to generate
random number key row and the total shift
e. Decrypted (plain-image).
Enkripsi Enkripsi
P1
IV
(K1)
Pergeseran
bit ke kanan
C1
P2
Enkripsi
Pergeseran
bit ke kanan
C2
CTM1
Pergeseran
bit ke kanan
CN
PN
. . . . . .
CN-1
(K2)
BaK1
T1,u
BaT1,u
CTM2
BaK2
T2,u
BaT2,U
CTMN
BaKN
TN,u
BaTN,u
(KN)
Figure 2 modification CBC encryption procces scheme

6

CN
Dekripsi
C1
P1
C2
Dekripsi
P2
Dekripsi
PN
. . . . . .
Pergeseran
bit ke kiri
Pergeseran
bit ke kiri
Pergeseran
bit ke kiri
IV
CN-1
(K1) (K2) (KN)
T1,u T2,u TN,u
CTM1
BaT1,u BaK1
CTM2
BaT2,u BaK2
CTMN
BaTN,u BaKN
Figure 3 modification CBC decryption procces scheme
where:
CTM = decimal value of the function CTM
BaK = keys random number from CTM
T = total bits to shift
each pixel in the block
BaT = random number the number of
shifts of CTM.
u = 1,2, ..., the size of the block.
j = 1,2,...,N

BAB IV Results and disscussion
The proposed algorithm is simulated on the test images of 40 grayscale
images (10 images gryascale used for each test) and 40 true color image (10 true
color images are used for each test), with 4 kinds of testing.
4.1 Results
The results consist of the results of encryption and decryption process are
tested based on 4 tests: (i) test 1 (mod image size blocks = 0 and block size =
image size), (ii) test 2 (mod image size blocks = 0 and block size <size images),
(ii) test 3 (image size 0 mod block and the block size> image size) and (iv) test
4 (mod image block size and block size 0 <size of the image)..
4.1.1 Encryption and decryption
The first thing that is done to test the encryption and decryption of the
plain-image and cipher-image and the key is to determine the block size. Key and
the size of these blocks into the security of the plain-image that has been tested.
The key used for encryption and decryption process is "maklonjacobfrare". Figure
7

4 shows the results meerkat.bmp image encryption with block size = 500 and
cameramen.jpg image with block size = 320, while Figure 5 shows the result of
decryption with the same block size.






(a) (b) (c) (d)
Figure 4 Encryption results (a) and (b) plain-image and cipher-image
meerkat.bmp (c) and (d) plain-image and cipher-image
cameramen.jpg





(a) (b) (c) (d)
Gambar 5 Decryption result (a) and (b) cipher-image and plain-image
meerkat.bmp (c) and (d) cipher-image and plain-image
cameramen.jpg

4.2 Disscusion
Performance and the level of security using encryption quality
measurement, statistical analysis, a differential attack, the key length analysis, key
sensitivity analysis and block as well as the authenticity of the image analysis
(image authentication). Performance testing and security testing image is divided
into 4 equal as encryption decryption test results.
4.2.1 Measurement of encryption quality
Measurement of encryption quality is measured using peak signal to noise
ratio (PSNR). PSNR calculation is done by using the formula (Pareek, 2012)
MSE =
1

=1

=1
|(, ) (, )| (3.1)

PSNR = 20 log
10
(
255
(MSE)
) (3.2)
where W and H are the width and height of the image, p (i, j) is a plain-image, c
(i, j) is the cipher-image. PNSR value test images can be seen in Table 1.
8

Tabel 1 Average value of test image












Table 1 shows the total average PSNR of testing 1-4 smaller than the 7,838888 dB
10dB. This indicates that the cipher-image produced is very good and robust
against attacks.
4.2.2 Analysis of the correlation coefficient
Testing is done by taking the correlation coefficient 5000 pixels image
pairs are adjacent. Distribution of correlation of adjacent pixels in the
plain-image and cipher-image of each tested in the horizontal position,
vertical and diagonal.Perhitungan correlation coefficient can be solved
using the formula (Munir, 2012; Sam et al., 2011)

=
(, )
()()
(3.3)

(, ) =
1

()][

()] (3.4)

=1


() =
1

()]
2

=1
(3.5)

() =
1

(3.6)

=1


() =
1

()]
2

=1
(3.7)

() =
1

(3.8)

=1



Testing image Type
Value PSNR
(dB)
Average
1
Grayscale 8,3552
7,80975
True color 7,2643
2
Grayscale 8,4474
7,8725
True color 7,2976
3
Grayscale 8,4209
7,8426
True color 7,2643
4
Grayscale 8,3767
7,8307
True color 7,2847
Total rata-rata 7,838888
9

Table 2 Value of correlation coefficient plain-image
Testing
Image
Type
Correlation coefficient average value
Average Average
Horizontal Vertical Diagonal
1
Grayscale 0,8695 0,9024 0,6672 0,8130
0,8064
True color 0,8818 0,8837 0,634 0,7998
2
Grayscale 0,8695 0,9024 0,6672 0,8130
0,8064
True color 0,8818 0,8837 0,634 0,7998
3
Grayscale 0,8695 0,9024 0,6672 0,8130
0,8064
True color 0,8818 0,8837 0,634 0,7998
4
Grayscale 0,8695 0,9024 0,6672 0,8130
0,8064
True color 0,8818 0,8837 0,634 0,7998
The average total 0,8064

Tabel 3 Rata-rata nilai korelasi koefesien cipher-image
Pengujian Tipe citra
Rata-rata nilai korelasi koefesien
Rata-rata Rata-rata
Horisontal Vertikal Diagonal
1
Grayscale 0,0029 -0,0035 -0,0026 -0,0032
-0,00255
True color 0,0021 0,0023 -0,0063 -0,0019
2
Grayscale 0,0027 -0,0002 -0,0029 -0,0004
0,0012
True color 0,0005 0,0028 -0,0005 0,0028
3
Grayscale 0,0029 -0,0035 -0,0026 -0,0032
-0,00255
True color 0,0021 0,0023 -0,0063 -0,0019
4
Grayscale -0,0008 -0,004 0,0013 -0,00012
-0,00069
True color -0,000 0,0024 -0,0037 -0,00023
Total rata-rata 0,001149
Table 2 shows the average total value of the correlation coefficient of the plain-
image test images of test 1-4 nearing the 0,8064. Table 3 shows the average total
value of the correlation coefficient cipher-image test images of the 1-4 test that
close to 0 is 0,001149. It is proved that the proposed algorithm successfully
removes the correlation of pixels adjacent image.
4.2.3 Differential attack
Changes the pixels in the plain-image caused major changes in the cipher-
image so that making a differential attack becomes useless. The parameters used
for these tests NPCR, UACI and MAE (Pareek et al., 2006; Gupta & Silakari,
2011).
.
MAE =
1

=1

=1
|(, ) (, )| (3.9)
10

NPCR =
(, )

100% (3.10)

(, ) =
1, _1(, ) _2(, )
0,


UACI =
1

[
|_1(, ) _2(, )|
255
] x 100% (3.11)
,

where W and H are the width and height of the image, c (i, j) = cipher-image, p (i,
j) = plain-image, c_1 (i, j) = cipher-image1, c_2 (i, j) = cipher-image2.
Tabel 4 Value of differential attack test image
Testing Image type
Value differential attack
NPCR (%) UACI (%) MAE (%)
1
Grayscale 99,5962 33,5118 80,5436
True color 99,6021 33,5144 91,6723
Average 99,59915 33,5131 86,10795
2
Grayscale 99,5985 33,4526 80,2435
True color 99,6136 33,416 91,414
Average 99,60605 33,4343 85,82875
3
Grayscale 99,5962 33,5118 80,5436
True color 99,6021 33,5144 91,6723
Average 99,59915 33,5131 86,10795
4
Grayscale 99,6155 33,4273 80,3901
True color 99,6065 33,5357 91,506
Average 99,611 33,4815 85,99817
Average total 99,60383 33,4855 85,99817
Table 4 shows the average total attack value of different test images of the 4 test
NPCR = 99,60383%, 33,4855% and UACI = MAE = 85,99817%. It is proved that
the algorithm proposed in this study are resistant to various attacks cryptanalyst.
4.2.4 Sensitivity analysis
Sensitivity analysis used is a key sensitivity analysis and sensitivity
analysis of blocks that can be described as follows:
1) Key sensitivity analysis
The ideal image encryption should be sensitive to small changes in the key
are used. Changes one bit in the key should produce a major change in the
cipher-image. Key used for encryption "maklonjacobfrare" while for
decryption 1 and 2 used the decryption key "caklonjacobfrare" and
"maklonjacobfrari" on the Most Significant Bit (MSB) and least significant
bit (LSB).

11

Tabel 5 Key sensitivity result of test image
Testing Image type NPCR (%)
1
Grayscale 99,6131
True color 99,59988
Average 99,60649
2
Grayscale 99,6016
True color 99,60407
Average 99,602835
3
Grayscale 99,61309
True color 99,59708
Average 99,605085
4
Grayscale 99,59739
True color 99,58019
Average 99,58879
Average total 99,6008
Based on the results in Table 5 Obtained key sensitivity test images, where
the average total value of NPCR = 99,6008%. This shows that the
proposed algorithm is very sensitive to changes in the key so resistant to
brute force attacks.
2) Block size sensitivity
The block size used in the encryption of the image must be sensitive so
cryptanalyst difficult to obtain the original image. To use the encryption
block size specified while decryption 1 and 2 used decryption block size
and block size-1 +1 with the same key that is "maklonjacobfrare".
Tabel 6 Block size sensitivity result of test image
Testing Image type NPCR (%)
1
Grayscale 0,003394
True color 0,0039934
Average 0,003693
2
Grayscale 99,38315
True color 99,09059
Average 99,23680
3
Grayscale 0
True color 0
Average 0
4
Grayscale 97,92142
True color 97,54076
Average 97,73109
Average total 49,2429
Table 6 sensitivity results obtained block size test images, where the
average value of NPCR for testing 1 = 0,003693%, 2 = 99,23680% testing,
12

test 3 = 0, testing 4 = 97,73109% and the average total = 49,2429%. It is
proved that the proposed algorithm is not sensitive to the larger block size
with the same key.
4.2.5 Analisis keaslian citra (I mage authentication)
Analysis of image authenticity is tested using the correlation coefficient
values of the original image and the decrypted image. If the difference in the
correlation coefficient between the two images is equal to 0 then the decryption
result is a truly original image. Total average value of the correlation coefficient
of the original image and the image decryption is 0,8064. Correlation coefficient
difference between the original image and the decrypted image is equal to 0,
because the same total average is 0,8064

BAB V Conclusions and Suggest
5.1 Conclusions
1) The proposed algorithm is suitable to operate on blocks for image
encryption. It can be shown in the form of cipher-image that can not be
visually identified at 40 and 40 grayscale image true color image of the 4
tests.
2) Performance results cipher-image at 40 and 40 grayscale image true color
image can be represented by total average PSNR of 4 test < 10 dB which
is 7,838888 dB. This shows that the proposed algorithm generates the
cipher-image quality good.
3) The performance of the proposed algorithm against 40 grayscale images
and 40 true color image meets confusion and diffusion effects. This can be
evidenced by the average total value of the correlation coefficient in the
cipher-image of the 4 tests close to 0 which is 0,001149.
4) Performance of the average for the attack on 40 different testing grayscale
images and 40 images generate true color average total value of NPCR =
99.60383%, 33.4855% and UACI = MAE = 85.99817%. This shows that
the proposed algorithm is very robust and resistant to brute force attacks.
13

5) Testing conducted by changing the locks on the MSB and LSB with the
same block size indicates the sensitivity of the initial values so that the
CTM safe from attack exhaustive attack. This is evidenced by the average
total score for four test images NPCR test = 99,6008%.
6) Tests 1 and 3 testing is not sensitive to changes in the block while testing 2
and 4 are sensitive to changes in the test block This is evidenced by the
average value of NPCR test 1 = 0,003693%, test 3 = 0%, test 2 =
99,23680% , testing 4 = 97,73109% and the average total = 49,2429%.
This shows that the proposed algorithm is not sensitive to the size of a
large block with the same key.
7) The performance of the average for the authenticity of the decrypted image
40 image 40 image grayscale and true color test images provide true
authenticity. This is evidenced by the difference in the average total value
of the correlation coefficient between the original image and the decrypted
image is equal to 0.
5.2 Suggest
1) Using a block size that is not too big so sensitive to changes in the size of
the blocks with the same key.
2) Using other block cipher modes ( other than the CBC ) as OFB, ECB, CFB
and CTR to be combined with some of the functions of the chaos such as :
arnold paint binders, folders and baker Hannon folder.
3) Using a larger key length of 128-bits 256-bits is so much stronger and
longer to break the key using brute force attack.










14

DAFTAR PUSTAKA

Borujeni, S.E., & Eshghi, M., 2009, Chaotic Image Encryption Design Using
Tompkins-Paige Algorithm, Mathematical Problems in Engineering, Vol
2009 pp 1-22, doi:10.1155/2009/762652.

Gupta, K., & Silakari, S., 2011, New Approach for Fast Color Image Encryption
Using Chaotic Map. Journal of Information Security, Vol 2 pp 139-150,
doi: 10.4236/jis.2011.24014.

Klages, R., 2008, Introduction to Dynamical Systems. School of Mathematical
Sciences Queen Mary, www.maths.qmul.ac.uk/~klages/mas424/
lnotes_ds2007f.pdf, date accessed 02 july 2013.

Munir, R., 2012, Security Analysis of Selective Image Encryption Algorithm
Based on Chaos and CBC-like Mode, International Conference on
Telecommunication Systems, Services, and Applications (TSSA),
Bandung, http://informatika.stei.itb.ac.id, date accessed 19 june 2013.

Pareek, K., Patidar, V., & Sud, K.K., 2006, Image encryption using chaotic
logistic map, Image and Vision Computing, Vol 24 pp 926-934, doi:
10.1016/j.imavis.2006.02.021.

Pareek, K.N., 2012, Design and Analysis of a Novel Digital Image Encryption
Scheme, International Journal of Network Security & Its Applications
(IJNSA), Vol 4 pp 95-108, doi: 10.5121/ijnsa.2012.4207.

Sam, I.F., Devaraj, P., & Bhuvaneswaran, R.S., 2011, Block Cipher Scheme for
Image Cryptosystem Using Alternative Chaotic Maps, European Journal
of Scientific Research, Vol.51 pp 232-240, http:// www.eurojournals.com
/ejsr.htm, date accessed 24 september 2013.

Stallings, W., 2005, Cryptography And Network Security Principles And
Practices. Fourth Edition, Prentice Hall, http:/ www.filecrop.com/
84193028/ index.html, date accessed 22 september 2013.

You might also like