维吉尼亚密码和一次性密码本_密码学中的一次性密码
維吉尼亞密碼和一次性密碼本
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密碼相似,因?yàn)橄駐ernam密碼一樣 ,該密碼技術(shù)還通過(guò)在文本的二進(jìn)制級(jí)別上進(jìn)行工作來(lái)對(duì)純文本進(jìn)行加密。 兩者之間的唯一區(qū)別是,Vernam密碼中的密鑰長(zhǎng)度必須小于或等于純文本的長(zhǎng)度,而在一次性填充密碼中 ,密鑰的長(zhǎng)度必須等于純文本的長(zhǎng)度。純文本。 它不能少于那個(gè)。
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.
現(xiàn)在,在談?wù)撈涮卣骱图?xì)節(jié)時(shí), 一次性填充密碼是一種密碼,在該密碼中,我們同時(shí)考慮了純文本和二進(jìn)制形式的密鑰字符串。
The following key points can be drawn for the One Time Pad cipher,
可以為One Time Pad密碼得出以下要點(diǎn),
The key chosen here is a string whose length must be equal to the length of the plain text.
此處選擇的鍵是一個(gè)字符串,其長(zhǎng)度必須等于純文本的長(zhǎng)度。
The key can be either in string form or directly in binary form also.
密鑰可以是字符串形式,也可以是直接二進(jìn)制形式。
It is a type of symmetric-key cryptography.
它是一種對(duì)稱密鑰密碼術(shù) 。
It is a type of poly-alphabetic cipher, being a part of the substitution cipher.
它是多字母密碼的一種,是替代密碼的一部分。
加密過(guò)程 (Encryption Process)
Here, firstly, we convert both our plain text and the key string into its binary form.
在這里,首先,我們將純文本和密鑰字符串都轉(zhuǎn)換為二進(jìn)制格式。
Perform XOR operation between the elements of the plain text with the respective elements of the ley string which hold the same positions.
在純文本的元素與ley字符串的各個(gè)元素保持相同位置之間執(zhí)行XOR操作。
Therefore, the encryption on the plain text to convert it into ciphertext is performed as follows,
因此,對(duì)純文本進(jìn)行加密以將其轉(zhuǎn)換為密文的過(guò)程如下:
E (Pi , Ki) = Pi (XOR) Ki
解密過(guò)程 (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,
解密密文以將其轉(zhuǎn)換回純文本的過(guò)程以與加密過(guò)程相同的方式執(zhí)行。 因此,在Vernam密碼下解密文本的公式如下:
D (Ci , Ki) = Ci (XOR) Ki示例問(wèn)題 (Example Problem)
Given Plain text: IF Key: 1101011 0101111Convert the given plain text into cipher text...
將給定的純文本轉(zhuǎn)換為密文...
Solution:
解:
Convert the given plain text into its binary form,
將給定的純文本轉(zhuǎn)換為其二進(jìn)制形式,
1001001 1000110Check whether the length of the key if equal to that of the plain text,
檢查密鑰的長(zhǎng)度是否等于純文本的長(zhǎng)度,
1 0 0 1 0 0 1 1 0 0 0 1 1 01 1 0 1 0 1 1 0 1 0 1 1 1 1Tape the elements of the plain text with the respective elements of the ley string which hold the same positions.
將純文本的元素與ley字符串的各個(gè)元素保持相同的位置。
Example for position 1, we encrypt as follows,
位置1的示例,我們加密如下,
E( 1, 1 ) = 1 XOR 1= 0Similarly, after performing the encryption for the whole plain text, we get the following results,
同樣,在對(duì)整個(gè)純文本進(jìn)行加密之后,我們得到以下結(jié)果,
1 0 0 1 0 0 1 1 0 0 0 1 1 01 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.
注意:您可以通過(guò)對(duì)密文應(yīng)用解密過(guò)程來(lái)交叉檢查您的答案,如果它與純文本相同,則表明我們的答案是正確的。
翻譯自: https://www.includehelp.com/cryptography/one-time-pad-cipher.aspx
維吉尼亞密碼和一次性密碼本
總結(jié)
以上是生活随笔為你收集整理的维吉尼亚密码和一次性密码本_密码学中的一次性密码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: c++ cdi+示例_C ++“和”关键
- 下一篇: scala hashmap_如何在Sca