Hello, welcome back to my tutorial. In this tutorial, we will learn about Pixel Value Differencing (PVD) algorithm in Steganography and how to implemented it in Java. I hope you already understand about Java programming before read this tutorial. We will also test the effectiveness of PVD algorithm using Peak Signal Noise Ratio (PSNR). For the first part, we will learn the theory about Steganography and PVD first.

2.

Hiding capacity of
two consecutive pixels can be obtained by:

where:

**1. Steganography**

Steganography is the art of covered or hidden writing using the medium. The purpose of steganography is covert communication to hide a message from a third party. In steganography, sniffer couldn't see the real message and just can see the file which become the hiding place of the real message. This differs from cryptography, which is intended to make a message unreadable by a third party but does not hide the existence of the secret communication.

Sometimes both of the techniques used at the same time. Real message is encrypted into a cipher text, then it concealed into other files. This will complicate the sniffer to know the original message because the message is encrypted.

**Picture 1. Steganography Description**

**Picture 2. Steganography Type**

**Picture 3. Steganography with Cryptography into Music File.**

**Pixel Value Differencing (PVD) Algorithm**

Pixel-value differencing (PVD) algorithm is found by Wu and Tsai in 2003. It uses the difference value between two consecutive pixels in a block to determine how many secret bits should be embedded. It offers the advantage of conveying a large amount of message, while still maintaining the consistency of an image characteristic after data embedding. Here are the following steps of PVD algorithm:

- Given a cover image F sized MxN. Fi is a sub-block of F that has two consecutive pixels broken down by partitioning F in raster scan order such that:

- The difference value (
*di*) of P_{(i,x)}and P_{(i,y)}can be described by:

- On the other hand, design a range table R which consists
of n contiguous sub-ranges R
_{j}; in other words, R = {R_{j}| j = 1, 2,...,n}. The major job of the range table is to provide information about the hiding capacity of each F_{i}. Each sub-range R_{j}has its lower and upper bound values, say l_{j}and u_{j}, so that we have

_{j}of each R

_{j}is selected to be a power of 2, and can be computed by:

Here,

*t*is the number of bits that can be hidden in_{i}*F*. Read_{i}*t*bits from the binary secret data stream and transform ti into its decimal value_{i}*t*. A new difference value d_{i}^{'}_{i}^{'}can be generated by putting l_{j}and t_{i}^{'}together: Last, we can modified the value of P

_{(i,x)}and P_{(i,y) }using the following criteria: Now, we can replace the P

_{(i,x)}and P_{(i,y) }value from the cover image with P^{'}_{(i,x)}and P^{'}_{(i,y) }and the embedding process is accomplished. Here is the table of PVD difference value for P_{(i,x)}= P_{(i,y) }= 32 from wu and tsai:**Table 1. PVD Difference Value**

From the table above, we can conclude that the maximum total difference value between two consecutive pixels is 7. We can reduce the difference by minimalize the secret data, but the required pixels also will increase. We will use value of 2 for the secret data for this tutorial, so the maximum difference value is 2 and each binary word will be split and inserted into 8 pixels.

Now, how we can regain our message from this algorithm? It's easier to retrieve our message back than the embedding process. Here are the steps:

- Calculate the difference value between two consecutive pixels of stego-image:

- Then, we find the
*t*_{i }value using the same method as before. - Calculate the difference value of
*d*_{i}^{'' }with this formula: - Convert
*d*_{i}^{'' }into binary word with length of*t*_{i }value.

**3. Afterword**

We have reached the end of the first part for this tutorial. I hope that you begin to understand about steganography and PVD itself. In the next part, we will learn how to implemented it with Java and test the performance using Peak Signal Noise Ratio (PSNR) method.