vigenere密码_密码学中的Vigenere密码

vigenere密码

The Vigenere cipher is one of the well-known techniques used for encrypting the data, which was proposed by Friedrich Kasiski in 1863. Although the Caeser cipher, which was amongst the firstly developed encryption techniques which gave us the idea of developing the entire encryption and decryption process, was not widely used due to its simplicity and being more prone to be cracked by any outsider. To overcome this, the algorithm of vigenere cipher was developed which was formed by a series of inter-woven caesar ciphers.

Vigenere密码是一种用于加密数据的众所周知的技术,这是Friedrich Kasiski在1863年提出的。尽管Caeser密码是最早开发的加密技术之一,但它使我们有了发展整个加密技术的想法。解密过程由于其简单性而未被广泛使用,并且更容易被任何外人破解。 为了克服这个问题,开发了由一系列交织的凯撒密码组成的vigenere密码算法。

Now, talking about its characteristics and details, Vigenere cipher, unlike the Caeser cipher, is a polyalphabetic cipher, which means that if a letter 'm' is replaced by a letter 'c' at a place, it can be replaced by some other letter say 'd' at some other place. This cipher is also a type of shift cipher because in this technique we just shift the letters of the plain text to a certain number, (which is determined by the corresponding character of the key string) in a lexicographic order to obtain the ciphertext. The same process is applied in reverse by subtracting the number. The respective letters are thus shifted in reverse lexicographic order are shifted back in the decryption process to obtain the plain text back.

现在,在谈论其特征和细节时, Vigenere密码与Caeser密码不同,它是一种多字母密码,这意味着如果某个位置的字母'm'被字母'c'替换,则它可以被其他字母替换。字母在其他地方说“ d” 。 该密码也是移位密码的一种,因为在这种技术中,我们只是按照字典顺序将纯文本的字母移位到某个数字(由键串的相应字符确定)以获取密文。 减去数字可反向执行相同的过程。 因此,在解密过程中将各个字母按字典顺序反向移回,以获得原始文本。

The following key points can be drawn for the Vigenere cipher,

可以为Vigenere密码得出以下要点,

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

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

  • 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, we assume the numbers 0-25 represent the English alphabets in lexicographic order, i.e. from a to z, and the letters of the Key string are also considered in the same manner.

    在这里,我们假设数字0-25代表按字母顺序排列的英语字母,即从a到z ,并且Key字符串的字母也以相同的方式考虑。

  • The letters of the key string are repeated again and again until its length becomes equal to that of the plain text.

    反复重复键串的字母,直到其长度等于纯文本的长度为止。

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

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

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

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

        E (Pi , Ki) = (Pi + Ki) mod 26
    
    

解密过程 (Decryption Process)

Here also, the numbers 0-25 represent the English alphabets in lexicographic order, i.e. from a to z, and we choose the same key string 'K' that we used to encrypt our data. Suppose we denote the numbers representing the letters of the ciphertext using 'C'.

同样,这里的数字0-25表示按字母顺序排列的英语字母,即从a到z ,我们选择用于加密数据的相同密钥字符串“ K” 。 假设我们用'C'表示代表密文字母的数字。

The decryption of the ciphertext to convert it back into plain text is performed as follows,

解密密文以将其转换回纯文本的过程如下:

    D (Ci , Ki) = ( Ci – Ki ) mod 26

示例问题 (Example Problem)

    Given Plain text: 'GIVE MONEY'
    Key: LOCK

Convert the given plain text into cipher text...

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

Solution:

解:

  • Repeat the key sting until its length becomes equal to that of the plain text,

    重复键击直到其长度等于纯文本的长度,

    G  I  V  E  M O N E  Y
    L  O  C  K  L  O C  K  L
    
    
  • 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( G, L )   = ( G + L ) mod 26
                = ( 11 + 6 ) mod 26
                = 17 mod 26
                = R
    
    

Similarly, after performing the encryption for the whole plain text, the cipher text that we get for the word 'GIVEMONEY' is 'RWXOXCPOJ'.

类似地,在对整个纯文本执行加密之后,我们为单词'GIVEMONEY'获得的密文为'RWXOXCPOJ'

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/vigenere-cipher.aspx

vigenere密码

你可能感兴趣的:(字符串,python,java,算法,编程语言)