首页 > 编程知识 正文

什么是密码学中的密码,密码学经典加密方式

时间:2023-05-03 22:12:17 阅读:162940 作者:4866

希尔密码

itisapolygraphicsubstitutioncipherthatdependsonlinearalgebra.everyletterfromthealphabetisrepresentedbyseveralmodulo 26.simpherimphealetttttttttttted .Z=25 is used,butthisisnotacorrectfeatureofthecipher .

这是依赖线性代数的测谎替代密码。 字母的各文字从26开始成型。 简单地写了A=0,B=1,Z=25,但这不是密码的正确特征。

To encrypt a message、eachblockofnlettersismultipliedbyaninvertiblenn matrix、against modulus 26 orwecansaythemultipleinversersesof

为了加密消息,将n个字符的每个块乘以可逆nn矩阵(模数为26 )或n的多个逆。

To decrypt the message,everyblockismultipliedbytheinverseofthematrixorinversedmatrixusedforencryption。

为了解码消息,在每一块上乘以用于加密的矩阵或逆矩阵的倒数。

thematrixusedforencryptionistheplaintextandonematrixisformediscipherkeywhenwecombineormultiplethemwenewmatrixcalledc iphe andthekeyshouldbechosenrandomlyfromthesetofinvertiblenn matrices (模块26 )。

用于加密的矩阵是纯文本,将它们组合或相乘后,形成的矩阵是加密密钥,得到一个称为密文的新矩阵。 密钥必须从可逆nn矩阵集中随机选择(

加密(Encryption ) wehavetodoencryptiononthemessage ' act (n=3).thekeyis ' gybnqkurp ' whichcanbewrittenasthenasthenxnmatrixxththatttthon

必须加密消息“act”(n=3)。 关键是“GYBNQKURP”,NxN矩阵可以写成33矩阵。

themessageforencryption ' act ' iswrittenasavector、

加密的消息“ACT”写为向量。

The enciphered vector is given as,

加密向量

In this,wejustdothemultiplematriceswejustmultiplethe1row with1columnaswecansay6* 024 * 21 * 19=67 same as 13 * 016 * 210 * 19

在这里,我只需要做多个矩阵。 只将第一行和第一列相乘。 6 * 0 24 * 2 1 * 19=67与13 * 0 16 * 2 10 * 19=222相同,可以说是20 * 0 17 * 2 15 * 19=319。

andthatmatrixdoesthemod 26 withparticularcolumnandmadeagainthe3*1matrixandwealphabeticallywritethemwithcalledciphertexti.e '

然后,该矩阵使用特定列进行mod 26运算,再次生成3 * 1矩阵,按字母顺序写为密文,即“POH”。

解读(Decryption ) To decrypt the message,weturntheciphertextbackintoaplaintext,thensimplymultiplybytheinversematrixofthekeymage

为了解密此消息,请将密文转换为纯文本,然后轻松进行乘法运算

以密钥矩阵的逆矩阵,即字母“ 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” 。 然后,此纯文本用两对表示,因为n为2 。

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

希尔密码

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。