希尔密码_密码学中的希尔密码

希尔密码

It is a polygraphic substitution cipher that depends on linear algebra. Every letter from the alphabet is represented by several modulo 26. Simply, we write as A = 0, B = 1, ..., Z = 25 is used, but this is not a correct feature of the cipher.

这是一个依赖于线性代数的测谎替代密码。 字母表中的每个字母都由26为模。简单地,我们写为A = 0,B = 1,...,Z = 25 ,但这不是密码的正确特征。

To encrypt a message, each block of n letters is multiplied by an invertible n × n matrix, against modulus 26 or we can say the multiple inverses of n.

为了加密消息,将n个字母的每个块都乘以可逆n×n矩阵(模数为26)或我们可以说n的多个逆。

To decrypt the message, every block is multiplied by the inverse of the matrix or inversed matrix used for encryption.

为了解密该消息,将每个块乘以用于加密的矩阵或逆矩阵的逆。

The matrix used for encryption is the plain text and one matrix is formed is cipher key when we combine or multiple them we get the new matrix called ciphertext, and the key should be chosen randomly from the set of invertible n × n matrices (modulo 26).

用于加密的矩阵是纯文本,当我们将它们组合或相乘时,形成的一个矩阵是密码**,得到一个新的矩阵,称为密文,**应从可逆n×n矩阵集中随机选择(取模26 )。

加密 (Encryption)

We have to do encryption on the message 'ACT' (n=3). The key is 'GYBNQKURP' which can be written as the n x n matrix that is 3 x 3 matrix,

我们必须对消息“ ACT”(n = 3)进行加密。 关键是“GYBNQKURP”,其可以被写为NxN矩阵是3×3矩阵,

希尔密码_密码学中的希尔密码

The message for encryption 'ACT' is written as a vector,

加密消息“ ACT”写为矢量,

希尔密码_密码学中的希尔密码

The enciphered vector is given as,

加密的向量为

希尔密码_密码学中的希尔密码

In this, we just do the multiple matrices we just multiple the 1 row with 1 column as we can say 6*0+24*2+1*19=67 same as 13*0+16*2+10*19=222 and 20*0+17*2+15*19=319.

在这里,我们只是做多个矩阵,我们只将1行与1列相乘,我们可以说6 * 0 + 24 * 2 + 1 * 19 = 6713 * 0 + 16 * 2 + 10 * 19 = 222相同20 * 0 + 17 * 2 + 15 * 19 = 319

And that matrix does the mod 26 with particular column and made again the 3*1 matrix and we alphabetically write them with called ciphertext i.e "POH".

然后,该矩阵使用特定的列进行mod 26运算,并再次制作3 * 1矩阵,然后按字母顺序将其写为密文,即“ POH”

解密 (Decryption)

To decrypt the message, we turn the ciphertext back into a plain text, then simply multiply by the inverse matrix of the key matrix as "IFKVIVVMI" in letters. The inverse of the matrix used in the encryption is,

为了解密该消息,我们将密文转换回纯文本,然后简单地乘以**矩阵的逆矩阵,即字母“ IFKVIVVMI” 。 加密中使用的矩阵的逆是

希尔密码_密码学中的希尔密码

For ciphertext which we already find we decrypt that and make plain text,

对于我们已经发现的密文,我们将其解密并制成纯文本,

希尔密码_密码学中的希尔密码

Now, we just find the inverse matrix then multiple it by key then it will give us back "ACT".

现在,我们只需找到逆矩阵,然后将其乘以键,然后它将返回“ ACT”

Let, K is DDCF

设K为DDCF

希尔密码_密码学中的希尔密码

be the key and suppose the plaintext is "HELP". Then this plaintext is represented by two pairs because n is 2.

是键,并假定明文为“ HELP” 。 然后,此纯文本用两对表示,因为n2

希尔密码_密码学中的希尔密码

Firstly we do encryption, then we will compute

首先我们进行加密,然后我们将进行计算

希尔密码_密码学中的希尔密码

and continue encryption as follows and written as,

并继续如下加密并写为:

希尔密码_密码学中的希尔密码

The matrix K is invertible, hence K-1 exists such that KK-1 = K-1K = I2 The inverse of K can be computed by using the formula,

矩阵K是可逆的,因此存在K -1 ,使得KK -1 = K -1 K = I 2可以使用公式计算K的逆,

希尔密码_密码学中的希尔密码

This formula still holds after a modular reduction if a modular multiplicative inverse is used to compute.

如果使用模块化乘法逆来进行计算,则该公式在模块化归约后仍然成立。

Now, we have to do decryption,

现在,我们必须进行解密,

希尔密码_密码学中的希尔密码

Then we compute,

然后我们计算

希尔密码_密码学中的希尔密码

And we get,

我们得到

希尔密码_密码学中的希尔密码

Security

安全

The basic Hill Cipher is vulnerable to a known-plaintext attack that attacks by key because it is completely linear algebra. An opposite site that intercepts n plaintext/ciphertext character pairs can set up a linear system that can be easily solved; if this will happen then this system is undefined, it is the only way is to add a few more plaintexts/ciphertext pairs. While when n x n matrix multiplication is a useful step when it will be combined with other non-linear operations because matrix multiplication can provide diffusion. For example, a unique chosen matrix can give security that minor differences before the matrix multiplication will give the answer in huge differences after the matrix multiplication. Otherwise, some new ciphers use a matrix multiplication step to gave diffusion. For example, the MixColumns matrix step in AES cipher is matrix multiplication. The function g in Twofish is a combination of non-linear algebra S-boxes i.e substitution boxes with a carefully chosen matrix multiplication (MDS) is used this.

基本的希尔密码很容易受到已知明文攻击,因为它是完全线性的代数,因此会受到**的攻击。 截获n个纯文本/密文字符对的相对站点可以建立一个易于解决的线性系统; 如果将发生这种情况,则该系统是不确定的,唯一的方法是添加更多的明文/密文对。 当nxn矩阵乘法是有用的步骤时,它将与其他非线性运算结合使用,因为矩阵乘法可以提供扩散。 例如,唯一选择的矩阵可以确保矩阵乘法之前的微小差异将在矩阵乘法之后的巨大差异中给出答案。 否则,某些新密码将使用矩阵乘法步骤进行扩散。 例如,AES密码中的MixColumns矩阵步骤是矩阵乘法。 Twofish中的函数g是非线性代数S-box的组合,即,使用具有精心选择的矩阵乘法(MDS)的替换框。

Reference: Hill Cipher

参考: 希尔密码

翻译自: https://www.includehelp.com/cryptography/hill-cipher.aspx

希尔密码