I'm writing a steganography app in c# that will hide an image and text covertly inside the least significant bits of a bitmap image. I'm trying to convert this code snippet i found in matlab to c# but dont know how. Does anyone know how to convert it to c# or vb.net code? Thanks Stego = uint8(bitor(bitand(Overt, bitcmp(2^n - 1, 8)) , bitshift(Covert, n - 8))); n = Number of least significant bits to replace. Normally 4

Overt, Covert = Bitmap images
Stego = Bitmap image output

The matlab code allows one bitmap image to be encoded into the least signficant bits of another bitmap to form the Stego image.

Thanks for your help

7 Years
Discussion Span
Last Post by vdeych


Sorry, it's been years since I've worked with MATLAB, but the code doesn't use many unique MATLAB features.

So, here is a quick conversion to C# bitwise operators; sorry, I don't have a complete solution for you, but I hope this can at least get started:

byte Stego = (byte)((Overt & ~((byte)2^n)) | (n > 8 ? Covert >> n - 8 : Covert << 8 - n));

Vasiliy Deych

Edited by vdeych: crazy run-on sentence I couldn't read myself

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.