In the past, you may have tried to accomplish some kind of subterfuge using invisible inks or using special keywords with your friends.
However, as fearless coders we have access to fancier ways to sneak data around. !! Making it less likely that they’ll want to try to crack your code !!
For Example: Steganography is really handy to use, because people won’t even suspect that they’re looking at or listening to a secret message.
In a nutshell, Steganography is the technique of creating secret data by hiding it within an "Ordinary, Non-Secret, File" in order to avoid detection.
It's then extracted by the reciver at the destination if they are ware of the proper encription methods.
Therefore, the use of steganography can be combined with encryption as an extra step for hiding or protecting data.
Take for example, this sentence | Which gets turned into |
---|---|
Since everyone can read, encoding text in neutral sentences is definitely effective |
Secret inside |
Answer
Take the first letter of every word.
The concept of “most significant bit” (MSB) and “least significant bit” (LSB) occurs in other contexts as well. For example, ParityBits are used as a basic form of error checking.
Additionally, because the LSBs will change rapidly even if the value of the bit changes a little, they are very useful for use in HashFunctions and Checksums for validation purposes.
LSB algorithm is a classic Steganography method used to conceal the existence of secret data inside a “public” cover.
The LSB or “Least Significant Bit”, in computing terms, represents the bit at the unit’s place in the binary representation of a number.
The technique use to transmit hidden information by modifying an image file. The image selected for this purpose is called the
cover image
and the image obtained after steganography is called thestego image
.
There are multiple ways to hide things within other things, but today we will be working with images.
A black and white image (not grayscale) is an easy thing to conceptualize, where a black pixel has a value of 1 and a white pixel as a value of 0.
Color images have three color channels (RGB), with pixel values of 0-255 for each pixel. So a pixel with the value (255,255,255) would be entirely white while (0,0,0) would be black.
The upper range is 255 because it is the largest value that can be represented by an 8 bit binary number. Binary is a base-two paradigm, in contrast to decimal which is in base-ten,
which means you calculate the value of a binary number by summing the 2s exponent of each place where a 1 appears.
So if we wanted to convert the number 10001011
from binary into decimal, it would look something like:
2^8 + 2^4 + 2^2 + 2^1 = 139
You can also test this out in your Python interpreter. Binary numbers are automatically converted to integers so you don’t actually need to have a print statement. (It’s just there for clarity.)
>>> print(0b10001011)
139
>>> type(0b10001011)
<class 'int'>
>>> 0b00001011
11
>>> 0b10001010
138
From our quick tests above, you can see that the leftmost bit place matters a lot more than rightmost bit because the rightmost bit only modifies the value of the number by 1. We saw that:
10001011 = 139` while `00001011 = 11
10001011 = 139` while `10001010 = 138
Because of this, we describe the leftmost bit as the “most significant bit” (MSB) while the rightmost bit is the “least significant bit” (LSB).
We can observe that its entirely possible to hide a black and white image inside an RGB image by changing the LSB of a pixel in a single color channel to correspond to the value of the image we want to hide.
Additionally, since changing the LSB doesn’t drastically change the overall value of the of 8 bit number, we can hide our data without modifying a source image in any detectable sort of way.
You can test this out with any RGB-Color-Wheel to get a sense of how little difference there is between a color like (150, 50, 50) and (151, 50, 50)
The technique used to transmit hidden information by modifying an audio signal in an imperceptible manner.
The host message before steganography and stego message after steganography have the same characteristics.
For, it is the science of hiding some secret text or audio information in a host message.
Further Reading: HidingSecretsWithinEarshot-Pt1-&-Pt2
# Convert text to bit array
bits = list(map(int, ''.join([bin(ord(i)).lstrip('0b').rjust(8, '0') for i in text])))
# Replace LSB of each byte of the audio data by one bit from the text bit array
for i, bit in enumerate(bits):
frame_bytes[i] = (frame_bytes[i] & 254) | bit
# Get the modified bytes
frame_modified = bytes(frame_bytes)
# Write bytes to a new wave audio file
with wave.open(f'../audio/{encoded_name}.wav', 'wb') as fd:
fd.setparams(song.getparams())
fd.writeframes(frame_modified)
python3 -m venv venv source venv/bin/activate pip3 install -r requirements.txt
Run Image Steganography add -vis or --visual Run Audio Steganography add -voc or --vocal For those more advanced add both
Python3 SSJ.py [flags] [options] deactivate
Images
in this example are.png
files. We recommend that you avoid working with.jpg
files so that file compression does not make your task more difficult.Audio
in this example are.wav
files. We recommend that you avoid working with.mp4
files so that file compression does not make your task more difficult.
https://www.chciken.com/digital/signal/processing/2020/05/13/guitar-tuner.html https://www.ideals.illinois.edu/bitstream/handle/2142/104007/ECE499-Sp2019-ding.pdf?sequence=2&isAllowed=y https://www.connollymusic.com/stringovation/how-your-violin-produces-sound https://www.physicscentral.com/explore/action/fiddle.cfm http://hyperphysics.phy-astr.gsu.edu/hbase/Music/mussca.html#c2 http://hyperphysics.phy-astr.gsu.edu/hbase/Music/guita.html#c3 http://hyperphysics.phy-astr.gsu.edu/hbase/Sound/timbre.html#c2 http://hyperphysics.phy-astr.gsu.edu/hbase/Music/violin.html#:~:text=The%20violin%2C%20the%20most%20commonly,the%20A4%20%3D%20440Hz%20standard.