Cryptography With Python 简明教程
One Time Pad Cipher
一次性密文是一种韦格纳密码,它包括以下功能:
One-time pad cipher is a type of Vignere cipher which includes the following features −
-
It is an unbreakable cipher.
-
The key is exactly same as the length of message which is encrypted.
-
The key is made up of random symbols.
-
As the name suggests, key is used one time only and never used again for any other message to be encrypted.
因此,加密消息对于密码分析员而言容易受到攻击。用于一次性密文的密匙称为 pad ,因为它被印在纸张上。
Due to this, encrypted message will be vulnerable to attack for a cryptanalyst. The key used for a one-time pad cipher is called pad, as it is printed on pads of paper.
Why is it Unbreakable?
密匙无法破解,原因是以下特性:
The key is unbreakable owing to the following features −
-
The key is as long as the given message.
-
The key is truly random and specially auto-generated.
-
Key and plain text calculated as modulo 10/26/2.
-
Each key should be used once and destroyed by both sender and receiver.
-
There should be two copies of key: one with the sender and other with the receiver.
Encryption
要加密一封信件,用户需要在纯文本下方书写密钥。纯文本信件放置在顶部,密钥信件放置在左侧。这两个信件之间的横截面为纯文本。如下例中所述:
To encrypt a letter, a user needs to write a key underneath the plaintext. The plaintext letter is placed on the top and the key letter on the left. The cross section achieved between two letters is the plain text. It is described in the example below −
