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

希尔密码

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.mzph.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多个机构已被确认为这类攻击的受害者。 该…