Steganography is the practice of hiding information in other data to conceal the existence of the hidden message. This technique has been used throughout history to transmit secret information covertly and has been adapted for use in the digital age. In digital steganography, the hidden message is embedded in an image, audio file, or other digital media in a way that is not easily noticeable. The hidden message can be recovered by extracting the information from the cover media, typically using specialized software or tools.
Steganography is often used in security and privacy protection to conceal sensitive information from prying eyes. For example, a person may want to hide a confidential message in an image file and send the image file over the internet with the hope that the message will be secret.
Learning Objectives
This article was published as a part of the Data Science Blogathon.
Steganography has a long history, dating back to ancient civilizations. The word “steganography” comes from the Greek words “steganos,” meaning “covered or concealed,” and “graphie,” meaning “writing.”
One of the earliest known examples is from the ancient Greeks, who would shave the head of a messenger, tattoo a message on their scalp, and then let their hair grow back before sending them on their way. The message would be revealed only when the messenger’s hair was shaved again at their destination.
In the modern era, steganography has mainly been used for digital communication or message transmission, as computers have made it possible to conceal messages in digital files, such as images, audio, and video files, in a way that is difficult to detect.
Steganography is the practice of hiding information in other, seemingly harmless information. It is often used to conceal sensitive information, such as messages or files, in other media types, such as images or audio files. The goal is to conceal hidden information, making it difficult for an eavesdropper or other unauthorized person to detect it. This makes steganography useful for protecting information from unauthorized access or tampering.
A problem statement in steganography refers to the specific challenge or requirement the steganographer is trying to solve. Some common problem statements include:
The main function of steganography is to conceal the existence of a message or information in another message, image, or file. This can be achieved by using various techniques such as:
The goal is to make the hidden message or information undetectable so that it can only be accessed by the intended recipient, who has the knowledge of the method used to conceal the message.
A software program and hardware device capable of running a python project. For example, we need a python runtime environment on the System.
Hardware Specification- | |
Processor | Intel processor IV or above. |
RAM | 1 GB or above. |
ROM | 500 MB or above. |
Software Specification: | |
Software used | Python IDLE. |
Operating System | Microsoft Windows 7 or above. |
Module installation-
You can use the python package installer pip
to install the OpenCV-python module. We can install it by running the following command in the terminal or command prompt:
pip install opencv-python
If you already have OpenCV-python installed and you are still getting an import error, make sure that the OpenCV-python module is properly installed and its path is included in the environment variable PYTHONPATH; you can check this by running the following command in your terminal:
pip list
Python Code-
Here is the sample code to encrypt the information-
import pyfiglet ascii_banner = pyfiglet.figlet_format("STEGNOGRAPHER- ENCRYPTER") print(ascii_banner) import cv2 loc=input("Enter the path of image (with extension) -> ") image=cv2.imread(loc) txt=input("Enter the data that you want to Encrypt (add '$' at the END of your statement) :- ") ls=(list(txt)) for i in range(0,len(ls)): data=ord(ls[i]) image[0,i,0]=data lc=input("Enter saving location (Extension should be .png) ->") cv2.imwrite(lc,image) print("Data Encrypted") input("")
Encrypting the data in the image.
Here is the sample code to decrypt the data-
import pyfiglet ascii_banner = pyfiglet.figlet_format("STEGNOGRAPHER- DECRYPT") print(ascii_banner) import cv2 d=[] loc=input("Enter the path of image (with extension) -> ") image=cv2.imread(loc) x,y,z=image.shape for i in range(0,y): b=chr(image[0,i,0]) #print (b) if(b=='$'): break else: d.append(b) d=''.join(d) print(d) input() print("You can close the window now.")
NOTE: Here, I’m using pyfiglet module to create a banner to look good. You can remove stating 3 lines if you do not want it.
Steganography and cryptography are both methods of hiding information, but they do so in different ways.
Steganography hides information in other information, such as a message in an image. The goal is to conceal confidential information rather than protect it from being read by an unauthorized person.
Cryptography, on the other hand, protects information by transforming it into a code or cipher. Cryptography aims to make the encoded information unreadable to anyone without the key or means to decrypt it.
In short, steganography is the art of hiding information in plain sight, while cryptography is the art of securely encrypting information.
It should be noted that Steganography is not foolproof and can be detected by specialized software or through statistical analysis.
Steganography is a powerful and versatile technique for hiding information in other data. The technique has a long history and has been adapted for use in the digital age to meet the demands of modern security and privacy needs.
Steganography provides a way to transmit confidential information securely and covetable manner and is often used as an alternative or complement to cryptography. By embedding secret messages in cover media, steganography allows individuals and organizations to protect sensitive information from prying eyes and ensure the confidentiality of their communications.
The key takeaways from this article are:
The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.