LC4 encryptor

LC4

ElsieFour ("LC4") was created by Alan Kaminsky. It is a low-tech cipher, which means that it is meant to be easily computable by hand and optionally with the help of wooden tiles or cards. LC4 is intended to encrypt English sentences and thus consists only of characters and can not encrypt individual bits.

Terms

alphabet:
#_23456789abcdefghijklmnopqrstuvwxyz

key:
A random permutation of the LC4-alphabet

nonce:
Character sequence to randomize ciphertext (> 5 characters)

signature:
Signature that proves authenticity of the message (> 9 characters)

header data:
Additional authentication; receiver must know header data

state:
System state as a 6x6 grid of the alphabet used for encryption and decrpytion

marker:
Reference to current marker-character deciding how to shift state

Encryption

Initial grid state

In the first step the state is initialized by creating a 6x6 grid and filling in the key row-by-row. The marker is set on the top-left character. Every character is assigned two numbers (possibly written on the tiles/cards):

- a number r = c mod 6 on the right side of the tile
- a number d = ⌊c / 6⌋(truncated division by 6) on the bottom edge of the tile

...where c is the zero-based index of the character in the alphabet (e.g. '#' is 0).

Encrypting plaintext character 'a' to 's'

To encrypt a character, locate it in your state grid. To find the corresponding ciphertext character, move, according to the marker, r fields to the right and d fields down, possibly wrapping around the edge of the grid.

Shifting plaintext-row one to the right Shifting plaintext-row one to the right

Move the row of the plaintext one to the right, wrapping around the grid.

Shifting ciphertext-column one down Shifting ciphertext-column one down

Move the column of the ciphertext character one down, also wrapping around the grid. If the row or column of the marker is moved, move the marker along with its character.

Move the marker after the encryption

Move the marker, by going r of the ciphertext character to the right and d of the ciphertext character down.

Decryption

The decryption process is identical to the encryption process, except that you decrypt a ciphertext character by moving r of the ciphertext character to the left and d of the ciphertext character to the top.

Tutorial

A tutorial about the encryption process can be found in the LC4 white paper

LS47

LS47 is an improved and extended version of the LC4-Cipher by Mirek Kratochvil. It works like LC4 but uses an extended alphabet with 47 (7x7 Grid) characters. This allows for a wider variety of messages to be represented. Following characters are used:

_abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'()

Tutorial

A tutorial about the encryption and decryption process can be found in the LS47 white paper

Sources