フィルターのクリア

Explanation for LSB data hiding

2 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2017 年 3 月 23 日
回答済み: dbmn 2017 年 3 月 23 日
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

採用された回答

dbmn
dbmn 2017 年 3 月 23 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by