Coffeehouse Thread

20 posts

Picture Encryption

Back to Forum: Coffeehouse
  • User profile image
    jsrfc58

    I had an idea the other day...and although I do not know a great deal about the fine art of encryption, I thought I would play around with the idea anyway.  I did a little research into file formats (bitmaps in particular), and basic encryption methods.  My question: would it be viable to take something as simple as a picture (with a high range of colors) and use it to encrypt a document?  For instance, if you have a bitmap of something complicated (like a picture of a forest), and XOR'ed it or ANDed or even added each pixel value (RGB?) to individual ASCII/Unicode characters in a document, wouldn't that be more difficult to "crack" than using random/pseudo random number generators or a formulaic method?  This is a somewhat crude and simple example, but you get the idea.  Basically, without the picture, good luck reading the document.  Maybe this has been done before, I don't know.  You could probably even use sound waves/file formats, too.  I'll keep reading and researching...

  • User profile image
    Rossj

    jsrfc58 wrote:
    I had an idea the other day...and although I do not know a great deal about the fine art of encryption, I thought I would play around with the idea anyway.  I did a little research into file formats (bitmaps in particular), and basic encryption methods.  My question: would it be viable to take something as simple as a picture (with a high range of colors) and use it to encrypt a document?  For instance, if you have a bitmap of something complicated (like a picture of a forest), and XOR'ed it or ANDed or even added each pixel value (RGB?) to individual ASCII/Unicode characters in a document, wouldn't that be more difficult to "crack" than using random/pseudo random number generators or a formulaic method?  This is a somewhat crude and simple example, but you get the idea.  Basically, without the picture, good luck reading the document.  Maybe this has been done before, I don't know.  You could probably even use sound waves/file formats, too.  I'll keep reading and researching...


    Do you mean something like steganography?

  • User profile image
    jsrfc58

    Not quite...more like this:

    Unicode (or ASCII) character + pixel value at a given point (RGB) = new Unicode/ASCII value

    The new values would then be displayed as text--which, after being encrypted would look like complete garbage.

    Thanks for the link by the way.

  • User profile image
    PeterF

    What's the difference then between taking a picture or using a large number or string?

    Peter

  • User profile image
    jsrfc58

    PeterF wrote:
    What's the difference then between taking a picture or using a large number or string?

    Peter


    Well...I guess I was thinking there wouldn't be any formulas/patterns/computer-generated random numbers involved (which really aren't random when you get down to it).  In a sense, it would approach "true" random numbers if the picture is "noisy" enough.  I suppose it could be a key that is limited only in size by the complexity/size of the picture.  Maybe RSA is stronger than that, I don't know.  Again, I haven't done a great deal of research on it yet, and I confess I am not a mathematician.

  • User profile image
    Maurits

    You should bear in mind that if you treat pictures as numbers, you are in fact limiting yourself to a certain set of numbers.  RSA allows you to pick from a much larger range of numbers.

    To put it into perspective, consider this - any algorithm that can crack RSA would - with only trivial modifications - be able to infer what your picture must look like.

  • User profile image
    fnthawar

    Yup.. you could do that.. a good way to pass the key around.. actually if you ever saw Johnny Mnemonic, that's exactly what he did with his three pics Smiley

    Farhan

  • User profile image
    jsrfc58

    Maurits wrote:
    You should bear in mind that if you treat pictures as numbers, you are in fact limiting yourself to a certain set of numbers.  RSA allows you to pick from a much larger range of numbers.

    To put it into perspective, consider this - any algorithm that can crack RSA would - with only trivial modifications - be able to infer what your picture must look like.


    Could it though?  If I took a highly varied picture (one without a repeating pattern or large areas of repeating color values), even with a limited set of numbers, in one part of the encrypted document the letter 'A' might appear with a hex code (for instance) of $FE65, but in a couple words later it would appear as $5439, and then the next word would have it appear as $E401, etc.  Although I am not very familiar with RSA, I ran across it in a book about prime numbers, but have yet to look it up again.

    EDIT: Basically, the key could theoretically change from letter to letter in the document. If spaces are encrypted, too, it would look like one long stream of garbage.  Could a formula crack that if the key changes from letter to letter?  I'm not sure...

    I was trying to think of something in nature rather than in the math world to use as a "chaotic" key so to speak.  A picture was the first thing to come to mind.  Another way to put it: for the first letter in the document to be encrypted, you would use the first pixel in the picture.  For the second letter in the document, you would use the second pixel's value, etc.  If you wanted to throw a formula in between that, who knows what you would come up with...

  • User profile image
    W3bbo

    Why not just use the built in security and crypotography classes? Wink

  • User profile image
    eddwo

    This is basically using the picture as a One Time Pad, http://en.wikipedia.org/wiki/One_time_pad it can provide very secure encrpytion so long as you don't do anything silly like include the picture along with the encrypted file. If you just agreed with your recipient in advance that you would be using that picture file that the recipient also had a copy of and you only ever use it for one message sent between the two of you it should be secure.

  • User profile image
    Maurits

    I see... I misinterpreted.  You have a long running key that changes along the path of the document.

    Yes, this could be a good idea so long as the key doesn't leak out.  And if it does, well, just pick another one.

  • User profile image
    Maurits

    I seem to remember a Sherlock Holmes story where two people exchange information in the following manner:

    They each had a copy of the same book

    The author of a message would find each word somewhere in the book, then write down:

    • The page number
    • The number of the word on the page (first, second, third...)
    Then he'd send the list of number-pairs to his friend

    Impossible to break without a copy of the book

    Sherlock had intercepted a coded message, and was able to read it - but only by guessing which book had been used, knowing what he did about the author!

    But I can't remember which story it was...

  • User profile image
    lukes

    I got a book about cryptography for christmas, not a complex mathematical one tho thankfully. Its an interesting read and explains the history of cryptography. I never knew poland originally cracked the enigma code, nor did i know how they did it. But now i do Smiley

    http://www.amazon.co.uk/exec/obidos/ASIN/0385730624/qid=1106334314/sr=1-15/ref=sr_1_2_15/202-0964034-7468605

  • User profile image
    ScanIAm

    As someone already mentioned, this sounds very much like a one-time pad.  What's interesting, though (to me at least) is that given the new push towards using passphrases instead of passwords, wouldn't it be harder to brute force your way through an image? 

    There was some talk, for a while, about using image combinations as a passcode.  There would be an array of 100 unique images and you would simply remember your specific images in order to generate the passcode. 

    Ex: Red car, blue berry, green clover. 

    While sounding like part of a hearty, healthy breakfast, it also turned out that such a passcode was much easier to remember.  The mnemonic method to remember would be to tell a short story to yourself as you chose your images. 

    Ex:  While driving in my brand new red lamboughini, I spun out when I hit a squashed blue berry in the road and landed, upside down in a field of green clover.

  • User profile image
    Maurits

    Passwords, passwords...
    I had an idea for securing a website with no passwords.  Register with your email, and you're sent an activation link.  Clicking the link takes you to an auto-login page that drops a persistent cookie.  Every time you flush cookies or move to another computer you have to reactivate your account.

  • User profile image
    ZippyV

    With images, you can't have a public and a private key to encrypt/decrypt messages.

  • User profile image
    jsrfc58

    ZippyV wrote:
    With images, you can't have a public and a private key to encrypt/decrypt messages.


    Couldn't you use one image to transform the document, and then use another to transform it again...except one image would be public, and the other could be private...(?)

  • User profile image
    Maurits

    You could use a series of images rather than a single one.  For example, you could use some site's "image of the day".  Then if someone stumbled across the key, they still wouldn't be able to decrypt past messages.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.