Data Hiding in Steganography
Introduction
In the world of computer and digital forensics, data hiding techniques play a crucial role in concealing information within seemingly innocuous files. Two commonly used methods for this purpose are Least Significant Bit (LSB) and Most Significant Bit (MSB) steganography. In this blog, we will delve into these techniques and their application using a BMP image file named Parrots.bmp.
Understanding Steganography
Steganography is the art and science of concealing data within other data in a way that is difficult to detect. It's often used for various purposes, including data security and covert communication. One of the primary domains where steganography is applied is digital images.
Applying LSB Steganography
Prepare the Image: Start with the BMP image you want to use for hiding data. For this example, let's use the image "Parrots.bmp."
The original image could be found here.
Calculate the SHA256 Hash: Calculate the SHA256 hash of the original image to ensure its integrity and for future verification.
Determine Data to Hide: Decide what data you want to hide in the image. It could be text, a message, or any other form of data.
Convert Data to Binary: Convert the data you want to hide into binary form. Each character or pixel of data should be represented by a series of 8 binary digits (bits).
Modify the Least Significant Bit: The LSB steganography method involves replacing the least significant bit of each pixel's color value (typically RGB) with a bit from your binary data. You'll need to iterate through the image pixel by pixel and replace the LSB with the corresponding bit from your binary data. Be careful not to significantly alter the pixel values to avoid visual detection.
Applying MSB Steganography
Do the first two steps above LSB and continue down here:
Convert Data to Binary: Convert the data you want to hide into binary form, just like in the LSB method. In this Case "Hasan Hashim"
Modify the Most Significant Bit: In MSB steganography, you will replace the most significant bit of each pixel's color value (typically RGB) with a bit from your binary data. This results in more noticeable changes in pixel color compared to LSB. Iterate through the image pixel by pixel and replace the MSB with the corresponding bit from your binary data.
Save the Modified Image: Once you've embedded the data using the MSB method, save the modified image with a new filename.
When applying the Most Significant Bit (MSB) method to hide data in an image, significant changes in pixel color occur, making alterations more noticeable compared to the Least Significant Bit (LSB) method. The MSB method can lead to visible artifacts, distortions, and a degradation of image quality since the most significant bit has a more substantial impact on pixel values. Additionally, lossy compression in image formats like JPEG may not preserve pixel values accurately, making the MSB method less suitable for data hiding. Data extraction from images modified using the MSB method is also more complex, and the trade-off between data hiding and image quality must be carefully considered in its use.
Important Considerations
In both methods, be cautious not to make drastic changes to pixel values, as this can make the alterations more noticeable.
The choice between LSB and MSB steganography depends on the trade-off between data hiding capacity and the visibility of changes. LSB offers higher data hiding capacity but with less visible alterations, while MSB can hide less data but results in more noticeable changes.
Always verify the integrity of the modified image by recalculating its SHA256 hash and comparing it to the original hash.
Keep in mind that steganography is used for various purposes, including data security and covert communication, and its use should adhere to legal and ethical guidelines.
Author:
Hasan Hashim
Cyber Security and Digital Forensics