Vernam 密码
先看一道例题
Vernam cipher uses the formula ci = (ri + pi) mod n
character, Using the following two-digit random number sequence:
05 60 11 58 03 44 82 16 48 76
generate the ciphertext for the message: MISSI ONIMP (10 characters) using sum modulo 26 operation for coding the letters. Assume that character A is encoded as 0 and character Z is encoded as 25.
题目意思是让我们对原文:MISSI ONIMP进行加密,使用的随机秘钥为05 60 11 58 03 44 82 16 48 76。加密公式为ci = (ri + pi) mod n ,这里n为26,ri就是第几个随机数字,那么要注意的是pi在该题中是在字母表中的顺序,从0开始算,即a=0;mod是取余操作。分析完毕,解题过程如下:
Plaintext | M I S S I O N I M P |
---|---|
Numerical Equivalent | 12 8 18 18 8 14 13 8 12 15 |
Random No. | 05 60 11 58 03 44 82 16 48 76 |
Sum | 17 68 29 76 11 58 95 24 60 91 |
Mod 26 | 26 17 1 |