DC10003 - Editorial

DC10003 - Editorial

PROBLEM
Link to the Practice Question can be found: CodeChef: Practical coding for everyone

PREREQUISITE
Steganography

DIFFICULTY
Hard

PROBLEM
Extract the secret text message hidden in the stego-image.

EXPLANATION

  1. Extract all three image-matrices for red-, green-, and blue-channels from the stego-image. Let us call them s-r-matrix, s-g-matrix and s-b-matrix.

  2. Extract all three image-matrices for red-, green-, and blue-channels from the cover-image. Let us call them c-r-matrix, c-g-matrix and c-b-matrix.

  3. Convert all the metrics in 1-D array in a row-major order

  4. The secret-message is of 27X7 = 189 bits.

  5. Hence, make loop for 189 times (I = 1 to 189). Let g-i and b-I are the indices in g-matrix and b-matrix. g-i:= 1, b-i:= 1

6.1 Find out the LSB bit value for ith pixel of r-matrix, which can be either 0 or 1.

[Thetricky part is it is not told in the problem statement for 0 which matrix and for 1 which matrix need to be chosen between s-b-matrix and s-g-matrix to get the secret bit. So we need to try both the option. Actually for 0, we have chosen s-g-matrix and for 1, we have chosen s-b-matrix. Hence we do as follows:]

6.2 if LSB is 0

6.2.1 Do bit-wise XOR between s-g-matrix and c-g-matrix, g-i := g-I + 1.

Else

6.2.2 Do bit-wise XOR between s-b-matrix and c-b-matrix, b-i :=b-I + 1.

6.3 If the XOR-result is 0, then the secret-bit is 0; else secret-bit is 1.

  1. Convert the binary stream to secret-message.

Solution:

https://drive.google.com/file/d/1IkPfgl6iUdq2zhnovuOrTLyqZkLv7FUH/view?usp=sharing