Borrar filtros
Borrar filtros

Explanation for LSB data hiding

2 visualizaciones (últimos 30 días)
Elysi Cochin
Elysi Cochin el 23 de Mzo. de 2017
Respondida: dbmn el 23 de Mzo. de 2017
Please can someone explain what does the numbers 248, 252, 128, 64 denote, in
red = bitand(redc,248);
blue = bitand(bluec,252);
bitand(text,128) == 128
bitand(text,64) == 64
bitor(red,4)
bitor(red,2)
bitor(red,1)
The below is a few lines from LSB...
red = bitand(redc,248);
green = bitand(greenc,248);
blue = bitand(bluec,252);
if bitand(text,128) == 128
red = bitor(red,4);
end
if bitand(text,64) == 64
red = bitor(red,2);
end
if bitand(text,32) == 32
red = bitor(red,1);
end

Respuesta aceptada

dbmn
dbmn el 23 de Mzo. de 2017
you might get an answer if you leave the decimal notation and go to binary. Here is a mini example
dec2bin(248) = 11111000
dec2bin(252) = 11111100
So bitand(redc, 248) gets you all but the last 3 digits of your redc.
dec2bin(bitand(bin2dec('10101011'), 248)) = 10101000
I assume that you store whatever Info you need in that 3 digits. Similarly bitand(redc, 7) will get you the last 3 bits with the desired info.
dec2bin(bitand(bin2dec('10101011'), 7)) = 00000011
You might play around with bitand and bitor for clarity.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by