Complexity of the Steganography Encryption Method

  • Python
  • Thread starter Arman777
  • Start date
  • #1
2,118
179
I have implemented steganography encryption and decryption process, and I wondered if someone could decrypt the message in these conditions;

(a) without having the original image
(b) having the original image. The encryption starts from the first color code and the first pixel.
(c) having the original image.
However, the encryption starts from some initial color code (R, G, or B) for a given pixel location.
(d) having the original image.
However, the encryption starts from some initial color code (R, G, or B) for a given pixel location. Some number separates the bits in each message.

I guess no one can decrypt a message without knowing the actual image. So (a) the answer for (a) seems 'impossible'.

Part (b) seems possible but I guess part (c) and (d) is impossible without knowing the location of the pixel or the step size. Do you guys agree?
 

Answers and Replies

  • #2
anorlunda
Staff Emeritus
Insights Author
9,763
6,853
Steganography is no different than any other encryption. I'll defer to Bruce Schneier.

https://www.schneier.com/blog/archives/2015/05/amateurs_produc.html
Anyone can design a cipher that he himself cannot break. This is why you should uniformly distrust amateur cryptography, and why you should only use published algorithms that have withstood broad cryptanalysis. All cryptographers know this, but non-cryptographers do not. And this is why we repeatedly see bad amateur cryptography in fielded systems.
 
  • Like
Likes berkeman, Vanadium 50, Filip Larsen and 1 other person
  • #3
13,032
6,917
While it may be true that without the original you can’t decrypt the message. If your encrypted image is a recognizable public image then the code breaker might find the original one online.
 
  • #4
Baluncore
Science Advisor
9,701
4,141
I guess no one can decrypt a message without knowing the actual image. So (a) the answer for (a) seems 'impossible'.

Part (b) seems possible but I guess part (c) and (d) is impossible without knowing the location of the pixel or the step size. Do you guys agree?
Don't kid yourself. If I thought your message was worth reading I could decrypt it. Before you start to invent codes, break some real ones, then you will have some respect for the futility of encryption, and the general incompetence of the people who think they can hide behind cipher sytems.

If I thought you represented a threat to my organisation, and I could not be bothered wasting resources to crack your code, I would ask my friendly policemen to frame you on a drugs or internet paedophilia charge. If we were at war you would simply become a statistic, run over in a hit and run accident, or OD'd on your favourite medication. There would be nothing to investigate. The real or imagined threat would be neutralised.

Using any form of encryption will attract attention from suspicious authorities. That will make your life much more difficult, and probably a lot shorter.
 
  • Like
Likes Vanadium 50 and jedishrfu
  • #5
2,121
1,311
The only unbreakable cipher is a 'one-time-pad' such that the key is unpredictable and of length equal to that of the plaintext. The steganographic aspect merely adds to the obscurity. A PRN (pseudo-random number} based cipher is very unlikely to flummox the cryptanalysts at NSA (National Security Agency) -- they're as smart as anyone, and their computational capacity is measured in square miles or millions of steres (cubic meters).
 
Last edited:
  • #6
Vanadium 50
Staff Emeritus
Science Advisor
Education Advisor
27,395
11,504
I have implemented steganography encryption

Um, no you haven't. Steganography is not encryption. It's a means of hiding a message, no different in principle than writing it on a postcard and then placing a stamp over it.

Whether you need the original or not depends on how you encoded the message (which may or may not be encrypted). If it's encoded in the difference between two images, of course you need both. If it is internal to one image (e.g. in the LSBs of the color fields), there is no "both".
 
  • #7
anorlunda
Staff Emeritus
Insights Author
9,763
6,853
https://www.cs.columbia.edu/~nieh/pubs/mobisys2021_esp.pdf
ABSTRACT
Cloud photo services are widely used for persistent, convenient, and often free photo storage, which is especially useful for mobile devices. As users store more and more photos in the cloud, significant privacy concerns arise because even a single compromise of a user’s credentials give attackers unfettered access to all of the user’s photos. We have created Easy Secure Photos (ESP) to enable users to protect their photos on cloud photo services such as Google Photos. ESP introduces a new client-side encryption architecture that includes a novel format-preserving image encryption algorithm, an encrypted thumbnail display mechanism, and a usable key management system. ESP encrypts image data such that the result is still a standard format image like JPEG that is compatible with cloud photo services. ESP efficiently generates and displays encrypted thumbnails for fast and easy browsing of photo galleries from trusted user devices. ESP’s key management makes it simple to authorize multiple user devices to view encrypted image content via a process similar to device pairing, but using the cloud photo service as a QR code communication channel. We have implemented ESP in a popular Android photos app for use with Google Photos and demonstrate that it is easy to use and provides encryption functionality transparently to users, maintains good interactive performance and image quality while providing strong privacy guarantees, and retains the sharing and storage benefits of Google Photos without any changes to the cloud service

Note that they do not say how the encryption works. They leave the possibility that they used "use published algorithms that have withstood broad cryptanalysis". They say that they added format-preserving properties to the encryption, allowing obscuring the encrypted image in another image.

There is overlap between the words encryption and obfuscation.
 
  • #8
2,118
179
I am not designing an algorithm by myself. I have just implemented an algorithm that I have found online.

https://www.section.io/engineering-education/steganography-in-python/

https://towardsdatascience.com/hiding-data-in-an-image-image-steganography-using-python-e491b68b1372

I have looked at these sites and implemented an algorithm by using LSB. I have just added an extra feature (initial pixel location and step size stuff). But I have realized that that's not much different from the original one.

If the "hacker" does not have the original image, it would be impossible to decrypt the message, given that the encryption does not start from the first pixel and each bit message has some distance between them.

However, if the "hacker" somehow obtains the original image, then he would probably decrypt the message. In that case, a safe option would be to use some one-time pad to encrypt the message and hide it into an image. In that case, even the "hacker" can easily obtain the cipher message. He cannot read it.
 
  • #9
anorlunda
Staff Emeritus
Insights Author
9,763
6,853
If the "hacker" does not have the original image, it would be impossible to decrypt the message, given that the encryption does not start from the first pixel and each bit message has some distance between them.
That is the kind of statement that brands it as an amateur scheme. You assume that the code breaking must be based on logic and deduction thus reverse engineering your scheme.
 
  • Like
Likes Vanadium 50 and Ibix
  • #10
2,118
179
Encrypting an image inside another image is so cool :) I'll try to implement it the next time. In that case, I'll take the original image and change the last 2 LSB with the other images 2 MSB.
 
  • #11
2,118
179
That is the kind of statement that brands it as an amateur scheme. You assume that the code breaking must be based on logic and deduction thus reverse engineering your scheme.
Tell me a way because I can't think any. There are two options for each color code: either it's up or down (Either its LSB becomes 1, so the color code raises by 1, or it changes to 0, so the color code lowers by 1 or it stays the same but thats doesnt change stuff). If you don't have the original image, you cannot know how this change occurs.

For every 3 pixels, you can store 1 byte. For a size 1366x768 image (1049088 pixels), you can store 349696 bytes or 2797568 bits. Since the hacker does not know the original image, he cannot apply brute force because he does not know the changes in the bits, and if he wants to try some brute force, there are 2^349696 possible combinations. Since, as I have said, the encryption does not start from the first color code, and it's not continuous, he can try, but I am not sure that's not possible to break.
 
Last edited:
  • #12
Vanadium 50
Staff Emeritus
Science Advisor
Education Advisor
27,395
11,504
If you require the receiver to have access to a non-public image to decrypt, that is the same as a pad. If you use a different image with each message, it's a one-time pad. Nothing new here.
 
  • #13
Baluncore
Science Advisor
9,701
4,141
Nothing new here.
That still requires the pad be duplicated once, and a copy be delivered to the other party.
How will that pad delivery be encrypted?
 
  • #14
2,118
179
If you require the receiver to have access to a non-public image to decrypt, that is the same as a pad. If you use a different image with each message, it's a one-time pad. Nothing new here.
In that case you can use RSA
 
  • #15
Vanadium 50
Staff Emeritus
Science Advisor
Education Advisor
27,395
11,504
In that case you can use RSA

"Why do we need nuclear power? We can just use electricity!"
 
  • Like
  • Haha
Likes jedishrfu, Arman777 and pbuk
  • #16
2,118
179
I have realized that you don't need an original image to decrypt the message, if you know the encoding algorithm.

For instance, if you encode a message by using this algorithm (that is an encoding algoritm)

1 - Turn the message into a binary list
2 - Put '0' between in each byte and '1' at the end to indicate the end of the message
3 - Join them

So for example, if your message is "hey" you would turn this into a binary list,
1 - ['01101000', '01100101', '01111001']
add "0" s and "1" s
2 - ['01101000', '0', '01100101', '0', '01111001', '1']
3 - '011010000011001010011110011'

Now assume that the hacker knows that you are using this kind of algorithm, plus he knows that the image he is looking at contains some secret message.

If you start the encryption from the first pixel, the hacker could quickly obtain your secret message since he knows how your encoding algorithm works. (If he does not know your encoding algorithm, then, in that case, he might need an original image, or try some generic encoding algorithms to guess the secret message)

But instead of starting your encryption from the first pixel, you can start from some chosen pixel and with a different step size.

In that case, first, he needs to find the initial pixel location and the step size. Now I am not sure how we can calculate the possibility of that, but it will be large enough to take some time. For example if there are around 10**6 pixels and since he does not know the length of the message I guess he has to try around 10^9-10^10 different combinations.

However, If you make step size random (i.e, each digit will be randomly distributed in the pixels) then the probability will be so huge that hacker couldnt decrypt the message, or it will take too long.

In any case, for any encoding algorithm, starting the encryption from the initial pixel with step_size = 1 is a bad idea.
 
  • #17
pbuk
Science Advisor
Gold Member
2,446
1,186
You are confusing encoding with encryption: they are not the same.

Whatever algorithim you use the details are irrelevant. If you reuse a key then the method can be analysed, if you use one-time keys then the problem is secretly transferring keys of the same complexity as the message.
 
  • Like
Likes sysprog, hutchphd and Vanadium 50
  • #18
13,032
6,917
When you mentioned using an image, i thought you were adding something like a watermark to the message. Invisible but easily extractable.
 
  • #19
pbuk
Science Advisor
Gold Member
2,446
1,186
Note also that almost all 'genuine' images sent through any electonic medium are compressed whereas this kind of digital image steganography relies on RGB encoding (e.g. BMP). A BMP image sent over the internet is like a flag saying 'look at this - there is bound to be some hidden information or malware inside'.
 
  • Like
Likes Vanadium 50, hutchphd and jedishrfu
  • #21
Baluncore
Science Advisor
9,701
4,141
@Arman777 Try to avoid reinventing the wheel.
Get a copy of “The Codebreakers” by David Kahn.
Make sure it is the hardback version with 1165 to 1200 pages.
Avoid the abridged versions in paperback with about 480 pages.
Find it new or secondhand through; https://www.bookfinder.com/
 
  • #22
2,121
1,311

Related Threads on Complexity of the Steganography Encryption Method

Replies
4
Views
763
Replies
9
Views
694
Replies
2
Views
6K
  • Last Post
Replies
5
Views
772
  • Last Post
Replies
6
Views
5K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
2
Views
5K
Replies
1
Views
2K
Replies
3
Views
1K
  • Last Post
Replies
9
Views
2K
Top