A while ago, I spent time playing with modern field ciphers, especially with Card-Chameleon. Card-Chameleon uses a 52 card deck, assigning a letter to each red and each black card and needs two separate full alphabet permutations as a key. As it's a field I tried to find a computer-less, math-less, way to generate permutations from passwords.
My solution is a three steps process.
Let's assume the current password is PASSWORD
Step 1 : Create a base permutation
Write down the letters of the password without repetition
P A S W O R D
Fill in a matrix under the written down password with the remaining letters, leaving spaces for letters already present in the password
P A S W O R D
B C E F G
H I J K L M N
Q T U
V X Y Z
Read the matrix column by column ignoring the spaces to get a base permutation
base permutation : P H V A B I S C J Q X W K Y O E L Z R F M T D G N U
It looks nice but related passwords (eg. PASSWORD
, PASWWORD
, PASSWORDS
, PASSWORDA
, PAASSWORD
, ...) will produce the very same base permutation. So I needed to do something more to the base permutation, something which takes into account the whole password
Step 2 : Create a sequence of values based on the whole password
Assign to each letter a value equal to its rank in the alphabet minus 1
A B C D E F G ... Y Z
0 1 2 3 4 5 6 ... 24 25
Convert this rank to base 3, using 3 digits for each letter
A B C D E F G ... Y Z
000 001 002 010 011 012 020 ... 220 221
Write down the base 3 digits corresponding to the password
P A S S W O R D
120 000 200 200 211 112 122 010
Group these digits by 2 instead of 3 (if the password has an odd number of letters, append 0 to the base 3 digits of the last character of the password to be able to make pairs)
12 00 00 20 02 00 21 11 12 12 20 10
Convert the resulting pairs back to base 10
5 0 0 6 2 0 7 4 5 5 6 3
Add 1 to each value
6 1 1 7 3 1 8 5 6 6 7 4
resulting sequence: 6 1 1 7 3 1 8 5 6 6 7 4
Step 3 : mix up the base permutation using the sequence just created.
Taking advantage of having a card deck handy, setup a 26 cards deck (using red cards or black cards as you wish), order these 26 cards in the order of the base permutation, face up (remember, each card is assigned a letter, eg. $1\diamondsuit$=A, $2\diamondsuit$=B, $...$, $Q\diamondsuit$=L, $K\diamondsuit$=M, $1\heartsuit$=N, $2\heartsuit$=O, $...$, $Q\heartsuit$=Y, $K\heartsuit$=Z).
P H V A B I S C J Q X W K Y O E L Z R F M T D G N U
For each value of the resulting sequence of step 2, deal that many cards, face up, one at a time, to make a pile in reverse order (You may create the pile on the table or better, in your other hand. The only important thing is that the cards must be face up and be in reverse order). Then, put the resulting pile under the remaining cards of the deck. Repeat until the sequence is exhausted.
first round
pile: I B A V H P
remainder of the deck: S C J Q X W K Y O E L Z R F M T D G N U
new deck: S C J Q X W K Y O E L Z R F M T D G N U I B A V H P
Experimental results
The final permutations for the related passwords quoted in step 1 are:
PASSWORD V A B W K Y O C S E L Z J Q X T D G N U I R H P F M
PASWWORD C S P Z J Q X W K F M T D E L U I B A V H R O Y G N
PASSWORDS S E L Z J Q X T D G N U I R H P F M O Y K W B A V C
PASSWORDA B W K Y O C S E L Z J Q X T D G N U I R H P F M V A
PAASSWORD G S P H V A R F K Q X W J C B M T D Y O E L Z U I N