Forum: Ruby least significant bit ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
q666 (Guest)
on 2007-03-01 03:42
Hi
I have a question about Steganography in ruby how could i write and read
some data (bits) from a picture (for example a bmp file) hmm heh i think
i known something about how the LSB works //i read the wikipedia ;) but
i have problem whit the source i dont know how to write it. ? :(

  q666
Jan S. (Guest)
on 2007-03-01 10:30
(Received via mailing list)
On 3/1/07, q666 <removed_email_address@domain.invalid> wrote:
> Hi
> I have a question about Steganography in ruby how could i write and read
> some data (bits) from a picture (for example a bmp file) hmm heh i think
> i known something about how the LSB works //i read the wikipedia ;) but
> i have problem whit the source i dont know how to write it. ? :(

if you can read and write bytes of the picture you can set any bit by

byte |= 1 << bit_position (zero based)

011110010 | (1 << 2) == 011110010 | 100 = 011110*1*10

clearing a bit:

byte &= ~(1 << bit_position)

(at least this is the general idea, I might be a bit wrong ;-)
This topic is locked and can not be replied to.