A one-time pad variant for easy manual application. Based on a 6x6 conversion table supporting alphanumeric symbols. Random key generation can be done with one normal gambling dice (d6).
An implementation in Python is provided.
The conversion table uses a 6x6 alphanumeric matrix. It is filled from left
to right and from top to bottom with the uppercase latin letters of the
alphabet from A
to Z
and than the numbers from 0
to 9
.
Please note, the x and y indices start at zero.
The conversion table with the default symbol arrangement:
0 1 2 3 4 5
0 A B C D E F
1 G H I J K L
2 M N O P Q R
3 S T U V W X
4 Y Z 0 1 2 3
5 4 5 6 7 8 9
The used symbols might be replaced with
meta
symbols e.g. likenot
, which might alter prior or following statements.
Encryption is done in six easy steps:
- Convert the key and plain text symbol to its x and y positions
- Add the keys x position to the plain texts x position
- Add the keys y position to the plain texts y position
- Divide the x position by 6 and use the remainder as the new x position
- Divide the y position by 6 and use the remainder as the new y position
- Convert the so calculated x and y positions to the cipher text symbol
Repeat with the next symbol if needed.
H E L L O Plain text (symbols)
11 04 15 15 22 Plain text (positions)
X X X X X Key (symbols)
+ 35 35 35 35 35 Key (positions)
Y V 2 2 5 Cipher text (symbols)
= 40 33 44 44 51 Cipher text (positions)
Decryption is done in six easy steps:
- Convert the key and cipher text symbol to its x and y positions
- Substract the keys x position from the cipher texts x position
- Substract the keys y position from the cipher texts y position
- Divide the x position by 6 and use the remainder as the new x position
- Divide the y position by 6 and use the remainder as the new y position
- Convert the so calculated x and y positions to the plain text symbol
Repeat with the next symbol if needed.
Y V 2 2 5 Cipher text (symbols)
40 33 44 44 51 Cipher text (positions)
X X X X X Key (symbols)
- 35 35 35 35 35 Key (positions)
H E L L O Plain text (symbols)
= 11 04 15 15 22 Plain text (positions)
Key generation is done in three easy steps:
- Throw a six-sided gambling dice, use the result minus 1 as the x position
- Throw a six-sided gambling dice, use the result minus 1 as the y position
- Convert the x and y positions to the key symbol
Repeat with the next symbol if needed.
It is advised to separate the key into blocks of five symbols for better readability and therefor a lesser chance of encryption/decryption errors.
For more information on randomness, please see [1].
Key distribution should be done directly after the key generation. It is advised to create the keys by hand. Write down the generated keys to two pieces of paper or books. The pages can be marked with page numbers for easier locating of the key blocks later.
It is advised to not use a computer system or any other electronic device to generate or distribute the keys.
In order for both peers to refer to the same key, the keys to use must be synchronized between each message. The simplest way to do so is using a key book and referring to the used key by the page number.
There are a few points to consider, to ensure maximal confidentiality:
- Every key must be kept secret
- Every key must not be used twice
- Every peer must destroy the key directly after usage
- Only two peers should have the same key
$ practical.py COMMAND [KEY TEXT...]
Available commands:
-e, --encrypt
-d, --decrypt
-k, --key
$ practical.py --encrypt XXXXX HELLO
$ practical.py --decrypt XXXXX YV255
$ practical.py --key
This Python script exports the Practical
class.
Returns the given text
encrypted with the given key
as string.
Returns the given text
decrypted with the given key
as string.
Returns a new random key of the given size
, cols
and rows
as string.
from practical import Practical
practical = Practical()
print(practical.encrypt("HELLO", "XXXX"))
print(practical.decrypt("YV255", "XXXX"))
print(practical.key())
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.