In this part of coursework, you need to implement an LSB steganographic system in spatial domain, which should cover different ways of hiding and extracting texts and binary images (e.g. logos) into an image. You also need to demonstrate how steganalysis can be done on different settings of your LSB steganographic system. The detailed tasks are listed as follows:
? Implement a MATLAB function for LSB embedding. This function should match the following description.
o The interface should be function stego_image = LSB_embed(cover_image, plaintext, key_embed, key_encrypt, channel).
o The function embeds a (possibly encrypted) plaintext in a particular channel of a (true-color or gray-scale) cover image and returns the stego-image.
? Hint 1: Use num2bit function in the Crypto package to convert a textual message into a bitstream for embedding.
? Hint 2: The size of the plaintext can be obtained by size function. You should check if the plaintext size exceeds the maximum capacity of the cover image. If this happens, return with an error message.
o The plaintext is embedded into the cover image by substituting the LSBs of selected pixels.
o When key_embed is empty, use the sequential path for embedding.
o When key_embed is not empty, use it to generate a random path for embedding.
? Hint: To generate a random path, first invoke the RC4 cipher in the Crypto package to produce a pseudorandom byte-stream and then invoke sort function to get the random path (the second output argument of sort function). To this end, you will need to send the RC4 cipher a 1-D plaintext having the same number of elements as the cover image. To make your code simpler, you are recommended to use a zero matrix zeros(1,numel(cover_image(:,:,channel))). Remember to use the same at the extractor side to reproduce the same pseudorandom byte-stream.
o When key_encrypt is not empty, the plaintext should be encrypted before embedding. You can use the MATLAB Crypto package in ULearn.
o The last three input arguments should have default values: key_embed = '', key_encrypt = '', channel = 3 (true-color image: blue channel) or 1 (gray-scale image: the only channel). This means that the function can be invoked without giving the last three arguments or part of them.
o If the plaintext exceeds the maximum capacity of the cover, print an error and return the cover image without embedding.
? Implement a MATLAB function for extracting the hidden message from a stego-image returned by your LSB_embed function. This function should match the following description.
o The interface should be function plaintext = LSB_extract(stego_image, plaintext_size, key_embed, key_encrypt, channel).
o The second input argument plaintext_size should be a scalar for embedded texts and a 2-tuple vector for embedded binary images.
? Example 1: plaintext_size = 200 for an embedded textual message