Description
Steganography is the act of hiding a message in plain sight. How Steganography Works
One popular implementation is to take an existing image file and manipulate the bits to hide a message without noticeably changing the image or increasing the size. It does this by taking each byte that represents a color in a pixel and changing only the last bit.
An uncompressed bitmap file uses three to four bytes to represent each pixel in the image. One for red, one for green, one for blue, and an optional one for alpha. To hide a single ascii character would take 8 bytes. Changing only the last bit of each color ensures that the change is so slight that the human eye would not notice the change in color from picture to picture. Sample Implementation of Steganography
The following code implements the above example. It only works on uncompressed bitmap images. - Option Explicit
-
Const ForReading = 1, ForWriting = 2, ForAppending = 8
-
Dim oldFile, newFile, oFS, iSize, strMessage, i, ch, strPath
-
strPath = InputBox("File Path of Bitmap File:")
-
Set oFS = CreateObject("Scripting.FileSystemObject")
-
Set oldFile = oFS.OpenTextFile(strPath, ForReading)
-
-
If InputBox("1 for encode, 2 to decode") = 1 Then
-
Set newFile = oFS.OpenTextFile(Replace(strPath, ".bmp", "-e.bmp"), ForWriting, True)
-
iSize = (oFS.GetFile(strPath).Size \ 8) - 1
-
-
Do
-
strMessage = InputBox("Enter your message. The maximum number of characters is " & iSize & ".")
-
Loop Until Len(strMessage) <= iSize
-
-
newFile.Write(oldFile.Read(10))
-
-
ch = oldFile.Read(1)
-
newFile.Write(ch)
-
iSize = Asc(ch)
-
-
ch = oldFile.Read(1)
-
newFile.Write(ch)
-
iSize = iSize + Asc(ch) * 256
-
-
ch = oldFile.Read(1)
-
newFile.Write(ch)
-
iSize = iSize + Asc(ch) * 65536
-
-
ch = oldFile.Read(1)
-
newFile.Write(ch)
-
iSize = iSize + Asc(ch) * 16777216
-
-
newFile.Write(oldFile.Read(iSize - 14))
-
-
For i = 1 To Len(strMessage)
-
ch = Asc(Mid(strMessage, i, 1))
-
-
newFile.Write(Chr((Asc(oldFile.Read(1)) And 254) Or ((ch And 128) \ 128)))
-
newFile.Write(Chr((Asc(oldFile.Read(1)) And 254) Or ((ch And 64) \ 64)))
-
newFile.Write(Chr((Asc(oldFile.Read(1)) And 254) Or ((ch And 32) \ 32)))
-
newFile.Write(Chr((Asc(oldFile.Read(1)) And 254) Or ((ch And 16) \ 16)))
-
newFile.Write(Chr((Asc(oldFile.Read(1)) And 254) Or ((ch And 8) \ 8)))
-
newFile.Write(Chr((Asc(oldFile.Read(1)) And 254) Or ((ch And 4) \ 4)))
-
newFile.Write(Chr((Asc(oldFile.Read(1)) And 254) Or ((ch And 2) \ 2)))
-
newFile.Write(Chr((Asc(oldFile.Read(1)) And 254) Or ((ch And 1) \ 1)))
-
Next
-
-
For i = 1 To 8
-
newFile.Write(Chr(Asc(oldFile.Read(1)) And 254))
-
Next
-
-
Do Until oldFile.AtEndOfStream
-
newFile.Write(oldFile.Read(1024))
-
Loop
-
-
newFile.Close
-
Set newFile = Nothing
-
-
MsgBox "Message Encoded!"
-
Else
-
i = 0
-
ch = 0
-
strMessage = ""
-
-
oldFile.Read(10)
-
iSize = Asc(oldFile.Read(1))
-
iSize = iSize + Asc(oldFile.Read(1)) * 256
-
iSize = iSize + Asc(oldFile.Read(1)) * 65536
-
iSize = iSize + Asc(oldFile.Read(1)) * 16777216
-
oldFile.Read(iSize - 14)
-
-
Do Until oldFile.AtEndOfStream
-
i = i + 1
-
ch = ch Or ((Asc(oldFile.Read(1)) And 1) * (2 ^ (8 - i)))
-
-
If i = 8 Then
-
strMessage = strMessage & Chr(ch)
-
If ch = 0 Then
-
Exit Do
-
Else
-
ch = 0
-
i = 0
-
End If
-
End If
-
Loop
-
-
MsgBox strMessage
-
End If
-
-
oldFile.Close
-
Set oldFile = Nothing
-
Set oFS = Nothing
2 27857
Thanks, Rabbit! I always wondered how they did that... Now we all can be super secret squirrels!
I remember reading about the history of Steganography...
I remember one of the first usages of it.
There was of a slave who had their head shaved. A message tattooed to their scalp and their hair was left to grow back in. Once the hair was back, the slave was was sent to deliver the message.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ThoughtProvoker |
last post by:
Ive recently migrated for Visual Basic 6.0 to VB.NET and ive
exprerience of many skills of it and recently i am trying to perform
Least Significant Bit Steganography in it and im unable to do so...
|
by: coolwarrior |
last post by:
Hi,
1_I want to know the difference between "data hiding" , "steganography"
,"watermarking" ,"capsulation" related to DSP.
2_There r plenty of informaion about data hiding for images on the web...
|
by: Maqsood Ahmed |
last post by:
Hello,
Does anyone have any idea that how can I store extra information in an
image. such as text, as a part of image. I don't want to show the text
in an image but I want to store this...
|
by: eldjon |
last post by:
does anyone know how can we hide the information of a binary picture in a normal RGB picture in a way that this changes will not be visuable ?
|
by: radix2 |
last post by:
hello, anybody can help me to make application encryption(using AES 256 bit)+steganography(using LSB insertion technique)...thanks before..i really need help....
|
by: ctmashidayu |
last post by:
how to code using C++ -security information hiding in an image? anybody know?
|
by: gaya3 |
last post by:
Hi All,
I'm trying to encrypt the message in the gif image.
is there any algorithm for that to do?
I'm able to get create new image ,and even i retrieved the byte of the image.
...
|
by: Rafael Justo |
last post by:
Hi,
I'm developing a library to manage passwords and hide them in images. For now I'm using stepic, but this library only allows BMP images (easy to find info). I was wondering if there's any...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |