0 оценок0% нашли этот документ полезным (0 голосов)
38 просмотров12 страниц
Steganography is a technique to hide information in digital media like images. The document discusses using least significant bit (LSB) embedding to hide a message in an image. In this technique, the last bit of each pixel is used to store bits of the hidden message. Functions for encoding and decoding the hidden message are presented, including embedding the bits in a random pattern to make detection more difficult.
Steganography is a technique to hide information in digital media like images. The document discusses using least significant bit (LSB) embedding to hide a message in an image. In this technique, the last bit of each pixel is used to store bits of the hidden message. Functions for encoding and decoding the hidden message are presented, including embedding the bits in a random pattern to make detection more difficult.
Steganography is a technique to hide information in digital media like images. The document discusses using least significant bit (LSB) embedding to hide a message in an image. In this technique, the last bit of each pixel is used to store bits of the hidden message. Functions for encoding and decoding the hidden message are presented, including embedding the bits in a random pattern to make detection more difficult.
and audios. Steganography using least bit embedding is implemented. In this technique last bit of each pixel of digital image is used to store hidden message. Stegnography Using Least Significant Bit Embedding
Introduction Steganography is the art and science of hiding messages so the existence of message cannot be detected by simply observation or in some cases even by complex analysis. Steganography was historically used by Greeks who used to etch the wooden surfaces and cover the pattern with wax. Another technique was to make a tattoo on the shaved head of a messenger and then make him carry the message when the hair grew. Receiver of the message would again shave off the head of messenger to get the message. In modern digital age steganography is used to hide any kind of digital data with another digital data. The carrier and the hidden message may be audio, video, images, or text. Steganography is different from encryption. Encryption secures the contents of the message in such a way that unauthorized person cant read the content even if she get encrypted message somehow. Unlike Encryption the Steganography tries to hide the existence of the message. One of the techniques of Steganography using digital media is LSB (Least Significant Bit Embedding). In this technique we hide the data in least significant bits of an image. The benefit of using this technique is that the image carrying message does not look different from original image.
2 | P a g e
Representation of Images
In a digital system, colors are most frequently represented combinations of red (R), blue (B), and green (G). Each of these primary colors is assigned a value from 0 to a maximum. This maximum is dictated by the size of the numbers used to represent the amount of the primary color. Thus, if 8 bits are used to represent the amount of a single primary color we can represent 256 hues of a single primary. Since we have three primaries, we can represent over 16 million colors with 24 bits.
Figure. 1 Matrix representation of image
For digital representation of image there are three layers (read, green and blue) in an image. Each layer is a 2D matrix as shown in above figure.
3 | P a g e
Least Significant Bit Embedding Technique Least Significant Bit (LSB) embedding is a simple strategy to implement steganography. Similar to other methods, we embed the data into the cover so that it cannot be detected by a any unauthorized person. In this technique we replace some of the information of the cover image with the data that is to be hidden. It is possible that we embed the data into an image on any bit-plane, but in LSB embedding is performed on the least significant bit(s). Hiding information on least significant bit minimizes the variation in colors that is occurred due to the embedding. For example; embedding data into the least significant bit changes the value of color by just one. Embedding into the second bit-plane can change the color value by 2. If we perform embedding on least two bits than the color of the pixel would be any of the four colors (out of Million of color combinations) even that is not visible by naked eye. Due to the very small variation in the image color the likelihood of detection is minimized. Whatever the technique we use in steganography, we always lose some information about the Cover image. This is an effect of embedding directly into a pixel. To hide the information we must discard some of the information of cover image and replace it with information from the data to hide. LSB algorithms have a choice about how they embed that data to hide. To increase the amount of useful data to be saved in the cover we can also generalize the information e.g we can change the color image into the grayscale or even black & white. Functions The complete algorithm is divided into three main functions (extra two for random Implementation) which are Main, Coder and Decoder. Some function their steps and functionality are discussed below: Steganencoder Following are the steps that this function goes through: Determining Message Type and Normalizing In this step the message type is determined i.e. text file or image; and a header is created that would be attached and hid into the cover image along with the message. This header would be required to decode the image in the decoding. Header contains information about size and type of message Ensuring Sufficient "Hiding Space" In this we are checking if the cover image has the enough space to accommodate the message we are trying to hide. Encrypting Using XOR Key In the data is encrypted using the key given by the user and then hidden into the image. This step is required and is important because even if the potential intruder determines the sequence we have used for embedding message, he would not be able to decrypt the data without the key. 4 | P a g e
The message is also converted from ASCII (decimal if image) to binary format so that bit wise hiding can be performed in next steps. Preparing Hiding Canvas Convert the image into the matrix of unsigned integers. So that in later stages we would be able to easily manipulate data mathematically. Hiding Data As the image has 3 different layers representing the intensity of RGB colors, we can hide the bits of message in any order we choose. In our implementation we have the following order: GRRGBBGR Starting from LSB of the message we hide 0 th bit in LSB of red, 1 st bit in LSB of green, 2 nd bit in LSB of blue. Now we go the next row in cover image. Now 3 rd bit is stored in LSB of blue, 4 th bit in LSB of green, 5 th bit in LSB of red. Once again we move to the next row in cover image. 6 th bit is stored in LSB red and 7 th in LSB of green. But we have also increased row index in these red and green layers of cover image. When we reach to the last row of cover image, column index is incremented and row index is set to start. Figure. 2 Bit Embedding in the pattern GRRGBBGR
5 | P a g e
Stegandecoder Actually this function performs the inverse operation of Steganocoder. Following are the steps that this function goes through for decoding the message hidden in image. Extracting header In encoding process, header of size one byte was appended to start of the message and then hidden in image. First step in decoding is to recover the header in order to get necessary information about hidden message and to take appropriate steps accordingly. Header is always in the start of image. Header Analysis - Decrypt and Determine Message Dimensions Extracted header is decoded using secret key. Header contains information about message type, i.e. text or image, and size of message. This information is extracted from header using right key.
Decode Actual Message. Since information about size of message has been extracted. Since the pattern in which bits of message was hidden in image (i.e. GRRGBBGR) is known, message can be easily extracted from cover image. Now knowing the correct key, message is decoded and saved. Steganrandomencoder This function performs the same task as steganencoder, i.e hide bits of message in cover image using order GRRGBBGR. In steganencoder function we would start from first row, hide 3 bits in RGB, increase row index, hide next 3 bits in BGR order, again increase row index and hide remaining 2 bits in order RG and go to the next row. We were going in sequential order, upon reaching the end of row we would increase column index and reset row index. In this randomized version of encoding function we chose the same pattern GRRGBBGR For hiding bits but instead of starting from first row and going sequentially, we choose a random location (pixel ) in cover image, hide least 3 bits in order RGB over that pixel. Again we choose a random location (pixel) and hide next 3 bits in BGR order. Remaining two bits are stored in another randomly selected location (pixel) in order RG. We follow this pattern until entire message is embedded in cover image. Random number generator that is used generates a random sequence avoiding repetition (i.e. permutation of natural numbers from 1 to total number of pixels in cover image) so that same pixel could not be selected more than once. A function ind2sub is used to covert this linear permutation to 2-D indexes. Steps are explained in more detail as below.
Determining Message Type and Normalizing In this step the message type is determined i.e. text file or image; and a header is created that would be attached and hid into the cover image along with the message. This header would be 6 | P a g e
required to decode the image in the decoding. Header contains information about size and type of message. This header is appended to the start of message Ensuring Sufficient "Hiding Space" In this we are checking if the cover image has the enough space to accommodate the message we are trying to hide. Encrypting Using XOR Key In the data is encrypted using the key given by the user and then hidden into the image. This step is required and is important because even if the potential intruder determines the sequence we have used for embedding message, he would not be able to decrypt the data without the key. The message is also converted from ASCII (decimal if image) to binary format so that bit wise hiding can be performed in next steps. Preparing Hiding Canvas Convert the image into the matrix of unsigned integers. So that in later stages we would be able to easily manipulate data mathematically. Generating permutation We determine total number of pixels in image (i.e. row X columns), if this total number of pixels is not divisible by 3 we decrement this number by 1. Decrement to make divisible by 3 is performed because in later steps we would arrange pixels in groups of 3 random numbers (would be clear in coming steps). Now we generate a random permutation (using seed given by user) of natural number from 1 to the total number of pixels calculated in above step. Each entry in this permutation points to a pixel in cover image. Now this permutation is arranged in groups of 3 numbers. Each group points to 3 pixels in cover image. We will use one group to hide one byte of message. Group contains 3 number because we need 3 pixels to hide 8 bits (1 pixel can hide 3 bits in its R, G, and B) Hiding Data Now we choose first group from the sets of groups (remember that group points to 3 random pixels). Least 3 bits of message is hidden in order RGB into the pixel pointed by first element of selected group. Next 3 bits are hidden into the pixel pointed by 2 nd element of selected group in order BGR. Remaining 2 bits are hidden into the pixel pointed by 3 rd element of selected group. Now next byte from message is selected along with next group from set of groups. The same pattern is repeated until the end of message is reached.
To determine which pixel (index of pixel in 2D cover image) element of a group points to we use function ind2sub. Following figure explains the concept of random permutation, groups and ind2sub function.
7 | P a g e
Figure 3 Conversion from pixel number to index in 2d image
Steganrandomdecoder
This function performs the inverse operation of steganrandomencoder i.e. it extracts and decodes message from the cover image which was encoded using random encoding function. Secret key and seed which was used for encoding is needed to decode. Following are detailed steps involved. Creating permutation and group Just like we generated a random permutation (ranging from 1 to total number of pixels in image) in encoding function, by providing the same seed and using size of image we create same permutation in this decoding function.Using the same technique this permutation is arranged into groups of 3 number, each number pointing to a pixel in image. Recovering header from cover image Since now we have the information about random locations in which message is stored (calculated in pervious step), we extract the header using pattern GRRGBBGR. Extracted header is decoded using correct secrete key (same as used for encoding). Header contains information about type and size of message. Recovering original message Since the random locations (calculated in 1 st step) and size and type of message (calculated in 2 nd step) is known, we start actual extraction and decoding of message. We pick a group from set of groups, extract one byte of message, since 3 elements of group point to 3 pixel each hiding 3 bit, and decode this byte using encryption key. This extracted byte is appended to the message, next group is picked and same process is repeated until entire message is extracted (remember size of message is known from header). 8 | P a g e
Analysis To analyze the algorithm I am going to compare some of the properties required for a good cryptographic technique i.e. Robustness, security, space and speed of algorithm. I am going to compare these properties among some of the most known staganographic techniques which are
1. Least Significant Bit Embedding Robustness This method provides high level of robustness. Due to the method of implementation even if some data of the image is corrupted via Attacker or in transmission some distortion might result in the message but whole message will not be lost. Speed and Space This method is one of the fastest methods in field of steganography due to its simple implementation. In term of space this method provides a moderate space complexity. If we increase the number of bits to be stored in a bit (increase capacity of hiding data) the space and time complexity of the algorithm increases dramatically.(Ref # 2) Security The message cannot be easily extracted from the Cover image, yet methods exist using which message can be extracted. This price is paid for the fastness and robustness.
2. JSTEG One of the drawbacks of LSB is that messages cannot be saved in JPEG image so JSTEG was introduced. Robustness Due to the quantization used in this algorithm for the compression of the image; if any data is corrupted that error is propagated to other elements thus causing greater damage to the original message. Speed and Space JSTEG algorithm is much slower than the LSB method as it needs to do extra work on quantization of the image to compress it. JSTEG algorithm embedded the messages in lossy compressed JPEG images. It has high capacity and had a compression ratio of 12%.
Security JSTEG algorithm is restricted for visual attacks and it is less immune for statistical attacks. This algorithm provides greater security than the LSB method.
9 | P a g e
Conclusion There are many techniques to implement steganography. But Least Significant Bit Embedding is commonly used as it is easy to implement. Only last bit of each pixel is used to store the information that has to be encoded. Other techniques use different methods to accomplish same task. This method can be extended to multiple least significant bits if information that has to be hidden is large. If the number of bits for hiding information is increased, the distortion in carrier image is also increased. For example in case of one bit the change will be undetectable but information storage capacity would be small. If we use more bits it will begin to modify original image visually but will provide more space for hidden message. So we have to make a tradeoff between quality and capacity.