Tutorials‎ > ‎

Steganography using Pixel Value Differencing (PVD) Algorithm Implemented with Java (Part 1) - PVD Description

posted Jun 17, 2015, 1:47 AM by Sujono _   [ updated Aug 15, 2016, 11:37 PM by Surya Wang ]

        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.

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.

2.     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 Rj; in other words, R = {Rj | j = 1, 2,...,n}. The major job of the range table is to provide information about the hiding capacity of each Fi. Each sub-range Rj has its lower and upper bound values, say lj and uj, so that we have
.         The width wj of each Rj is selected to be a power of 2, and can be computed by:
          Hiding capacity of two consecutive pixels can be obtained by:
           Here, ti is the number of bits that can be hidden in Fi. Read ti bits from the binary secret data stream and transform ti into its decimal value ti' . A new difference value di' can be            generated by putting lj and ti' 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 ti  value using the same method as before. 
  • Calculate the difference value of di'' with this formula:
  • Convert di'' into binary word with length of ti 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.