900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > 凯撒密码pythin密码_凯撒密码术

凯撒密码pythin密码_凯撒密码术

时间:2024-03-06 10:38:35

相关推荐

凯撒密码pythin密码_凯撒密码术

凯撒密码pythin密码

Caesar cipheris one of the well-known techniques used for encrypting the data. Although not widely used due to its simplicity and being more prone to be cracked by any outsider, still this cipher holds much value as it is amongst the firstly developed encryption techniques which gave us the idea of developing the entire encryption and decryption process.

凯撒密码是用于加密数据的众所周知的技术之一。 尽管由于其简单性而未被广泛使用,并且更容易被任何外人破解,但该密码仍然具有很大的价值,因为它是最早开发的加密技术之一,使我们有了开发整个加密和解密过程的想法。

Now, talking about its characteristics and details,Caeser cipheris also known as"shift cipher". This is because, in this technique, we just shift the letters of the plain text to a certain number, (which is determined by the key) in a lexicographic order to obtain the ciphertext. The same number of letters in reverse lexicographic order is shifted back in the decryption process to obtain the plain text back.

现在,谈到其特征和细节,Caeser密码也被称为“移位密码”。 这是因为,在这种技术中,我们只是按照字典顺序将纯文本的字母移动到某个数字(由密钥确定)以获取密文。 在解密过程中,将相同数量的字母按逆序字典顺序移回以获取纯文本。

The following key points can be drawn for theCaeser cipher,

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

Caesar Cipher is also known as a shift cipher.

凯撒密码也被称为移位密码。

It is a type of symmetric-key cryptography.

它是一种对称密钥密码术 。

It follows the mono-alphabetic cipher, being a part of the substitution cipher.

它遵循单字母密码,是替代密码的一部分。

加密过程 (Encryption Process)

Here, we assume the numbers0-25represent the English alphabets in lexicographic order, i.e. froma to z.

在这里,我们假设数字0-25代表按字母顺序排列的英语字母,即从a到z。

Suppose, we have number denoting the letters of plain text denoted by'P', and a key, say'K'(Note that it is better to choose key within the range of alphabets:0 to 25).

假设我们有一个数字,表示由'P'表示的纯文本字母,一个键称为'K'(请注意,最好在字母范围0到25之间选择键)。

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

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

E (P, K) = ( P + K ) mod 26

解密过程 (Decryption Process)

Here also, the numbers0-25represent the English alphabets in lexicographic order, i.e. froma to z, and we choose the same key'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 (C, K) = ( C - K ) mod 26

示例问题 (Example Problem)

Given Plain text:'HELLO'Key:3Convert the given plain text into ciphertext:Solution:We write all the numbers associated with every letter of the plain text:H : 7E : 4L : 11O : 14Therefore, applying the Caeser cipher for each letter:E(H,3) = ( 7 + 3 ) mod 26= 10 = KE(E, 3) = ( 4 + 3) mod 26= 7 = HE(L, 3) = ( 11 + 3) mod 26= 14 = OE(O, 3) = ( 14 + 3) mod 26= 7 = RTherefore, the ciphertext that we get for the word'HELLO'is'KHOOR'.

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.

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

翻译自: /cryptography/caesar-cipher.aspx

凯撒密码pythin密码

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。