An Improved Steganographic Technique Based on Diamond Encoding Method: [Essay Example], 2099 words GradesFixer

Haven't found the right essay?

Get an expert to write your essay!


Professional writers and researchers


Sources and citation are provided


3 hour delivery

This essay has been submitted by a student. This is not an example of the work written by professional essay writers.

An Improved Steganographic Technique Based on Diamond Encoding Method

Print Download now

Pssst… we can write an original essay just for you.

Any subject. Any type of essay.

We’ll even meet a 3-hour deadline.

Get your price

121 writers online

Download PDF

Abstract—Hiding sophisticated information in different digital media such as image, audio, video etc. is named as Steganographic Technique. LSB is most commonly used technique in this field. Quantity of data and quality of media are two important thing while hiding information. Exploiting modification direction (EMD) method maintain these two terms. Its use an equation to hide data and also use the same equation to extract it from receiver side. EMD method uses the relationship of n adjacent pixels to embed the secret data. This method can hide (2n+1)-ary notational secret digit into n cover pixels. Based on this method R. M. Chao et al. proposed Data Hiding Scheme with Diamond Encoding (DEMD) method which can embed (2k^2+2k+1)–ary secret data in a pair of pixel. Our proposed method is extension of DEMD method. A reference matrix is required for this method on the other hand our method doesn’t need this matrix and also overcome the overflow problem.

Keywords— Cryptography, Steganography, PSNR, Exploiting modification direction, Security.


Cryptography and Steganography are two most common techniques in security system. Cryptography is related to cryptology and cryptanalysis. There are many encryption technique such as RSA [1], DES [2] convert the secret message into a plain text called cipher text. Then the cipher text is decrypted by the receiver into original message. Steganography hide the secret information into digital media (such as image, audio, video etc. called cover object) in a way that it seems meaningless to the attacker. When an image is used as cover its called image steganography. For embedding information in a cover image LSB [3] is the simplest technique proposed by Turner in 1989. In LSB method, the least significant bit is changed by the secret key message bit. In RGB images it has 3 color components: Red, Green, and Blue. Each pixel consists of 3 bytes. So, we can hide 3 bits in each pixel. In 2006, Mielikainen proposed another method named LSB matching method [4] which reduce the number of modified pixel to increase the image quality and avoid direct replacement. So as far we know image quality and data capacity is most important in this study. A high capacity technique Exploiting Modification Direction (EMD) [5] method is proposed by Zhang and Wang in 2006. This method can hide (2n+1)-ary notational secret digit into n cover pixels. It only increase or decrease the pixels value by 1. Therefore a number of method has been proposed based on this method [6, 7, 8, 9] – Data Hiding Scheme with Diamond Encoding [10] (DEMD), A Formula Diamond Encoding Data Hiding Scheme [11] (Formula DEMD) is one of them. DEMD method is proposed based on EMD method, which needs a diamond characteristic value (DCV) matrix to modify the pixels. It is also improve the embedded capacity.

Formula DEMD method removes this extra space to store the diamond characteristic value and generate a mathematical formula to find the optimal value.

Our proposed method is an extension of DEMD method. This method does not require the DCV matrix. We propose two methods both of them calculate the optimal modified value through some mathematical calculations. Our experimental result provides high capacity as the previous two methods but improved the image quality. In section 4 we describe it in details. The rest of the paper is organized as follows: a brief of DEMD and Formula DEMD method, our proposed method, performance and security analysis and conclusion respectively.


In this section we will review two data hiding schemes. Image distortion and capacity is a challenge for any data hiding method. EMD method shows a way to solve this problem. DEMD and Formula DEMD are modified EMD methods which also provide a high capacity and less distortion.

DEMD Method

In 2009, R. M. Chao proposed this method. This method can embed (2k^2+2k+1)–ary secret data in a pair of pixel (p_1,p_2 ) and introduce an extract function:

f(p_1,p_2 )=((2k+1) p_1+p_2) mod (2k^2+2k+1)

Here k is an embedded parameter. The distortion absolute value of each pixel pair should not greater than k. For k=2 it can embed (2k^2+2k+1)=13 ary secret data. DCV matrix for k=2 is:

Step 1: f(5,8)=(7 x 5+8) mod 25=18

Step 2: Let t=s-f(5,8) mod 25=15

Step 3: Compute stego-values x_1 and x_2 in DCV matrix with t. Since t=15 and the stego-values for 15 are x_1=2 and x_2=1 which is circled in fig. 1

Step 4: 〖p’〗_1= p_1+ x_1 and 〖p’〗_2= p_2+ x_2

So the cover pixel pair (5,8) replace with (7,9).

Extraction: To extract data from stego-image just calculate:

f(5,9)=(7 x 7+9) mod 25=8

Example 1.2: For pixel pair (p_1,p_2 )=(1,254), secret data s=13, parameter k=3, the stego-pixel pair is (1,256) according to this algorithm.

Step 0: (p_1, p_2 )=(1, 254), s=13, k=3

Step 1: f(1, 254)=(1 x 7+254) mod 25=11

Step 2: Let t=s-f(1, 255) mod 25=2

Step 3: From DCV matrix (Fig. 1) for t=2, x_1=0, x_2=2

Step 4: 〖p’〗_1= p_1+ x_1 and 〖p’〗_2= p_2+ x_2

So the cover pixel pair (1, 254) will replace with (1, 256). We can’t replace pixel pair (1, 254) with (1, 256) because in 8 bit gray scale image the maximum value is 255. This is the limitation of this method. One the other hand our method overcome this limitation.

This method claim that its capacity is better than the EMD method. Embedded capacity is computed by 〖log〗_2 (2k^2+2k+1)/2 (bpp).

Formula DEMD Method

In 2015, Wen-Chung Kuo proposed this method. This method does not required the DCV matrix and calculate the stego-pixel pair (〖p’〗_1,〖p’〗_2) through a mathematical formula. Most important fact is that this algorithm can calculate four solution vector and one of them confirm |x_1 |+|x_2 |≤k.

Let the pixel pair〖( p〗_1,p_2), secret data s, and parameter k. Output pixel pair is〖 (p’〗_1,〖p’〗_2)

Step 1: Set f=((2k+1) p_1+ p_2 ) mod (2k^2+ 2k+1)

Step 2: Set D=(s-f) mod (2k^2+2k+1)

Step 3: Set 〖 next_x〗_2=|D| mod (2k+1)

Step 4: for i=1 to 4

x_2= 〖next_x〗_2,x_1=((D- x_2 ))/((2k+1))

if |x_1 |+|x_2 |≤k then

return〖 (p〗_1+x_1,p_2+x_2)



case 1: 〖next_x〗_2= x_2-(2k+1)

case 2: D=D-(2k^2+2k+1)

〖next_x〗_2=-(|D| mod (2k+1))

case 3: 〖next_x〗_2= x_2+(2k+1)

case 4: error

end switch

end if

end for

Example 2: Let (p_1,p_2 )=(10,12),s=20,k=3. Output stego-pixel is (12,11)

Step 1: f=(7×10+12) mod 25=7

Step 2: D=(s-f) mod 25=13

Step 3: 〖next_x〗_2=|D| mod (2k+1)=6

Step 4:


Vector 1 is (11,18) but |x_1 |+|x_2 |>k



Vector 2 is (12,11) and |x_1 |+|x_2 |≤k

return 〖(p〗_1+x_1,p_2+x_2)=(10+2,12-1)


We do not need to calculate the rest because 〖 (p^’〗_1,〖p^’〗_2)=(12,11) is optimal one. Now replace pixel pair (10,12) with (12,11)

Extraction: In receiver side just calculate, f(12,11)=(7 x 12+11) mod 25=20


In this section we will describe our proposed method. Firstly we describe the embedded method with proper example then the extraction process. Flow chat is also given for more clarity.

Proposed Method

Input: Pixel pair (p_1,p_2 ) of cover image〖 I〗_c, secret data s and parameter k

Output: 〖 I〗_s Stego-image

The extraction function introduced in DEMD method as follows:

Step 1: Calculate f(p_1,p_2 )=(ap_1+ p_2) mod M (1) Where M= (2k^2+2k+1) and a= (2k+1)

Step 2: Let, t=(s- f(p_1,p_2 )) mod M (2)

With the help of t we find two co-ordinate value x_1,x_2 such that, 〖p’〗_1= p_1+ x_1 and 〖p’〗_2= p_2+ x_2

Step 3: Now replace the pixel pair (p_1,p_2 ) with (〖p’〗_1,〖 p’〗_2 ). Do it until all data are embedded.

Step 2(Extension): In step 2, we talk about 〖p’〗_1 and 〖p’〗_2. In this extension part we will calculate this. The extraction function (1) return the secret data s. More formally:

f(〖p’〗_1,〖p’〗_2 )=s

s= (a〖p^’〗_1+ 〖p^’〗_2 ) mod M

s=((a (p_1+ x_1 )+(p_2+ x_2 )) mod M

s=(a p_1+ 〖ax〗_1+ p_2+ x_2 ) mod M

s=(a p_1+ p_2 + 〖ax〗_1+ x_2 ) mod M

s=((a p_1+ p_2) +(〖ax〗_1+x_2 )) mod M (3)

In equation (3), (a p_1+ p_2 ) mod M is nothing but the right side of equation (1)

Rewrite the equation (3)

s=((f(p_1,p_2 ) +(〖ax〗_1+x_2 ) mod M) mod M

Now we have to find the unknown part (〖ax〗_1+ x_2 ) mod M

Recall the equation (2)

t=(s- f(p_1,p_2 )) mod M

s=(f(p_1,p_2 )+t) mod M

s=((a p_1+ p_2) mod M +t) mod M (4)

Comparing the equation (3) and (4)

t= (〖ax〗_1+ x_2 ) mod M (5)

〖ax〗_1+ x_(2 )is similar as Euclid algorithm [12]


In equation (5) a=(2k+1),b=1 and their gcd⁡(2k+1,b)=1.So, equation (5) has a solution.

If we find x_1 and x_2 then we can find a number of solution, where the next solution is:

〖x’〗_1= x_1- r b/(gcd⁡(a,b))

〖y’〗_1=y_1+ r a/(gcd⁡(a,b))

We proposed this method [6] previously in ECCE-2017, this solution takes much time to find the optimal value which avoid the overflow problem. As we mention above for any positive number k it can hide (2k^2+2k+1)-ary of data. For k=3, (2k^2+2k+1)=25 and if we calculate all possible optimal value for 0-24 we found a matrix which we called expended matrix. For example, if t=2 then there are 8 solutions in expended matrix (Fig: 3) but circled solutions are optimal. Our proposed algorithm find those four optimal solution within constant time and solutions are from four different co-ordinates one of them must avoid the overflow problem.

From equation (5)

t= (〖ax〗_1+ x_2 ) mod M (6)

Now we compare the equation (6) with division theorem:



x_2=t mod a

So we just found a solution and it must be positive because t and a both are positive. From first optimal value x_1 and x_2 we can generate three more pair from different coordinate. One of them must avoid overflow.

Pseudo code for other optimal value is given below.

for i=1 to 3 do


case (1):







case (2):







case (3):

if(〖|x〗_1 |≤k and 〖|x〗_2 |≤k)



〖else if(|x〗_2 |>k)






end switch case

end for

Extraction Process:

Input: Stego image I_s

for each pair of stego-pixel (〖p^’〗_1,〖p^’〗_2 )

s=f(〖p^’〗_1,〖p^’〗_2 )=((2k+1) 〖p^’〗_1+〖p^’〗_2 )

mod (2k^2+2k+1)

Where s is output data

Output: Hidden message

Example 3.1: For pixel pair (p_1, p_2 )=(100, 210), data s=15, and parameter k=3 embedded the data.


Step 0: (p_1, p_2 )=(100, 210), s=98, k=3

Step 1: f(100, 210)=(7 x 100+210) mod 25=10

Step 2: Let t=s-f(1, 255) mod 25=5

Step 3: x_1=5/7=0, x_2=5 mod 7=5

First pair (x_1,x_2)=(0, 5)

Step 4: Other three pairs are (1, -2);(-2, -6);(-3, 1)

This four pairs are from four different co-ordinate and all pairs are valid. We take that pair which causes less distortion that means the absolute value of difference should be less. Here pair (1, -2) possess less distortion |1|+|-2|=3. Now replace the pixel pair (100, 210) with (101, 208).


f(101, 208)=(7 x 101+208) mod 25=15

Solution of Overflow Problem:

Example 3.2: For pixel pair (p_1, p_2 )=(1, 254), data s=13, and parameter k=3, we have seen that there is an overflow in DEMD method but our proposed method can solve it.


Step 0: (p_1, p_2 )=(1, 254), s=13, k=3

Step 1: f(1, 254)=(1 x 7+254) mod 25=11

Step 2: Let t=s-f(1, 255) mod 25=2

Step 3: x_1=2/7=0, x_2=2 mod 7=2

First pair (x_1,x_2)=(0, 2)

Step 4: Other three pairs are (4, -1);(-3, -2);(-7, 1)

This four pairs are from four different co-ordinate and pair (4, -1) avoid the overflow.

So, the pixel pair (1, 254) will replace with (5, 253)


f(5, 253)=(5 x 7+253) mod 25=13

The overall extraction process in a brief:


In this section we will analysis our experimental result. The original DEMD method cannot overcome the overflow and underflow problem while adjusting the pixel value on the other hand our method generate a number of solutions we can take those solutions which do not causes overflow and underflow. Our method use some mathematical operation to find the best solution that does not require any extra space to save the solution matrix.

PSNR (Peak signal to noise ratio) is used to measure the distortion between cover and stego-image. The higher the PSNR value is the lower the distortion. It defines as:

PSNR = 10* 〖log〗_10 (〖255〗^2/MSE)

Where MSE means mean square error between those images. MSE define as

MSE = 1/(m x n) ∑_(i=1)^m▒∑_(j=1)^n▒〖 (I_c (i,j)-I_s (i,j) )^2 〗

Where I_c (i,j) and I_s (i,j) represent the pixel values of cover image and stego-image respectively and m,n are the width and height of the original image. Table 1 shows the experimental result of our proposed method considering different values of parameter k in the first column.

TABLE 1: Experimental result on our proposed scheme

Parameter k Capacity Overflow/ Underflow Payload

(bpp) PSNR


1 5 No 1.16 57.47

2 13 No 1.16 53.16

3 25 No 1.16 50.31

4 41 No 2.68 44.54

5 61 No 2.68 42.83

6 95 No 2.68 41.36

TABLE 2: Comparison among DEMD, Formula DEMD and our proposed scheme.

Method name DEMD F-DEMD Our Scheme

Parameter k 1-4 1-4 1-4

Payload (bpp) 1.16-2.68 1.16-2.68 1.16-2.68

PSNR (db) 52.1-42.9 52.1-42.9 57.3-44.54

Extra space Yes No No

We tested our proposed method with different images (512 x 512) along with different parameter of k value at payload capacity 2.61. The resultant and original image is given below:

Cover Lena (b) Cover Airplane (c) Cover Baboon

(d) Stego Lena (e) Stego Airplane (f) Stego Baboon

k = 1 k = 2 k = 3

PSNR = 53.83 db PSNR = 49.55 db PSNR = 46.68 db

Figure 5: Cover image (a – c) and Stego-image (d – f)

(g) Cover Barbara (h) Cover Pepper (i) Cover House

(j) Stego Barbara (k) Stego Pepper (l) Stego House

k = 4 k = 5 k = 6

PSNR = 44.54 db PSNR = 42.80 db PSNR = 41.36 db

Remember: This is just a sample from a fellow student.

Your time is important. Let us write you an essay from scratch

100% plagiarism free

Sources and citations are provided

Cite this Essay

To export a reference to this article please select a referencing style below:

GradesFixer. (2019, April, 10) An Improved Steganographic Technique Based on Diamond Encoding Method. Retrived April 1, 2020, from
"An Improved Steganographic Technique Based on Diamond Encoding Method." GradesFixer, 10 Apr. 2019, Accessed 1 April 2020.
GradesFixer. 2019. An Improved Steganographic Technique Based on Diamond Encoding Method., viewed 1 April 2020, <>
GradesFixer. An Improved Steganographic Technique Based on Diamond Encoding Method. [Internet]. April 2019. [Accessed April 1, 2020]. Available from:

Sorry, copying is not allowed on our website. If you’d like this or any other sample, we’ll happily email it to you.

By clicking “Send”, you agree to our Terms of service and Privacy statement. We will occasionally send you account related emails.


Attention! this essay is not unique. You can get 100% plagiarism FREE essay in 30sec

Recieve 100% plagiarism-Free paper just for 4.99$ on email
get unique paper
*Public papers are open and may contain not unique content
download public sample

Sorry, we cannot unicalize this essay. You can order Unique paper and our professionals Rewrite it for you



Your essay sample has been sent.

Want us to write one just for you? We can custom edit this essay into an original, 100% plagiarism free essay.

thanks-icon Order now

Hi there!

Are you interested in getting a customized paper?

Check it out!
Having trouble finding the perfect essay? We’ve got you covered. Hire a writer uses cookies. By continuing we’ll assume you board with our cookie policy.