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

凯撒密码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密码

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/540722.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

MultiQC使用指导

MultiQC使用指导 官网资料文献:MultiQC --- summarize analysis results for multiple tools and samples in a single report参考资料一: 整合 fastq 质控结果的工具 简介 MultiQC 是一个基于Python的模块, 用于整合其它软件的报告结果, 目前支持以下软…

FYFG的完整形式是什么?

FYFG:对您的未来指导 (FYFG: For Your Future Guidance) FYFG is an abbreviation of "For Your Future Guidance". FYFG是“ For your Future Guidance”的缩写 。 It is an expression, which is commonly used in the Gmail platform. It is also wr…

WorkerMan 入门学习之(二)基础教程-Connection类的使用

一、TcpConnection类 的使用 1、简单的TCP测试 Server.php <?php require_once __DIR__./Workerman/Autoloader.php; use Workerman\Worker; $worker new Worker(websocket://0.0.0.0:80);// 连接回调 $worker->onConnect function ($connection){echo "connecti…

kotlin获取属性_Kotlin程序获取系统名称

kotlin获取属性The task is to get the system name. 任务是获取系统名称。 package com.includehelpimport java.net.InetAddress/*** Function for System Name*/fun getSystemName(): String? {return try {InetAddress.getLocalHost().hostName} catch (E: Exception) {S…

71文件类型

1.kit类型 标准的SeaJs模块文件类型&#xff0c;直接对外暴露方法。 2.units类型 依赖pageJob&#xff0c;对外暴露一个名字&#xff0c;pageJob依赖暴露的名字对模块进行初始化&#xff0c;在pageJob内部逻辑自动执行init方法&#xff1b; 由于没有对外暴露方法&#xff0c;只…

ruby 生成哈希值_哈希 Ruby中的运算符

ruby 生成哈希值In the last article, we have seen how we can carry out a comparison between two hash objects with the help of "" operator? "" method is a public instance method defined in Ruby’s library. 在上一篇文章中&#xff0c;我们看…

七牛大数据平台的演进与大数据分析实践--转

原文地址&#xff1a;http://www.infoq.com/cn/articles/qiniu-big-data-platform-evolution-and-analysis?utm_sourceinfoq&utm_mediumpopular_widget&utm_campaignpopular_content_list&utm_contenthomepage 七牛大数据平台的演进与大数据分析实践 (点击放大图像…

最大化切割段

Description: 描述&#xff1a; In this article we are going to review classic dynamic programing problem which has been featured in interview rounds of amazon. 在本文中&#xff0c;我们将回顾在亚马逊的采访轮次中已经介绍的经典动态编程问题。 Problem statemen…

响应数据传出(springMVC)

1. SpringMVC 输出模型数据概述 提供了以下几种途径输出模型数据&#xff1a; ModelAndView: 处理方法返回值类型为 ModelAndView 时, 方法体即可通过该对象添加模型数据 Map 及 Model: 入参为 org.springframework.ui.Model、 org.springframework.ui.ModelMap 或 java.uti…

python 字母顺序计数_计数并说出顺序

python 字母顺序计数Problem statement: 问题陈述&#xff1a; The count-and-say sequence is the sequence of integers with the first five terms as following: 计数序列是具有前五个项的整数序列&#xff0c;如下所示&#xff1a; 1 1个 11 11 21 21 1211 1211 111221 …

微信网页扫码登录的实现

为了让用户登录网站的门槛更低&#xff0c;微信扫一扫登录变得越来越广泛&#xff0c;所以最近加紧赶制的项目中有用到这个功能&#xff0c;此篇文字的出发点基于微信开放平台已经配置好域名&#xff08;80端口&#xff09;并且认证成功获得app_id和secret并有权限调用微信的接…

希尔密码_希尔密码| 网络安全

希尔密码Now, Hill Cipher is a very basic cryptographic technique which is used to convert a string into ciphertext. This technique was invented by an American Mathematician "Lester Sanders Hill". This is a polygraphic substitution cipher because …

Android 那些年,处理getActivity()为null的日子

在日常开发中的时候&#xff0c;我们经常会使用ViewPagerFragment进行视图滑动&#xff0c;在某些部分逻辑也许我们需要利用上下文Context&#xff08;例如基本的Toast&#xff09;&#xff0c;但是由于Fragment只是衣服在Activity容器的一个试图&#xff0c;如果需要拿到当前的…

设计模式状态模式uml_UML的完整形式是什么?

设计模式状态模式umlUML&#xff1a;统一建模语言 (UML: Unified Modeling Language) UML is an abbreviation of Unified Modeling Language. In the field of software engineering, it is a visual modeling language that is standard in quality. It makes it available t…

idea debug快捷键

idea的debug调试快捷键 F9 resume programe 恢复程序 AltF10 show execution point 显示执行断点 F8 Step Over 相当于eclipse的f6 跳到下一步 F7 Step Into 相当于eclipse的f5就是 进入到代码 AltshiftF7 Force Step Into 这个…

vqa mcb_MCB的完整形式是什么?

vqa mcbMCB&#xff1a;微型断路器 (MCB: Miniature Circuit Breaker) MCB is an abbreviation of "Miniature Circuit Breaker". MCB是“微型断路器”的缩写 。 It is an automatically operated electronics switch. It is designed to detect the fault in the e…

返回表达式列表中最小值least(exp1,exp2,exp3,……,expn)

1 least(exp1,exp2,exp3,……,expn)2 【功能】返回表达式列表中值最小的一个。如果表达式类型不同&#xff0c;会隐含转换为第一个表达式类型。3 【参数】exp1……n&#xff0c;各类型表达式4 【返回】exp1类型5 6 【示例】7 SELECT least(10,32,123,2006) FROM dual;8 9 SEL…

Java Short类hashCode()方法及示例

短类hashCode()方法 (Short class hashCode() method) hashCode() method is available in java.lang package. hashCode()方法在java.lang包中可用。 hashCode() method is used to return hashcode of the Short object.hashCode()方法用于返回Short对象的哈希码。 hashCode(…

CentOS忘记普通用户密码解决办法

普通用户忘记密码 1.使用root用户登录系统&#xff0c;找到/etc/shadow文件。 2.找到用户名开头的那一行&#xff0c;例如我的用户名为pds,&#xff0c;以冒号为分割符&#xff0c;红色部分是密码加密部分 pds:$1$CivopRgF$ajWQ54W1XJbifFjm05Jk/1:15353:0:99999:7::: 3.pds是我…

julia 编程语言_Julia编程语言中的变量

julia 编程语言Julia中的变量 (Variables in Julia) Just like other programming languages, in Julia variables are the name of memory blocks that are associated (or bound) to a value. It is useful when a value to be stored or to be accessed in/from memory loca…