古典密码-希尔密码Hill

本文目的在于整合了网上的Hill Cipher原理、解密及算法实现
大部分均为转载,可以链接到原文地址查看,这里只是整合文章

简介

以下直接搬运原文,便于查看,也可以直接链接到原文地址查看

ctf-wiki-Hill

ctf-wiki-Hill

希尔密码(Hill)使用每个字母在字母表中的顺序作为其对应的数字,即 A=0,B=1,C=2 等,然后将明文转化为 n 维向量,跟一个 n × n 的矩阵相乘,再将得出的结果模 26。注意用作加密的矩阵(即密匙)在 Zn26Z26n 必须是可逆的,否则就不可能解码。只有矩阵的行列式和 26 互质,才是可逆的。下面举一个例子

明文:ACT

将明文化为矩阵。

[left[ egin{matrix} 0 \ 2 \ 19 end{matrix} ight] ]

假设密钥为:

[left[ egin{matrix} 6&24&1 \ 13&16&10 \ 20&17&15 end{matrix} ight] ]

加密过程为:

[left[ egin{matrix} 6&24&1 \ 13&16&10 \ 20&17&15 end{matrix} ight]left[ egin{matrix} 0 \ 2 \ 19 end{matrix} ight] ≡left[ egin{matrix} 67 \ 222 \ 319 end{matrix} ight] mod 26 ]

密文即为

密文:POH

practicalcryptography.com-Hill

practicalcryptography.com-Hill

该网站详细地介绍了Hill密码,包括历史、运用等等

但是在线的脚本只能支持 2 × 2 矩阵

Decrypto

  1. 在线网页
    http://www.atoolbox.net/Tool.php?Id=914
    http://www.practicalcryptography.com/ciphers/hill-cipher/
  2. C语言实现解密算法
    https://blog.51cto.com/xmwen1/1751672

相关题目

ISCC 2015 base decrypt 150

这里我们以 ISCC 2015 base decrypt 150 为例进行介绍,题目为

密文: 22,09,00,12,03,01,10,03,04,08,01,17 (wjamdbkdeibr)

使用的矩阵是 1 2 3 4 5 6 7 8 10

请对密文解密.

首先,矩阵是 3 × 3 的。说明每次加密 3 个字符。我们直接使用 Cryptool,需要注意的是,这个矩阵是按照列来排布的。即如下

1 4 7
2 5 8
3 6 10

参考WP:
github.com/purpleroc/ISCC-2015-Writeups

最后的结果为 overthehillx

原文地址:https://www.cnblogs.com/labster/p/13848395.html