維吉尼亞密碼和一次性密碼本
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
維吉尼亞密碼和一次性密碼本