592 words
3 minutes
Cryptography入门

写在前面#

你是否被reverse中的神必加密小程序搞得神志不清?

你是否读懂了加密代码后却对解密无从下手?

反正我这几天是被折磨不轻了,遂决定从密码学中学习一点皮毛以缓解痛楚。

之后会在一直更,但这两个月大概率不怎么会更了,安心准备转专业考试

第一章#

Cryptography, the methodology of concealing the content of messages, comes from the Greek root words kryptos, meaning hidden,and graphikos, meaning writing. The modern scientific study of cryptography is sometimes referred to as cryptology.

1. Caesar cipher#

操作:每个字母都被替换

总体来说,他属于一种大的类型——替换密码

aadfa957-d59d-442a-a88e-2b2767622576

由于这样子看稍费一点脖子,于是整理成表:

db6fe07d-e618-4e7c-9455-33f646ffedb8

2. one-to-one or injective#

跟函数一样,即有加密函数中两个明文字母不会同时指向同一个密文字母

顺着凯撒密码的思路,也就是说,我们可以瞎几把乱对映(a->26个字母中的任意一个,以此类推)得出有26·25·24…·1=26!种方法,将26个明文字母分配给26个密文字母。

也就是说,面对这种东西的时候,你得有策略,想方设法去做。

Your opponent always uses her best strategy to defeat you, not the strategy that you want her to use. Thus the security of an encryption system depends on the best known method to break it. As new and improved methods are developed, the level of security can only get worse, never better.

eg:习惯法,我第一次见到是在福尔摩斯来着

To take an extreme example, the letter q in English is virtually always followed by the letter u. More useful is the fact that certain letters such as e and t appear far more frequently than other letters such as f and c. Table lists the letters with their typical frequencies in English text. As you can see, the most frequent letter is e, followed by t, a, o, and n.

13e857f7-19f5-44fc-8ef9-394f1f20c7ed

通过对加密的消息制作频率表,便可以迅速确定e,再通过e展开去推断

A simple substitution cipher to cryptanalyze:


LOJUM YLJME PDYVJ QXTDV SVJNL DMTJZ WMJGG YSNDL UYLEO SKDVC

GEPJS MDIPD NEJSK DNJTJ LSKDL OSVDV DNGYN VSGLL OSCIO LGOYG

ESNEP CGYSN GUJMJ DGYNK DPPYX PJDGG SVDNT WMSWS GYLYS NGSKJ

CEPYQ GSGLD MLPYN IUSCP QOYGM JGCPL GDWWJ DMLSL OJCNY NYLYD

LJQLO DLCNL YPLOJ TPJDM NJQLO JWMSE JGGJG XTUOY EOOJO DQDMM

YBJQD LLOJV LOJTV YIOLU JPPES NGYQJ MOYVD GDNJE MSVDN EJM


这个时候,我的话就直接让AI分析频率了,287ee719-f9be-4b30-af26-89f1c88f6cf4

不过这些倒是直接偷的书上的

2be4fa80-5f71-4aca-86af-bbdde5dc5e6c

然后是两个字的频率

b607fa6a-5bfe-48e2-96e1-ec7b24068a5b

9ef54f73-f737-4a69-b08a-7b7567469b17

c98714ce-0b8a-417d-a884-9742865cda95

29132ff3-0700-4d55-b944-fcce5aa917cc

5a11fac8-5257-430f-b96d-327ce0638173

c7cf5c91-85f6-4df2-99ae-fccddfdda366

具体的过程看原书就是了

Cryptography入门
https://dxfaker.top/posts/密码学阅读/
Author
dxfaker
Published at
2026-03-10
License
CC BY-NC-SA 4.0

Some information may be outdated