凱撒加密,以26英文字字母來說只25種加密方法(加法)。
如果改以乘法,就可以有無限的可能性。
例如乘加質數 7
明文 | 數字 | 使用金鑰7加密 | 密文 |
A | 0 | (0 * 7)% 26 = 0 | A |
B | 1 | (1 * 7)% 26 = 7 | H |
C | 2 | (2 * 7)% 26 = 14 | O |
D | 3 | (3 * 7)% 26 = 21 | V |
E | 4 | (4 * 7)% 26 = 2 | C |
F | 5 | (5 * 7)% 26 = 9 | J |
G | 6 | (6 * 7)% 26 = 16 | Q |
H | 7 | (7 * 7)% 26 = 23 | X |
I | 8 | (8 * 7)% 26 = 4 | E |
J | 9 | (9 * 7)% 26 = 11 | L |
K | 10 | (10 * 7)% 26 = 18 | S |
L | 11 | (11 * 7)% 26 = 25 | Y |
M | 12 | (12 * 7)% 26 = 6 | G |
N | 13 | (13 * 7)% 26 = 13 | N |
O | 14 | (14 * 7)% 26 = 20 | U |
P | 15 | (15 * 7)% 26 = 1 | B |
Q | 16 | (16 * 7)% 26 = 8 | I |
R | 17 | (17 * 7)% 26 = 15 | P |
S | 18 | (18 * 7)% 26 = 22 | W |
T | 19 | (19 * 7)% 26 = 3 | D |
U | 20 | (20 * 7)% 26 = 10 | K |
V | 21 | (21 * 7)% 26 = 17 | R |
W | 22 | (22 * 7)% 26 = 24 | Y |
X | 23 | (23 * 7)% 26 = 5 | F |
Y | 24 | (24 * 7)% 26 = 12 | M |
Z | 25 | (25 * 7)% 26 = 19 | T |
但是否使用了乘數就可以有無限種的可能性了嗎?
我們把它列出來計算
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | |
1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
2 | 0 | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 0 | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 |
3 | 0 | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 1 | 4 | 7 | 10 | 13 | 16 | 19 | 22 | 25 | 2 | 5 | 8 | 11 | 14 | 17 | 20 | 23 |
4 | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 2 | 6 | 10 | 14 | 18 | 22 | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 2 | 6 | 10 | 14 | 18 | 22 |
5 | 0 | 5 | 10 | 15 | 20 | 25 | 4 | 9 | 14 | 19 | 24 | 3 | 8 | 13 | 18 | 23 | 2 | 7 | 12 | 17 | 22 | 1 | 6 | 11 | 16 | 21 |
6 | 0 | 6 | 12 | 18 | 24 | 4 | 10 | 16 | 22 | 2 | 8 | 14 | 20 | 0 | 6 | 12 | 18 | 24 | 4 | 10 | 16 | 22 | 2 | 8 | 14 | 20 |
偶數乘數不可以使用,因為會有不同字母對映到同一個值,就無法被反解譯。
13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 | 0 | 13 |
在 13 時,和英文字數 26 有因數關係,也不行。
如果乘數大於 26 ,開始出現重覆了。
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | |
1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
3 | 0 | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 1 | 4 | 7 | 10 | 13 | 16 | 19 | 22 | 25 | 2 | 5 | 8 | 11 | 14 | 17 | 20 | 23 |
5 | 0 | 5 | 10 | 15 | 20 | 25 | 4 | 9 | 14 | 19 | 24 | 3 | 8 | 13 | 18 | 23 | 2 | 7 | 12 | 17 | 22 | 1 | 6 | 11 | 16 | 21 |
7 | 0 | 7 | 14 | 21 | 2 | 9 | 16 | 23 | 4 | 11 | 18 | 25 | 6 | 13 | 20 | 1 | 8 | 15 | 22 | 3 | 10 | 17 | 24 | 5 | 12 | 19 |
23 | 0 | 23 | 20 | 17 | 14 | 11 | 8 | 5 | 2 | 25 | 22 | 19 | 16 | 13 | 10 | 7 | 4 | 1 | 24 | 21 | 18 | 15 | 12 | 9 | 6 | 3 |
25 | 0 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
27 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
29 | 0 | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 1 | 4 | 7 | 10 | 13 | 16 | 19 | 22 | 25 | 2 | 5 | 8 | 11 | 14 | 17 | 20 | 23 |
31 | 0 | 5 | 10 | 15 | 20 | 25 | 4 | 9 | 14 | 19 | 24 | 3 | 8 | 13 | 18 | 23 | 2 | 7 | 12 | 17 | 22 | 1 | 6 | 11 | 16 | 21 |