Steganography Part-2 HEETHESH VHAVLE BMS COLLEGE OF ENGINEERING
Steganography Part-2 H E E T H E S H V H A V L E B M S C O L L E G E O F E N G I N E E R I N G
Steganography
Hiding messages within other files Like images, audios, videos, webpages…
Steganography Hiding the existence of messages
JPEG Images
Steps Involved
1. Preprocessing
2. Transformation
3. Quantization
4. Encoding
Step 1: Preprocessing First step is to convert red, green, blue color
channels to YCbCr space.
Y – Luminance CbCr – Chrominance
Human eyes are more sensitive to Luminance
channel than the chrominance channel.
Grayscale images contain only Luminance Channel.
Step 1: Preprocessing Partition the images into blocks of 8x8 pixels
Step 1: Preprocessing Partition the images into blocks of 8x8 pixels
Step 1: Preprocessing Partition the images into blocks of 8x8 pixels
5 176 193 168 168 170 167 165
6 176 158 172 162 177 168 151
5 167 172 232 158 61 145 214
33 179 169 174 5 5 135 178
8 104 180 178 172 197 188 169
63 5 102 101 160 142 133 139
51 47 63 5 180 191 165 5
49 53 43 5 184 170 168 74
Pixel intensities of the block row 4, block column 28.
Step 1: Preprocessing Subtract 127 from each pixel intensity in each block
5 176 193 168 168 170 167 165
6 176 158 172 162 177 168 151
5 167 172 232 158 61 145 214
33 179 169 174 5 5 135 178
8 104 180 178 172 197 188 169
63 5 102 101 160 142 133 139
51 47 63 5 180 191 165 5
49 53 43 5 184 170 168 74
Pixel intensities of the block row 4, block column 28.
-122 49 66 41 41 43 40 38
-121 49 31 45 35 50 41 24
-122 40 45 105 31 -66 18 87
-94 52 42 47 -122 -122 8 51
-119 -23 53 51 45 70 61 42
-64 -122 -25 -26 33 15 6 12
-76 -80 -64 -122 53 64 38 -122
-78 -74 -84 -122 57 43 41 -53
Pixel intensity values less 127 in block row 4, block column 28.
Step 2: Transformation Transformation from Spatial Domain to Frequency
Domain to separate out the high and low frequencies.
JPEG compression algorithm uses the Discrete Cosine Transform (DCT).
That’s a lot of computation!
(Around 4096 computations for each block)
Step 2: Transformation
Humans are unable to see aspects of an image that are at really high frequencies. Since taking the DCT allows us to isolate where these high frequencies are, we can
take advantage of this in choosing which values to preserve. By multiplying the DCT matrix by some mask, we can zero out elements of the matrix, thereby freeing
the memory that had been representing those values
Step 2: Transformation
-27.500 -213.468 -149.608 -95.281 -103.750 -46.946 -58.717 27.226
168.229 51.611 -21.544 -239.520 -8.238 -24.495 -52.657 -96.621
-27.198 -31.236 -32.278 173.389 -51.141 -56.942 4.002 49.143
30.184 -43.070 -50.473 67.134 -14.115 11.139 71.010 18.039
19.500 8.460 33.589 -53.113 -36.750 2.918 -5.795 -18.387
-70.593 66.878 47.441 -32.614 -8.195 18.132 -22.994 6.631
12.078 -19.127 6.252 -55.157 85.586 -0.603 8.028 11.212
71.152 -38.373 -75.924 29.294 -16.451 -23.436 -4.213 15.624
DCT values in block row 4, block column 28.
Step 2: Transformation
Step 3: Quantization
The next step in the JPEG algorithm is the quantization step. Here we will make decisions about values in the transformed image - elements near zero will
converted to zero and other elements will be shrunk so that their values are closer to zero. All quantized values
will then be rounded to integers.
Quantization makes the JPEG algorithm an example of lossy compression.
Step 3: Quantization To quantize the above block, the JPEG algorithm first divides each element by a prescribed value and then
rounds the result to produce integers. The values that are used in the element-wise division step are given in
matrix Z below:
Step 3: Quantization
-2 -19 -15 -6 -4 -1 -1 0
14 4 -2 -13 0 0 -1 -2
-2 -2 -2 7 -1 -1 0 1
2 -3 -2 2 0 0 1 0
1 0 1 -1 -1 0 0 0
-3 2 1 -1 0 0 0 0
0 0 0 -1 1 0 0 0
1 0 -1 0 0 0 0 0
DCT values in block row 4, block column 28.
Step 3: Quantization
Step 4: Encoding
The last step in the JPEG process is to encode the transformed and quantized image. The regular JPEG
standard uses an advanced version of Huffman coding. The original image has dimensions 160 x 240 so that
160*240*8 = 307,200 bits are needed to store it to disk. If we apply Huffman coding to the transformed and
quantized version of the image, we need only 85,143 bits to store the image to disk. The compression rate is about
2.217bpp. This represents a savings of over 70% of the original amount of bits needed to store the image!
JPEG Steganography
JPEG Steganography
There are various different steganography techniques for JPEG images. One of the most common and popular one is
the LSB Steganography technique!
Various other algorithms include the F5 algorithm which uses a password using permutations
using a random generator.
Some more advanced algorithms are available such as the SWAP DCT algorithm.
Why the LSB method? Image: 100x50
Total: 5000 pixels
1 pixel -> 3 Bytes (R: 1 byte, G: 1 byte, B: 1 byte)
R: 1000 0010 G: 1010 0111 B: 0110 1001
Total of 5000 bits for hiding Or 625 bytes (5000/8)
And this is just using 1 bit from each channel
JPEG Steganography
Some popular tools include:
Virtual Steganography Laboratory
StegJpeg
JSteg
Files such as images, audio, video and even this PPT file can be embedded in a JPEG image!
JPEG Steganalysis
Uses Chi-Square attack to detect typical histogram change. Difference between the theoretical expected frequency.
Can be categorized as first order statistical attack.
JPEG Steganalysis
Some other statistical methods for StegAnalysis include:
Steganalysis Using Markov Model
Using SVM (Support Vector Machine) Classifier
(Basically this is pattern recognition) Train it Predict it
Questions?
Thank You!