Base Translation Cipher
Enciphering with Base translation is an idea introduced by W T Shaw (click here for his website).
The following article is my adaptation.
Brief Description.
Plaintext characters are converted to digits according to their positions in a substitution table. The digits are summed to an integer using a given base. For example if the plaintext was just 5 letters long and the digits were 7,19,15,4,7 and the base was 20, then the summation would be:
7 + (19*20) + (15*20*20) + (4*20*20*20) + (7*20*20*20*20) = 1,158,387.
Now the integer is reduced to digits using another base. For example for a base of 15:
1,158,387 = 12+(5*15)+(3*15^2)+(13*15^3)+(7*15^4)+(1*15^5)
so the digits are 12 5 3 13 7 1, and these are the ciphertext.
My implementation.
My implementation is in the program you can run by clicking here.
To encipher, you input the block size (maximum 90), the base for decomposing the integer (maximum 150), the key and the plaintext. You choose the 'encipher' radio button and click on the implement button below.
The plaintext is enciphered block by block, and the substitution table is shuffled for each block. The integer is always formed at base 152, allowing you to employ plaintext characters from 32 to 150 inclusive. The integer is decomposed into digits using your input base. The ciphertext is displayed with a colon ‘:’ after each block. This is required for deciphering.
To decipher you again enter block size, base and key and also the ciphertext. You choose the 'decipher' radio button and click the implement button below.
Positive features.
There are several features of the base translation system that I like. Each plaintext character contributes to the ciphertext, so that changing a single letter changes the ciphertext completely. This makes attacks like hillclimbing impossible and emasculates a probable word approach. A statistical analysis is meaningless for the same reason.
Because the substitution is unknown to an attacker, he has no way to reverse engineer the enciphering process other than following a brute force approach. This will be fruitless because the key can be up to 150 characters long and each character can be selected from 120 different choices.
Confusion is added to the cipher by frequent shuffling of the substitution table. The user can choose the frequency by selecting the block size. The smaller the block, the more frequent will be the shuffling.
An unusual feature.
The longer the plaintext block, the larger will be the integer. Moreover the expansion is exponential so that even with a brief message the integer will be extremely large by normal standards. For example the brief message below enciphered in a single block
“For Squid:
Drop box N45.773 W12.985;
Collect despatch immediate
From Octopus.”
produces this huge integer:
994068564785340945311253735056891326627327051018201214217333853050032102772991335162996853491070278250059817392687015382261891
874944401531226044306631742808219641671925085918460183664
In my implementation I have limited the block size to 90 characters.
A detailed example.
block size = 4
enciphering base = 149
key = ZETABO@RDS,&[£/"
plaintext:
I must
Go down.
Initial action A: convert the plaintext to ASCII code:
73 32 109 117 115 116 13 10 71 111 32 100 111 119 110 46
Note that code 13=line feed and code 10 = carriage return.
Initial action B: make a Fibonacci sequence from the key.
The beginning of a Fibonacci sequence is made from the ASCII code of the key ZETABO@RDS,&[£/" omitting any code greater than 150 (in this case £). This gives 15 digits:
90 69 84 65 66 79 64 82 68 83 44 38 91 47 34
The sequence is extended to 150 members. Each member is the sum of the previous 15 mod 150, giving:
90 69 84 65 66 79 64 82 68 83 44 38 91 47 34 104 118 17 100 135 54 29 144 56 44 5 116 44 147 97 10 66 14 11 72 9 114 49 104 2 110 65 14 134 121 145 130 44 74 137 52 95 76 103 102 52 144 73 132 130 139 133 136 78 82 27 2 59 42 131 10 118 92 111 90 50 111 89 42 6 80 133 114 19 146 11 12 56 20 79 68 86 61 33 24 42 4 25 86 3 10 9 6 106 42 5 92 98 135 87 0 108 62 99 112 71 132 105 54 2 112 69 46 144 3 69 138 18 124 149 36 1 20 85 116 80 48 27 8 22 41 13 38 58 142 135 84 17 14 93
Initial action C: use the Fibonacci sequence to make a transposition key:
Find the position of zero in the Fibonacci sequence: it is at position 109, so this is the first member of the transposition key. Repeat with 1,2,3…149. This gives the transposition key:
110 131 39 66 119 99 124 96 25 105 79 102 138 35 101 30 70 100 33 85 86 141 32 42 148 17 147 127 83 88 132 139 94 97 65 137 21 93 14 130 11 142 140 68 78 95 104 10 24 27 47 122 13 136 37 75 50 55 20 118 23 87 143 67 92 112 6 3 41 4 31 8 90 1 121 125 115 34 57 48 52 63 5 89 80 135 7 64 9 2 146 133 91 98 109 77 0 74 12 72 106 149 51 29 107 113 18 54 53 15 38 117 103 111 40 73 76 114 120 36 82 26 134 16 71 44 128 46 59 69 58 116 61 81 43 19 108 145 62 49 126 60 144 22 56 123 45 84 28 129
Initial action D: make a substitution table, which is simply the digits 1,2,3…150 that cover the ASCII characters which can be enciphered by this system;
Enciphering
Step 1: shuffle the substitution table, using the transposition key:
The 0’th member of the substitution table is moved to the position given by
(transposition key[0] + number of digits in key)%150.
Using the current key gives the shuffled substitution table:
97 74 90 68 70 83 67 87 72 89 48 41 99 53 39
110 124 26 107 136 59 37 144 61 49 9 122 50 149 104
16 71 23 19 78 14 120 55 111 3 115 69 24 135 126
147 128 51 80 140 57 103 81 109 108 58 145 79 131 129
142 133 139 82 88 35 4 64 44 130 17 125 100 116 98
56 117 96 45 11 85 134 121 29 148 20 21 62 30 84
73 93 65 38 33 46 8 34 94 6 18 15 12 113 47
10 101 105 137 95 1 114 66 106 118 77 132 112 60 5
119 75 52 146 7 76 141 28 127 150 40 2 31 92 123
86 54 36 13 32 43 22 42 63 143 138 91 27 25 102
Step 3: for the first block, convert the plaintext ASCII code using the shuffled substitution table. Thus
Plain ASCII convert to
I 73 shuffled[73] = 116
Space 32 [32] = 23
m 109 [109] = 95
u 117 [117] = 112
Step 4: make the integer, using base 152:
Integer = 116 + (23*152) +(95*152^2)+(112*152^3) = 395,520,988
Step 5: decompose integer using input base:
In this case the input base was 149 and the decomposed digits are
41 68 84 119
because 395,520,988= 41+(68*149)+(84*149^2)+(119*149^3)
Step 6: convert the digits using the shuffled substitution table:
41 converts to shuffled[41] = 69
and so on giving 69 44 148 5
The ciphertext for the first block is thus 69 44 148 5: the colon being appended for use in deciphering.
Now go back to Step 1, shuffle the substitution table again with the transposition key and then encipher the second block – and so on
The final result is the ciphertext
69 44 148 5 : 139 65 89 105 : 85 135 80 104 : 130 36 130 21 117 : 66 83 :
A longer example 1:
Block size:40
Base; 78
Key :Afg5:GO-kg?prOSe
There's a breathless hush in the Close to-night—
Ten to make and the match to win—
A bumping pitch and a blinding light,
An hour to play and the last man in.
And it's not for the sake of a ribboned coat,
Or the selfish hope of a season's fame,
But his captain's hand on his shoulder smote
"Play up! play up! and play the game!"
enciphered to:
82 88 81 37 86 81 53 18 66 42 49 60 33 1 83 19 60 24 13 15 37 25 83 119 147 1 101 57 124 18 96 139 70 102 96 4 19 19 85 110 78 4 30 92 50 85 105 : 62 118 42 34 2 39 100 43 139 61 34 112 80 3 123 57 127 148 86 28 63 37 23 85 10 124 49 28 23 141 143 3 86 34 112 129 122 42 99 46 51 32 84 127 86 115 34 : 12 18 127 100 76 120 79 25 120 76 100 36 42 73 14 100 42 36 148 45 108 97 120 73 143 149 9 32 120 80 1 54 144 119 54 10 110 99 35 61 83 99 39 112 69 15 : 20 145 19 113 128 100 105 3 110 61 73 138 131 109 25 102 149 14 105 140 94 20 112 100 34 96 44 46 96 53 33 14 137 36 76 4 14 135 150 62 135 149 114 79 107 74 : 10 10 92 53 111 92 73 48 46 73 102 119 124 122 73 13 114 16 1 15 36 61 10 79 20 104 82 36 129 101 124 13 142 52 13 82 21 66 68 119 84 23 28 64 15 110 92 : 105 135 118 1 42 1 53 109 67 120 103 65 62 88 139 52 35 5 99 144 87 109 62 35 85 88 143 87 131 99 17 13 132 136 16 148 103 8 15 128 24 125 23 140 54 53 : 15 111 120 113 29 4 139 68 28 6 99 38 84 3 101 136 13 101 26 40 91 26 79 91 63 133 115 115 136 62 146 31 36 62 101 13 9 88 88 4 71 146 121 9 118 141 79 : 60 86 126 36 5 121 86 109 72 12 121 64 143 13 33 17 38 41 81 64 13 84 72 112 42 55 41 27 124 88 111 117 88 75 120 7 95 76 100 36 20 33 76 60 110 29 : 101 1 76 91 143 101 81 31 29 41 128 111 127 22 112 43 149 91 101 :
deciphered to:
There's a breathless hush in the Close to-night–
Ten to make and the match to win–
A bumping pitch and a blinding light,
An hour to play and the last man in.
And it's not for the sake of a ribboned coat,
Or the selfish hope of a season's fame,
But his captain's hand on his shoulder smote
"Play up! play up! and play the game!"
A longer example using repeated plaintext:
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.
70 102 43 132 107 123 57 63 91 78 120 49 4 138 72 122 25 73 18 91 118 91 96 4 126 118 122 66 50 40 132 30 36 7 118 87 126 18 37 137 43 137 124 83 76 28 : 124 103 51 123 124 93 46 93 19 28 121 44 114 44 61 108 81 23 71 126 96 74 56 64 81 23 39 44 81 71 124 108 120 112 43 63 74 24 100 95 84 74 37 19 24 143 34 : 15 69 119 9 85 41 147 79 74 131 38 78 122 127 107 105 135 75 133 115 86 46 78 79 100 134 143 97 92 80 76 74 57 58 64 42 32 105 64 12 100 14 133 105 134 45 : 69 111 49 25 6 55 56 122 85 27 73 122 33 33 112 130 103 133 122 130 44 46 140 46 93 97 100 44 139 131 6 106 88 20 36 97 39 84 93 88 109 100 130 93 4 117 : 64 6 22 82 11 36 5 25 146 123 20 51 28 42 87 91 50 66 89 8 26 149 48 103 97 94 101 1 72 61 91 144 73 17 91 69 144 69 28 110 61 14 146 52 50 145 92 : 136 103 16 134 128 16 109 16 122 126 120 35 11 133 142 27 20 70 35 109 87 125 32 36 11 126 21 107 144 118 11 140 118 21 119 145 87 141 80 144 144 150 121 32 120 105 : 105 136 26 6 53 95 133 7 120 133 68 42 138 136 55 6 63 147 139 9 63 84 138 40 80 34 71 115 84 9 132 4 43 62 28 12 39 3 139 46 118 12 142 141 88 65 79 : 46 150 92 12 20 40 11 85 20 18 36 71 92 112 40 69 16 117 81 8 126 143 125 8 42 29 29 95 42 92 130 11 28 12 142 126 117 71 34 146 42 9 106 95 36 36 16 : 89 61 128 82 127 100 22 1 91 3 89 8 136 59 43 118 96 46 62 5 13 89 35 111 20 76 69 117 76 11 79 81 150 112 74 103 20 143 140 99 100 127 100 58 104 42 101 : 30 13 114 145 42 43 119 61 117 90 73 5 18 30 60 128 52 10 104 123 92 10 56 114 63 130 63 10 18 66 25 117 65 6 13 113 126 79 127 58 106 61 33 127 116 39 : 12 68 118 106 115 58 68 118 4 116 109 44 29 46 103 107 96 53 28 20 108 105 142 22 88 38 108 100 143 110 76 101 22 73 57 103 12 123 120 73 20 103 87 116 4 50 12 : 14 148 58 30 122 34 37 2 91 96 67 25 38 10 76 4 55 38 97 67 17 28 76 141 53 19 57 134 67 25 135 38 124 134 58 33 54 142 121 14 117 97 100 7 137 117 117 : 12 6 30 95 1 114 51 134 79 129 10 65 89 85 125 139 110 106 65 110 105 138 87 60 109 144 65 75 129 7 102 133 66 39 42 109 4 141 73 87 3 42 2 105 33 99 : 67 48 69 3 59 111 99 63 81 43 80 120 99 26 127 38 131 146 67 128 72 82 71 89 14 63 62 10 149 7 96 7 63 74 74 80 54 80 69 96 139 51 22 106 23 89 : 31 68 106 74 66 46 1 81 86 138 66 116 34 148 28 105 148 21 132 106 35 28 31 116 62 63 125 107 117 92 143 34 149 2 18 121 104 62 128 107 17 111 111 13 89 60 4 : 45 144 126 12 132 133 12 60 139 51 60 47 54 146 121 45 133 84 143 133 55 1 131 48 :