CHAPTER 17. STEGANOGRAPHY: HIDING INFORMATION
Steganography and cryptography are closely related. Cryptography scram-
bles a message to produce something that looks scrambled. The \write code"
example could be scrambled to be \xsjuf dpef" (replace each letter with the
letter that follows it in the alphabet). The scramble sometimes encourages
prying eyes who see it as a challenge to unscramble. Steganography instead
hides a message in a cover message. The result looks like something in-
nocent, so prying eyes often dismiss it. Lawyers and libertarians debate if
steganography is close enough to cryptography to regulate its use. To date,
steganography remains unregulated.
Awatermark adds information to a document or image by placing a logo or
seal in plain sight. The watermark protects the owner’s rights by showing
ownership. TV broadcasters commonly do this by placing their logo in a
corner of the broadcast picture. A watermark can be hidden in an image.
Hiding the watermark does not change the appearance of the image. This
protects the owner’s rights, without disturbing the image.
Figures 17.1through 17.4 show an example of hiding a watermark. Figure
17.1 shows aboy and Figure 17.2showsa watermark. The watermark is white
words on a black background. It is possible touse more complex watermarks,
but white on black simplies the program.
Figure 17.3 is the result of laying the watermark on top of the boy image.
Avalue of 20 was added to each pixel of the boy image where the watermark
image was white. This example did not hide the watermark.
Figure 17.4 shows the result of hiding the watermark on the boy image.
Avalue of 2 was added to each pixel of the boy image where the watermark
image was white. This small increase is not visible to the casual observer.
It is simple to recover the watermark by subtracting the original boy
image (Figure 17.1) from Figure 17.4.
Listing 17.1 shows the source code that hides a watermark in an image
and recovers it. The rst part of listing 17.1 is the hiding program. After
interpreting the command line, the code ensures the images are the same
size, and allocates two arrays to hold the images. The hiding operation adds
afactor to the image when the watermark image is non-zero. The last few
lines of code write the result to a le and free the memory allocated for the