JoshuaKasa / van-gonography

Hide 🕵️‍♂️ your files of any type inside a image of your choice using steganography
MIT License
411 stars 30 forks source link

Miscalculation of Cover Image size needed to Hide a file. #4

Closed CrusaderGoT closed 2 weeks ago

CrusaderGoT commented 7 months ago

So I hide a 8.36mb video file in a cover image size of 694kb of dimensions 1440 * 1800. I got no "cover image is too small to hide the data" error, but the result file was smaller than hidden file, and on decoding the output video file was also smaller than the original hidden video file and unplayable.

Initially I thought it was the whole video binary data wasn't getting hidden in the cover image. But since I didn't fully understand the code for hiding files in images, I tried and failed to modify it. Then I thought maybe it was because it was a video file and it required special attention, so I used opencv but the same results.

I then used a cover image of size 2.60mb and dimensions 3024 * 4032 to hide the video file of 8.36mb, and it work perfectly. The resulting file was 24.0mb, and on decoding the output file was the same size as the original.

So I concluded it must be some miscalculation on the math for cover image size needed. Since I don't fully understand the math, I am submitting and issue instead of working on it myself. I will work on other things for optimizing the experience for now. Am also thinking of making it web accessible via django🤞.

JoshuaKasa commented 7 months ago

Hi Crusader!

The code for checking if the image is big enough is at line: 260, this is it in case you wanna give it a go:

    if width * height * SINGLE_RGB_PIXEL_BIT_SIZE * 2 < data_length:

So some questions, did you use - for both tests - a .PNG image? If yes, then there might be some error in the initial calculation of the size, it's strange you didn't got any out of bounds errors or anything like that, might want to try using the log argument, there'll be a log file with some informations.

Btw, thank you so much for you contribution! Make a pull request whenever you want, I'd be glad to take a look at your work.

CrusaderGoT commented 7 months ago

I can't seem to attach the particular files zip, is there another way to share them to you? Either way i think i will close the issue since so far it only applies to the particular files.

Also I finally understand how the process of hiding the file in an image works, and wanted to ask(for hiding multiple files) would the image appearance change if another sequence[slice] of the the image bits was change?

JoshuaKasa commented 7 months ago

You can contact me over at Discord: joshua_yk for the zip files! I don't quiet get what you're asking about the appearance of the image tho, could you specify a bit more or make an example?

Btw, was you able to fix the error? I haven't checked on it yet as I'm currently working on a MUCH bigger project and got busy with school and also a bad flu.

CrusaderGoT commented 7 months ago

files.zip Sorry about your flu(get better soon). Above are the files(when decoded, the video file is lesser than its original size and unplayable. the encoded file is also less size than the 2 files combined). As for my question, i mean will the image appearance change if i alter other sequence slice of its bits, since currently files are hidden at its last two bits. i will test this regardless tho and see what will happen(it is for potentially hiding multiple files; i also have other ideas on that). Lastly i don't really use discord. Goodluck with your latest project

JoshuaKasa commented 7 months ago

Hey brother, thank you for your wishes 🫶🏻

I will test with those files later. For now all I can tell you is probably that the video was too big but the program didn't recognize it, so yeah, but with the image size calculation.

Other than that, no! The image appearance will not change if you modify, for example, 1 blue bit and 1 yellow, there have been some researches about that, and I think the bits that change the image appearance the most are actually the blue ones lol, the change is so mild it doesn't affect the image that much tho, I will make some more researches about it and lyk!

CrusaderGoT commented 7 months ago

so i just thought i would send you a message like this. i have successfully implement the hiding of multiple files in an image. but i cant seem to be able to send a pull requests. so let's figure that out together. do take a look at my code, the class for it is in the mulVanGonography.py module.

JoshuaKasa commented 7 months ago

Hi!

I can't seem to find the files, I mean, I can't seem to find the files you specified, your message doesn't contain any files or images, you might wanna try again.

For the pull request, I actually got no idea how it works as I've never made on in my life, but here's what looks like a good resources:

Good luck! If you manage to send me the files I'll check them out.