Skip to main content

New : Cipher Breaker, the codebreaking assistant, is now on Android Discover

▮ CipherChronicle

Image methods Sharing

XOR sharing

XOR sharing is the computed version of visual cryptography. You give up stacking transparencies and gain everything else: colour, contrast and the original size.

How does XOR sharing work?

  1. Draw at random a noise image the same size as the image: this is share 1.
  2. Compute the XOR, byte by byte, of the image and share 1: this is share 2.
  3. Hand each share to a different person.

To recover the image, XOR the two shares: the noise cancels out.

image   = 1100 1000   (200)
share 1 = 0110 1101   (109, drawn at random)
share 2 = 1010 0101   (165 = image XOR share 1)

share 1 XOR share 2 = 1100 1000   (200)

This is exactly a one-time pad: share 1 is the key, as long as the message, perfectly random and used once; share 2 is the encrypted message. The two roles are in fact interchangeable.

What do the two shares look like?

Like two uniform coloured noise images, the same size as the original, indistinguishable from each other. Neither hints at any shape or tint.

What are the weaknesses of XOR sharing?

Strengths

  • Perfect secrecy of a single share, if the noise is truly random.
  • Exact reconstruction, in colour, with no loss of contrast or change of size.
  • Very simple: one operation, the same both ways.

Weaknesses

  • A computer is needed to recombine: no more transparencies.
  • No tolerance: both files are needed, intact. JPEG on either share and the recovered image is just noise.
  • Randomness quality matters. Noise from a predictable generator does not give perfect secrecy.
  • Never reuse a share for another image: the XOR of the two second shares would reveal the XOR of the two images.

Can the image be recovered from a single share?

No, for the same reason as the one-time pad: for any imaginable image, another share exists that would produce it. A single share is compatible with every image of that size.

What are the variants of XOR sharing?

  • n shares — draw n − 1 noise images and compute the last as the XOR of the image and all the others. All shares are then required.
  • k-out-of-n threshold — Shamir’s secret sharing, applied byte by byte, requires only k shares out of n.
  • Camouflaged share — hide each share in an ordinary picture with LSB: two innocent photos that only yield the image together.

In CipherChronicle

The workbench outputs two noise PNGs. A fresh draw is made for each image dropped. When decrypting, drop both shares, in any order.

Demonstration

The CipherChronicle artwork is encrypted then decrypted right here, in your browser, with the same engine as the workbench. Drag the bar to compare.