维吉尼亚密码和一次性密码本_密码学中的一次性密码

维吉尼亚密码和一次性密码本

The One-time Pad cipher is almost similar to the Vernam cipher, as, like the vernam cipher, this cipher technique also encrypts the plain text by working on the binary level of the text. The only difference between the two is that the length of the key in the Vernam Cipher must be less than or equal to the length of the plain text, whereas, in One-time pad Cipher, the length of the key must be equal to that of the Plain text. It cannot be less than that.

一次性Pad密码几乎与Vernam密码相似,因为像vernam密码一样 ,该密码技术还通过在文本的二进制级别上进行工作来对纯文本进行加密。 两者之间的唯一区别是,Vernam密码中的密钥长度必须小于或等于纯文本的长度,而在一次性填充密码中 ,密钥的长度必须等于纯文本的长度。纯文本。 它不能少于那个。

Now, talking about its characteristics and details, One-time pad cipher is a cipher in which we consider both the plain text and the key string in its binary form.

现在,在谈论其特征和细节时, 一次性填充密码是一种密码,在该密码中,我们同时考虑了纯文本和二进制形式的密钥字符串。

The following key points can be drawn for the One Time Pad cipher,

可以为One Time Pad密码得出以下要点,

  • The key chosen here is a string whose length must be equal to the length of the plain text.

    此处选择的键是一个字符串,其长度必须等于纯文本的长度。

  • The key can be either in string form or directly in binary form also.

    密钥可以是字符串形式,也可以是直接二进制形式。

  • It is a type of symmetric-key cryptography.

    它是一种对称密钥密码术

  • It is a type of poly-alphabetic cipher, being a part of the substitution cipher.

    它是多字母密码的一种,是替代密码的一部分。

加密过程 (Encryption Process)

  • Here, firstly, we convert both our plain text and the key string into its binary form.

    在这里,首先,我们将纯文本和密钥字符串都转换为二进制格式。

  • Perform XOR operation between the elements of the plain text with the respective elements of the ley string which hold the same positions.

    在纯文本的元素与ley字符串的各个元素保持相同位置之间执行XOR操作。

  • Therefore, the encryption on the plain text to convert it into ciphertext is performed as follows,

    因此,对纯文本进行加密以将其转换为密文的过程如下:

        E (Pi , Ki) =  Pi  (XOR)  Ki
    
    

解密过程 (Decryption Process)

The process of decrypting the ciphertext to convert it back into plain text is performed in the same way as the encryption process. Therefore, the formula for decryption of the text under Vernam cipher is as follows,

解密密文以将其转换回纯文本的过程以与加密过程相同的方式执行。 因此,在Vernam密码下解密文本的公式如下:

    D (Ci , Ki) =  Ci (XOR) Ki

示例问题 (Example Problem)

    Given Plain text: IF 
    Key: 1101011 0101111

Convert the given plain text into cipher text...

将给定的纯文本转换为密文...

Solution:

解:

  • Convert the given plain text into its binary form,

    将给定的纯文本转换为其二进制形式,

        1001001 1000110
    
    
  • Check whether the length of the key if equal to that of the plain text,

    检查密钥的长度是否等于纯文本的长度,

        1 0 0 1 0 0 1   1 0 0 0 1 1 0
        1 1 0 1 0 1 1   0 1 0 1 1 1 1
    
    
  • Tape the elements of the plain text with the respective elements of the ley string which hold the same positions.

    将纯文本的元素与ley字符串的各个元素保持相同的位置。

    Example for position 1, we encrypt as follows,

    位置1的示例,我们加密如下,

        E( 1, 1 )   =  1  XOR  1
                    = 0
    
    
  • Similarly, after performing the encryption for the whole plain text, we get the following results,

    同样,在对整个纯文本进行加密之后,我们得到以下结果,

        1 0 0 1 0 0 1   1 0 0 0 1 1 0
        1 1 0 1 0 1 1   0 1 0 1 1 1 1 
        ------------------------------
        0 1 0 0 0 1 0   1 1 0 1 0 0 1
    
    

Note: You can cross-check your answer by applying the decryption process over the ciphertext, and if it comes back to be the same as the plain text, then it means that our answer is correct.

注意:您可以通过对密文应用解密过程来交叉检查您的答案,如果它与纯文本相同,则表明我们的答案是正确的。

翻译自: https://www.includehelp.com/cryptography/one-time-pad-cipher.aspx

维吉尼亚密码和一次性密码本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值