why is bitget not taking data?

3 Ansichten (letzte 30 Tage)
Sara MH
Sara MH am 13 Jan. 2018
Kommentiert: Jan am 13 Jan. 2018
hello everyone i'm working on a project related with audio steganography i'm using 2 functions hide and recover in hide, i have used the following part of the code (bitset) and then write data inside the audio file:
identity=[1 0 1 0 1 0 1 0]';
%hide ID
dta(1:8)=bitset(dta(1:8),lsb,identity(1:8));
%hide req_msg & new_msg
dta(9:38)=bitset(dta(9:38),lsb,req_msg(1:30));
dta(39:38+r)=bitset(dta(39:38+r),lsb,new_msg(1:r)');
%>>>>>>>>>>> may help save('temp.mat','dta');
fid2=fopen('Stego-audio.wav','w');
fwrite(fid2,header,'uint8');
fwrite(fid2,dta,'uint16');
fclose(fid2);
but in recover, the bitget takes the bits from dta from the beginning until 38, but doesn't etract the bits from 38:39+r:
identity=bitget(dta(1:8),lsb)';
if identity==[1 0 1 0 1 0 1 0]
req_msg(1:30)=bitget(dta(9:38),lsb);
r=bi2de(req_msg);
secmsg_bin(1:r)=bitget(dta(39:38+r),lsb);
%secmsg_bin: The problem is here: we can extracrt the bits that give the
% the header, ID and the length for extraction... but the most important thing which is the message can't be obtained.. it's only an emtpy or zero matrix
the matrix "new_msg" which i want to recover, is a matrix of say (m*8) of zeros and ones ( in double).. plz let me know if anyone needs clarification.
  3 Kommentare
Sara MH
Sara MH am 13 Jan. 2018
Bearbeitet: Sara MH am 13 Jan. 2018
i have forgotten to remove my own comments it's something relevant with the whole code r is the length of new_msg .. it was extracted as a binary number then converted to decimal so that i can make secmsg_bin ,of length r, an input so a certain loop taking r as a counter.(secmsg_bin should be the same as new_msg) sometimes when i run the code it's obtained as matrix with length r but all of its contents are zero.. while modifying it sometimes obtained as an empty row.. on both cases.. it doesn't give the contents as in new_msg i hope it is more clear
Jan
Jan am 13 Jan. 2018
Could post a code which reproduces the problem? Maybe you made a mistake while obtaining dta from the file, but this part is not shown in the code yet. What do you get for dta(39:38+r) after the import? Does have the re-created r the correct value? Is "req_msg(1:30)" the same as "de2bi(r)"?
There are too many details which must be guessed. Therefore it is hard to find where your problem is coming from.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Simulation, Tuning, and Visualization finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by