凱撒密碼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.pswp.cn/news/540722.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/540722.shtml
英文地址,請注明出處:http://en.pswp.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…