# How do you implement a cipher as one lookup table?

I am reading up on whitebox cryptography and have trouble understanding how are ciphers implemented as one lookup table?

Assuming my plaintext is just 4 bits so the size of my lookup table should be $2^4$, what does such a lookup table look like?

Specifically, this is the slide I am looking at, I found it on Google.

For a fixed key, a (block) cipher is a reversible transformation of a plaintext set to ciphertext set. Usually (and in the slide) these sets are identical, and consist of all the exactly $n$-bit strings. This set has $2^n$ elements, and is often noted $\{0,1\}^n$.
Note: in this notation $\{0,1\}$ designates the set with the two elements $0$ and $1$, and as usual raising a set to the $n$ means we are considering the set of all $n$-tuples with each element in the base set.

One possible implementation of a that transformation is a table $T$ of the cipher's output for each of its input. This table has one entry for each input, thus $2^n$ entries. Each entry is an $n$-bit string, thus uses $n$ bits. The table thus uses $2^n\cdot n$ bits.

To use the cipher defined by way of the table, one converts the $n$-bit input to an integer $j$ with $0\le j<2^n$, fetches the table at index $j$ that is $T[j]$, obtains an $n$-bit value, and that's the cipher's output.

Addition per comment: if the adversary possesses a box (of whatever color) implementing that transformation, we must assume the $n$-bit inputs and outputs, and their correspondence, are observed when the box is used. That might not be a total disaster if the adversary can't economically reproduce the box, and/or enumerating all input/outputs is impossible (e.g. requires too much time/energy, or exhausts a usage counter).

• thank you for replying, could you explain to me why is it noted {0,1}^n ? I understand why a set has 2^n elements, if the block is a 32bit block the number of possible permutation is 2^32. – laycat Mar 22 '15 at 8:56
• I think this is also the part I do not understand, if you were to convert a string and look it up from an internal table, in a white-box model, wouldn't the adversary be able to get the \$n-bit value that correlates with the input and output? – laycat Mar 22 '15 at 9:01