希爾密碼_希爾密碼| 網絡安全

希爾密碼

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 the substitution or encryption is performed on the block on letters. It works on multiple letters at the same time. It was the first polygraphic cipher which was operable on more than 3 symbols.

現在, Hill Cipher是一種非常基本的加密技術,用于將字符串轉換為密文。 這項技術是由美國數學家“萊斯特·桑德斯·希爾(Lester Sanders Hill)”發明的。 這是一個多圖形替換密碼,因為替換或加密是在字母上的塊上執行的。 它可以同時處理多個字母。 這是第一個可用于3個以上符號的多重密碼。

Implementation Technique

實施技術

加密 (Encryption )

In Hill Cipher, each letter is represented by a number modulo 26. So according to this, A = 0, B = 1, C = 2, ..., Z = 25. A string will be given to you and you have to make a column matrix using the letter-numberer relationship shown above. We'll be given a key matrix as well. We must ensure that | Key | should not be zero otherwise we can not apply hill cipher technique. This key matrix will be used in decryption as well. We need to multiply these two matrices. The formula for the ciphertext using Hill Cipher is:

Hill Cipher中 ,每個字母都由一個以26為模的數字表示。因此, A = 0,B = 1,C = 2,...,Z = 25 。 將為您提供一個字符串,您必須使用上面顯示的字母-數字關系創建一個列矩陣。 我們還將獲得一個密鑰矩陣。 我們必須確保 關鍵 不應為零,否則我們將無法應用希爾密碼技術 。 該密鑰矩陣也將用于解密。 我們需要將這兩個矩陣相乘。 使用希爾密碼的密文公式為:

Hill Cipher | 1

Here, n is the order of matrix or we can say the n is the number of letters we are taking at once to encrypt. Now, you'll get column matrix of order n x 1 which will have numbers from 0 to 25. You just have to replace the number with the letters from the relationship shown above and your ciphertext is ready.

在這里, n是矩陣的階數,或者我們可以說n是我們一次要加密的字母數。 現在,您將獲得順序為nx 1的列矩陣,該列矩陣的數字從0到25。您只需要用上面顯示的關系中的字母替換數字,即可準備好密文。

解密 (Decryption)

The letter-numberer relationship will remain the same in the decryption part. We'll use the inverse of the key matrix in decryption. Order of the matrix will remain the same. We need to multiply the inverse of the key matrix with the cipher text matrix we've got from the encryption technique. The formula is given below:

字母-數字關系在解密部分將保持不變。 我們將在解密中使用密鑰矩陣的逆函數。 矩陣的順序將保持不變。 我們需要將密鑰矩陣的逆乘以從加密技術獲得的密文矩陣。 公式如下:

Hill Cipher | 2

Example:

例:

Let us take plain text: DOG and the key matrix is:

讓我們采用純文本:DOG和密鑰矩陣為:

Hill Cipher | 3

D = 3, O = 14 , G = 6 so our column matrix is:

D = 3,O = 14,G = 6,所以我們的列矩陣為:

Hill Cipher | 4

Now we have to apply the multiplication as shown in the encryption formula. After multiplying and applying modulo 26 we got this cipher text matrix:

現在,我們必須應用加密公式中所示的乘法。 在乘并應用模26之后,我們得到了這個密文矩陣:

Hill Cipher | 5

Now, 22 = W, 11 = L, 24 = Y

現在,22 = W,11 = L,24 = Y

So cipher text of DOG is WLY

所以DOG的密文是WLY

Now we'll do decryption and we'll use the generated ciphertext to convert it to plain text. First of all, we need to find the inverse of the key matrix. So the inverse of our key matrix is:

現在我們將進行解密,并將使用生成的密文將其轉換為純文本。 首先,我們需要找到密鑰矩陣的逆矩陣。 因此,我們的密鑰矩陣的逆是:

Hill Cipher | 6

Now after multiplying the inverse matrix with the ciphertext matrix that we've generated in the encryption, we can get out plain text matrix again.

現在,將逆矩陣與我們在加密中生成的密文矩陣相乘后,我們可以再次得到純文本矩陣。

So after multiplying and taking modulo 26, the decrypted matrix is:

因此,在乘以26后,解密后的矩陣為:

Hill Cipher | 7

3 = D, 14 = 0 and 6 = G, So this is equal to the plain text it means our encryption and decryption both are right. Now, the Hill Cipher technique is over.

3 = D,14 = 0和6 = G,所以這等于純文本,這意味著我們的加密和解密都是正確的。 現在, 希爾密碼技術已經結束。

翻譯自: https://www.includehelp.com/cyber-security/hill-cipher.aspx

希爾密碼

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/540710.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/540710.shtml
英文地址,請注明出處:http://en.pswp.cn/news/540710.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Android 那些年,處理getActivity()為null的日子

在日常開發中的時候,我們經常會使用ViewPagerFragment進行視圖滑動,在某些部分邏輯也許我們需要利用上下文Context(例如基本的Toast),但是由于Fragment只是衣服在Activity容器的一個試圖,如果需要拿到當前的…

設計模式狀態模式uml_UML的完整形式是什么?

設計模式狀態模式umlUML:統一建模語言 (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:微型斷路器 (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 【功能】返回表達式列表中值最小的一個。如果表達式類型不同,會隱含轉換為第一個表達式類型。3 【參數】exp1……n,各類型表達式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用戶登錄系統,找到/etc/shadow文件。 2.找到用戶名開頭的那一行,例如我的用戶名為pds,,以冒號為分割符,紅色部分是密碼加密部分 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…

php腳本超時 結束執行代碼

函數:stream_context_create ,file_get_content 創建并返回一個文本數據流并應用各種選項,可用于fopen(),file_get_contents()等過程的超時設置、代理服務器、請求方式、頭信息設置的特殊過程。函數原型:resource stream_context_create ([ a…

c#byte字節流的讀取_C#中的byte關鍵字

c#byte字節流的讀取C#字節關鍵字 (C# byte keyword) In C#, byte is a keyword which is used to declare a variable that can store an unsigned value between 0 to 255. byte keyword is an alias of System.Byte. 在C#中, byte是一個關鍵…

esp32的GPIO操作

對于任何一款芯片,GPIO接口是其最基本的組成部分,也是一款芯片入門的最基本操作,下面論述下 關于esp32開發版的GPIO操作,本文中重點講解下 關于如何創建eclipse工程,并通過eclipse下載到esp32中去(本文的工…

c# bool?和bool_C#中的bool關鍵字

c# bool?和boolC#bool關鍵字 (C# bool keyword) In C#, bool is a keyword which is used to declare a variable that can store Boolean values true or false. bool keyword is an alias of System.Boolean. 在C#中, bool是一個關鍵字&am…

聚焦數據的力量——全球領先安全技術分享會在京召開

ZD至頂網安全頻道 04月21日 綜合消息: 由中國網絡安全與信息化產業聯盟、360共同主辦的“數據的力量——全球領先安全技術分享會“今日在北京成功召開。來自政府、企業、教育、投資機構和產業聯盟的300多位嘉賓參加了本次技術分享會,共同就安全產業發展趨…

algol語言_ALGOL的完整形式是什么?

algol語言ALGOL:算法語言 (ALGOL: Algorithmic Language) ALGOL is an abbreviation of "Algorithmic Language". ALGOL是“算法語言”的縮寫 。 It is a family of very significant computer programming languages, initially designed and created i…

Qt/QML編程學習之心得:一個.qml文件調用另一個.qml文件(十七)

在c++中,一個文件調用另外一個文件最直接最快捷的方式就是#incldue<頭文件>的使用,那么在元數據描述性語言QML中,如何從一個界面描述調用另外一個界面描述,一個.qml文件調用另外一個.qml呢?QML雖然有個import,但是用法可以說完全不同于#include。 引用方法1:直接…

如何設置Fedora默認從命令行啟動?

2019獨角獸企業重金招聘Python工程師標準>>> Sumary:因為在Fedora中沒有/etc/initab文件我們不方便從這里設置它的runlevel target&#xff0c;但是Linux又給我們提供了一個強悍的工具systemd,我們可以用system來鏈接默認的啟動級別&#xff0c;所以開始吧&#xff…

scala 線性回歸_Scala的特征線性化

scala 線性回歸Scala | 特性線性化 (Scala | Trait Linearization) In Scala programming language, trait linearization is a property that helps to rectify ambiguity when instances of a class that are defined using multiple inheritances from different classes an…

MDK C++中對內聯的極度優化

先來看看我們SmartIRQ的具體實現 // 智能IRQ&#xff0c;初始化時備份&#xff0c;銷毀時還原 class SmartIRQ { public:force_inline SmartIRQ(bool enable false){_state __get_PRIMASK();if(enable)__enable_irq();else__disable_irq();}force_inline ~SmartIRQ(){__set_P…

python中類怎么理解_Python中的列表理解

python中類怎么理解In order to create a list, a most obvious and remembered solution is to use a for-loop. 為了創建列表&#xff0c;最明顯和記住的解決方案是使用for循環。 Example: 例&#xff1a; Python 3.6.8 (default, Apr 25 2019, 21:02:35)[GCC 4.8.5 201506…

工控領域的網絡攻擊 食尸鬼行動深入解讀Operation Ghoul

卡巴斯基于2016年6月監測到了Operation Ghoul&#xff08;食尸鬼行動&#xff09;網絡攻擊&#xff0c;Operation Ghoul針對30多個國家的工業、制造業和工程管理機構發起了定向滲透入侵。目前&#xff0c;卡巴斯基發現&#xff0c;有130多個機構已被確認為這類攻擊的受害者。 該…