Skip to main content

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

▮ CipherChronicle

Image methods Scrambling

Pixel permutation

Pixel permutation is to an image what a transposition cipher is to text: no value changes, only positions. A photo turns into a cloud of coloured dots.

How does pixel permutation work?

  1. Number the pixels from 0 to N − 1, row by row.
  2. Derive from the key a pseudo-random sequence and use it to shuffle the list of numbers (Fisher–Yates shuffle).
  3. Move: the pixel landing at position i is the one whose number was drawn at i.

To decrypt, regenerate exactly the same list from the same key and send each pixel back where it came from. A different key, even by one letter, gives an entirely different shuffle.

The number of possible shuffles is enormous: N! for N pixels. But real security depends on the key and the generator, not on that number.

What does a permuted image look like?

Like coloured noise, but not just any noise: the overall tint is that of the original. A forest photo gives green noise, a sunset orange noise. The colour histogram is strictly identical to the original’s.

What are the weaknesses of pixel permutation?

Strengths

  • Lossless: with the right key, the image comes back exactly.
  • Shape fully destroyed: no outline survives.
  • Easy to grasp and to relate to classical transposition ciphers.

Weaknesses

  • The histogram leaks. The colours present and their proportions are known: enough to tell a scanned document from a photo, or to pick an image among several candidates.
  • Vulnerable to known plaintext. With one image and its permuted version under the same key, an attacker derives the permutation and applies it to all the others.
  • Destroyed by JPEG. Noise compresses very poorly: recompression blends neighbouring pixels that no longer relate, and the recovered image is covered in artefacts.
  • Heavier file: a noise PNG barely compresses.

How do you recover the image without the key?

  • Guess the key: a common word falls to trial and error, the right result being instantly recognisable.
  • Known plaintext: having a chosen image encrypted (say, one where every pixel has a unique colour) reveals the whole permutation.
  • Neighbourhood reconstruction: in a natural image, adjacent pixels look alike. On block or row permutations, you reassemble like a jigsaw. On a full pixel-by-pixel permutation, this route is impractical.

What are the variants of pixel permutation?

  • Block permutation — shuffle tiles rather than pixels: survives JPEG better, but reassembles like a jigsaw.
  • Row and column permutation — faster, much weaker.
  • Arnold’s cat map — a geometric, keyless permutation that returns to the starting image by itself.
  • Permutation then XOR — combining both also hides the histogram. This is the “confusion and diffusion” design of modern ciphers.

In CipherChronicle

The workbench asks for a key (a word or a phrase) and outputs a PNG. All four channels move together, transparency included. The generator is built for play, not to protect a real secret.

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.