Operators Dialog / Operator Details

§ 12.11.72 - Random

Scripting command: random [Monochrome=0...1] [Shapemask=0...1] [Additive=0...1] [Amount=0...100] [Key=word(s)]

Note: All available scripting operations are listed on the Script operator page.

Fills areas with pseudo-random values based on a key (a text string) you supply. Can generate color or greyscale pseudo-random data, and can add pseudo-random dither to an image when  ShapeMask and  Additive are both checked. In that case, Amount will set the intensity of the dither.

If the key is simply the word randomize then each generation will be different from the last and not reproducible. To create a reproducible pattern, use a keyword string other than that specific word.

Note: Unless  ShapeMask is checked, this operator does not obey irregular area selections nor  Additive and it's associated Amount , only the X and Y extents of the area selections. This is so that the pseudo-random data generated is not altered in any way by mixing with the target image pixels, which would make encryption impossible to recover. If you want to create arbitrarily shaped pseudo-random data for other reasons, simply check  ShapeMask and the pseudo-random data will be generated as an effect as you would want it in that case.
Warning: Do not use greyscale pseudo-random data to encrypt (using the XOR layer mode) a color image. Doing so leaves clues as to what the image data was.

An example of an encryption technique:

  1. Promote the image into a layered image
  2. Clone the layer using clone in the Layers dialog
  3. Set the layer mode of the clone to XOR
  4. Select the "entire image" area tool
  5. Select the Random operator
  6. Choose a long, highly variable passphrase
  7. Click on the clone image (the top layer)

That's it. The master is now an encrypted version of the image. You can now save the master as an 64-bit .ato file using S (shift+s); the only way to get it back from that .ato file is to repeat the process: load it back in, begin with step one above, and make sure you provide the same key or the image will not decrypt.

This is good where only you know the key. However, if you send the image to someone else, and they don't know the key, you also have to send them the key, and at that point, the encryption is insecure. To get around this, you can use the "double locked box" technique. It works like this:

  1. You encrypt the image as described above. Send the image to the other party.
  2. They encrypt the already-encrypted image again, using their own unique key. They then send this doubly-encrypted image back to you.
  3. You now decrypt the image using your own key. This will result in an image that is only encrypted using the other party's key. You send this image back to the other party.
  4. The other party now decrypts the image using their key, and it will decrypt completely.

Using this approach there is no exchange of keys between the two of you, only encrypted information, and no intermediate party can steal the keys in transit, which makes the technique secure with regard to channel-based interception.

Tip: It is worth noting that you can retrieve the other party's key with a bit of cleverness, because you have the original image. I leave that as an exercise for the student. Just be aware they can do the same to retrieve your key. This can be of considerable benefit, because once you have the other party's key, you can send single-encrypted images to them using their key and will no longer have to resort to the double locked box approach. You can even create a key, encrypt that, send it along, they use it to encrypt their key, send it to you, you recover it, and all this without ever sending actual image data. Fun!

For extra encryption goodness, generate more than one one layer of pseudo-random information, each with its own unique key. Each layer goes above the image to be encrypted; each layer is set to XOR mode. To decrypt the image, all the layers will have to be reproduced with the correct keys. Don't lose the keys!


The random operator
Document Keyboard Navigation
, Previous Page . Next Page
t TOC i Index k Keyboard o Operators g Glossary c Changes

Valid HTML 4.01 Loose
 

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
wtfm and aa_macro are coded in python 2.7
iToolBox 3.12
This Documentation and Associated Application Executables are Public Domain
Please consider supporting my iToolBox development efforts with a small PayPal donation.