凯撒密码pythin密码

Caesar cipher is 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 cipher is 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 the Caeser 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 numbers 0-25 represent the English alphabets in lexicographic order, i.e. from a 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 numbers 0-25 represent the English alphabets in lexicographic order, i.e. from a 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.

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

翻译自: https://www.includehelp.com/cryptography/caesar-cipher.aspx

凯撒密码pythin密码

凯撒密码pythin密码_凯撒密码术相关推荐

  1. 运用python编写凯撒密码并实现_凯撒密码实现英文短句的加解密

    1. 将"We are students."这个英文词句用k=4的凯萨密码翻译成密码 1. 恺撒密码, 作为一种最为古老的对称加密体制,他的基本思想是: 通过把字母移动一定的位数来 ...

  2. 密码学基础(二)单表---置换密码 凯撒密码 棋盘密码 乘法密码 仿射密码 多表---vigenere方阵

    1古典密码 (1)置换密码 明文字母重新排列,字母本身不变,但是位置发生变化(倒序或者按照按照数组排列后以行或列重新组合) (2)代替密码 分为单表代替密码和多表代替密码 单表代替密码中代表性的 凯撒 ...

  3. 凯撒加密的python语言程序_凯是什么意思 凯字五行属什么

    凯字取名属性及五行属什么: 凯字的拼音:kai 凯的繁体字:凱(若无繁体,则显示本字) 凯字的起名笔画数:12 凯五行属什么:木 凯字的取名数理吉凶:吉 凯是否为姓氏:是 说明:"凯&quo ...

  4. 密码(图解密码技术)_第二章_历史上的密码

    凯撒密码 凯撒密码是一种相传尤利乌斯·凯撒曾使用过的密码.凯撒于公元前100年左右诞生于古罗马,是一位著名的军事统帅. 凯撒密码是通过字母按照一定的字数"平移"来进行加密的. 举例 ...

  5. js密码强度正则表达式_这20个正则表达式,能让你少写100行代码

    正则表达式,仅仅用一段非常简短的表达式语句,便能够快速实现一个非常复杂的业务逻辑.熟练地掌握正则表达式的话,能够使你的开发效率得到极大的提升. 正则表达式经常被用于字段或任意字符串的校验,如下面这段校 ...

  6. js密码强度正则表达式_知道这20个前端正则表达式,能让你做项目时少写1000行甚至一万行

    正则表达式,一个十分古老而又强大的文本处理工具,仅仅用一段非常简短的表达式语句,便能够快速实现一个非常复杂的业务逻辑.熟练地掌握正则表达式的话,能够使你的开发效率得到极大的提升. 正则表达式经常被用于 ...

  7. 密码(图解密码技术)_第一章_环游密码世界总结

    解释一下啊:我发现我没有段落空两字的时候已经不想改了,原谅我懒,这系列后面也是这样的(任性). 本书中的主要角色: Alice_一般角色 Bob_一般角色 Eve_窃听者 Mallory_主动攻击者 ...

  8. linux忘记密码修改密码_如何更改我的Linux密码

    linux忘记密码修改密码 How to change my password on a Linux box? The original password is generated by the ad ...

  9. githup用户名密码怎么看_最新tplink路由器如何设置密码 tplink路由器设置密码步骤【详解】...

    问:2017新tplink路由器怎么设置密码? 答:首先说明一下,这个问题不够严谨,不知道你是要修改TL路由器上的WiFi密码?还是要修改TP的管理员密码(登录密码)?鉴于此,下面学习啦小编会详细介绍 ...

最新文章

  1. Pandas 重复数据处理大全
  2. 皮一皮:这有够不明显的...
  3. 上海电信计划2015年用户带宽提高12.5倍
  4. js 下拉底部加载|滑轮滚动到页面底部ajax加载数据的实例
  5. wordpress多站点主站调用分站最新文章_企业网站SEO最新的7个优化步骤!
  6. 单片机wifi模块与服务器通信协议,单片机常用的几种通信协议
  7. 《Oracle高性能自动化运维》一一第1章 Linux下的Oracle
  8. 【Kafka】Kafka Failed to send SSL Close message IOException: Broken pipe
  9. Unity3D之UGUI基础1:UGUI插件介绍
  10. repost ACM算法学习三境界---王国维人间词话
  11. 不要质疑读者,读者永远比作者聪明
  12. 凭什么软件测试入门就有一万+工资,为什么?我不相信。
  13. python实现火车票查询_python实现12306火车票查询的实例全过程
  14. Linux下 Spring Boot 上传找不到临时目录, 出现500错误
  15. word文档中统计总页数_如何在Google文档中查找页数和字数统计
  16. 人脑与计算机之间有什么联系,电脑和人脑有什么不同
  17. 经纬度与距离的换算关系
  18. MATLAB之极限、积分、微分
  19. 虎头蛇尾的韩文学习记录
  20. wxpython 右键菜单_使用wxPython打造印象笔记(14)笔记本管理

热门文章

  1. springmvc 源码分析
  2. hdu1269迷宫城堡(判断有向图是否是一个强连通图)
  3. 宇轩网络面试题目PHP,二十道接地气的php面试题,让你直接通过面试!就此奉上~...
  4. oracle安装缺少,安装oracle11g R2 缺少依赖包
  5. phpnow mysql字符集_使用PHPnow搭建本地PHP环境+创建MySQL数据库
  6. mysql 副本 同步_副本机制与副本同步
  7. java匿名对象 回收_Java 匿名对象
  8. Spyder 代码自动补全功能,代码提示
  9. 实时备份工具之inotify+rsync
  10. c#简单类的继承【C#】