## The Cipher Black Box

This is how the cipher works: a plaintext is fed in to the “Black Box” and, based on a set of unknown parameters P, is enciphered by an unknown process in the box into the ciphertext, which is written onto the folio.

The internal mechanism of the Black Box is unknown. The only information we have is the output ciphertext (but we have a lot of it).

What strategies can we employ to discover how the internal mechanism of the Black Box works? What are the input parameters to the cipher? Can we avoid having to find out about the mechanism, and directly reverse the cipher, so yielding the plaintext from the ciphertext?

If we could “prod” the Box as enciphering was taking place (e.g. by twiddling one of the input parameters P_{i}), then by observing the output ciphertext, we could start to build a theory about how the cipher works.

Suppose we devise a candidate cipher that, from a sequence of random plaintext letters, and using a set of parameters we choose, generates a chosen line of VMs text exactly. Mathematically:

ciphertext = C(plaintext,P_{0}…P_{i})

where C is the cipher function. We can surely find a function that satisfies these conditions: some sort of State Machine is perhaps most appropriate. When twiddling one of the parameters P_{i}, and measuring the change in the ciphertext, we are able to calculate the partial derivative of C with respect to P_{i}:

δC/δP_{i} = Δ(ciphertext)

If the variation on the ciphertext produces new ciphertext that is compatible with the rest of the ciphertext in the VMs, then this would suggest that P_{i} is a good parameter (i.e. that it is a candidate for retention in the candidate cipher). If, on the other hand, the variation produces invalid new ciphertext, the parameter is poor, and is a candidate for removal from the candidate cipher.

## Potential algorithm:

- Create a state machine containing a cipher C that takes (many) Parameters P
- The state machine parameters are adjusted so that a (random) plaintext input string produces a valid sequence of VMs ciphertext
- Each parameter is varied slightly in value, and the state machine asked to reprocess the plaintext to produce new ciphertext
- The similarity of the new ciphertext is compared with the VMs corpus
- The parameter in question is demoted or promoted in weight
- Once the effects of all parameters have been examined they are graded by weight
- Good parameters are kept, poor ones discarded
- Develop an overall score for the state machine, based on a suitable metric
- Memorize this state machine if it has the best score so far
- Go to step 1, but now with the reduced set of parameters

This process is repeated for many different trial state machines, and the best memorized.

## Inverting the Cipher

TBA

Hi,

it seems that you transform the problem into an optimization problem, where the search-space is the set of all possible algorithms. But algorithms which can be represented by state machines are only a subset (a common example for this: a FSM cannot mirror an input string of arbitrary length). A Turing machine would – from a theoretical standpoint – solve this issue, but I don’t see how this optimization problem can be constructively solved. BTW: what you describe seems to be a genetic algorithm.

Cheers,

-Philip

Hi Philip – many thanks for the comment. You are right – the algorithm search space is “large” (i.e. semi infinite). I had in mind the sort of processes that are typically used to encipher plaintext, which are generally quite simple manipulations that involve as input, say, a lookup table and the current latest character(s). Rather than a GA, the idea was more to do with a stochastic “greedy” algorithm that starts with very many degrees of freedom and successively reduces them (a GA tends to have a fixed length or number of parameters).

Having said that, this is a very long shot and highly unlikely to be successful. It was more of a

gedankenexperiment.