Understanding the cipher process
Imagine a room containing 190 objects: two groups of 95, each in a circle. Each object in Group 1 has a twin in Group 2. You know the objects but not their arrangement.
Unseen, I:
You don't know what distances these named objects represent.
Given only these two object names, can you determine which two Group 1 objects were initially measured?
It's impossible to do so without knowing the arrangement of the groups. Given only the object names, the number of arrangements that can lead to those same two objects being named is (95!)². Even the number of arrangements in which the same Group 1 objects are referred to by same named objects is astronomically large.
This unsolvable problem is at the core of the Lady Liz cipher.
In this example, the initial IV will be JP, and the two keys will be:
First, divide the characters of the plaintext:
into pairs (add a random character to the end when necessary). Spaces are also encrypted:
Next, apply the IV to the plaintext pair to create an intermediate block (IB) — for each character in the plaintext pair, find its position in the first key of the key pair using 1‑indexing and add it to the position of the corresponding IV character.
For example, the O in Ou is at position 53, and the J in JP is at position 48. Add these (53+48 = 101) and if the sum exceeds 95, subtract 95 (101 mod 95 = 6). The character at this final position (6) in the first key (the space) becomes the first character of the IB.
Repeat for the second character: u (position 2) and P (position 54) gives 2 + 54 = 56. The character at position 56 in the first key, R, becomes the second character of the IB.
After each iteration, the IV becomes an IB and a new IB is calculated.
To encrypt the IB: Find the distance between the characters (space and R) in the first key of the key pair, "wrapping around" the key if necessary.
The distance from the space to R in the first key is 50. The first character in the ciphertext will be the 50th character in the second key of the key pair, L.
Then, in the second key of the key pair, find the distance from that ciphertext character to the first character of the IB — in this case, from L to the space. It's a distance of 51.
Again, the 51st character in the other key in the key pair determines the ciphertext character, M.
The ciphertext LM will also be the new IV to apply to the next plaintext pair. Note: if a pair is a character repeated (like XX), the distance from it to itself is 95.
If the IB characters that were just encrypted are different, swap their positions in the first key of the key pair. Next, if the ciphertext characters that were just created are different, swap their positions in the second key of the key pair.
The value of the first distance calculated (50) decides the order in which the keys will be used next. If it is even, the order stays the same; if it is odd, swap the order.
Finally, both keys in the set will shift their characters forward by the value of the second distance calculated (51).
These swaps and shifts lead to the keys being configured as follows:
Continuing in this fashion, the final ciphertext as a single string will read:
To decrypt this example, begin with the keys in the original configurations. Starting with the second key of the key pair, and at the first character of the ciphertext pair L, move forward the distance that the second character of the pair represents according to the first key of the key pair M, or 51, landing on the space — the first IB character.
Then, in the first key of the pair, and from the character that was landed on in the second key of the pair, move forward the distance that the first character of the ciphertext pair L represents according to the second key of the pair. Starting at the space character and moving forward a distance of L (50) leads to R.
To get the original plaintext pair from the IB, use the first key of the pair and subtract the initial IV's character positions from the IB's character positions, adding 95 if the result is 0 or negative.
After performing the same swaps as in the encryption process, the values the ciphertext characters originally represented are used to perform the correct shifts for the key cycle and the order of characters in both keys before continuing decryption. The previous ciphertext block is the new IV.