Algorithm and Output Samples
Algorithm and Output Samples
ENCODE:-
Using Modified LSB Algorithm where we overwrite the LSB bit of actual image with the bit of text
message character. At the end of text message we push a delimiter to the message string as a
checkpoint useful in decoding function. We encode data in order of Red, then Green and then Blue
pixel for the entire message.
DECODE:-
In the decode part, we take all the LSB bits of each pixel until we get a checkpoint/delimiter and
then we split them by 8 bits and convert them to characters data type and print the string (i.e., the
secret text message) without delimiter.
Encode:
ZWCs- In Unicode, there are specific zero-width characters (ZWC). We used four ZWCs for hiding
the SM through the CT.
Cover Text (CT): This is an innocent text that can be any type of meaningful text.
We get its ascii value and it is incremented or decremented based on if ascii value between 32
and 64 , it is incremented by 48(ascii value for 0) else it is decremented by 48
Then xor the the obtained value with 170(binary equivalent-10101010)
Convert the obtained number from first two step to its binary equivalent then add "0011" if it
earlier belonged to ascii value between 32 and 64 else add "0110" making it 12 bit for each
character.
With the final binary equivalent we also 111111111111 as delimiter to find the end of message
Now from 12 bit representing each character every 2 bit is replaced with equivalent ZWCs according
to the table. Each character is hidden after a word in the cover text.
Decode:
After receiving a stegofile , the extraction algorithm discovers the contractual 2-bit of each ZWCs ,
every 12 bit from end of the word in the stego file and then the binary equivalent is completely
extracted and delimiter discussed above helps us in getting to the end point. Now we divide the 12 bit
into two parts first 4 bit and another 8bit on which we do the xor operation with 170(binary value
10101010). Now according to the first 4bit if its is "0110" we increment it by 48 else we decrement
by 48. At last we convert the ascii value into its equivalent character to get the final hidden message
from the stego file
Text Steganography Decoding Algorithm
Encode:-
We will be using Cover Audio as a Cover file to encode the given text. Wave module is used to read
the audio file. Firstly we convert our secret message to its binary equivalent and added delimiter
'*****' to the end of the message. For encoding we have modified the LSB Algorithm, for that we
take each frame byte of the converting it to 8 bit format then check for the 4th LSB and see if it
matches with the secret message bit. If yes change the 2nd LSB to 0 using logical AND operator
between each frame byte and 253(11111101). Else we change the 2nd LSB to 1 using logical AND
operation with 253 and then logical OR to change it to 1 and now add secret message bit in LSB for
achieving that use logical AND operation between each frame byte of carrier audio and a binary
number of 254 (11111110). Then logical OR operation between modified carrier byte and the next bit
(0 or 1) from the secret message which resets the LSB of carrier byte.
Audio Steganography Encoding Algorithm
Decode:-
We start the extraction process by reading each frame and converting it to byte array. After that we
check 2nd LSB if it is 0 or 1. If the bit is 1 we store the LSB of the frame byte else we store the 4th
LSB, we keep this process until we reach the delimiter and then we break from the loop, then convert
the message into characters and print it.
We convert plaintext to cipher text for doing so we have used RC4 Encryption Algorithm.
RC4 is a stream cipher and variable-length key algorithm. This algorithm encrypts one byte at
a time. It has two major parts for encryption and decryption:-
KSA(Key-Scheduling Algorithm)- A list S of length 256 is made and the entries of S are
set equal to the values from 0 to 255 in ascending order. We ask user for a key and
convert it to its equivalent ascii code. S[] is a permutation of 0,1,2....255, now a variable j
is assigned as j=(j+S[i]+key[i%key_length) mod 256 and swap S(i) with S(j) and
accordingly we get new permutation for the whole keystream according to the key.
Now for the Steganography part we will be using Modified LSB Algorithm where we
overwrite the LSB bits of the selected frame (given by the user) from the cover video, with
the bit of text message character. At the end of text message we add a delimiter to the
message string as a endpoint which comes useful in decoding function. We encode data in
order of Red, then Green and then Blue pixel for the entire message of the selected frame.
Decode:-
In decode part In the decode part, we take the encoded frame from the stego video, in the frame each
pixels last LSB is stored until we get to the delimiter as we reach there we split them by 8 bits and
convert them to characters data type now we go to the decryption process where we do the same as
encode, make Keystream with help of secret key and using KSA and PRGA and finally xoring with
the obtained data from the frame with keystream to get the final decoded secret message
2. RESULTS AND OUTPUTS
12
Preview of Cover image and Stego image:
13
Preview of Cover Text file and Stego Text file:
14
15
16
Decoding the message from Audio file: