当前位置:网站首页>Classical cryptosystem -- substitution and replacement
Classical cryptosystem -- substitution and replacement
2022-06-27 06:39:00 【Da|Sha|Niao】
One 、 Introduction and classification
1. Introduce :
The classical code period is generally considered to be from ancient times to 19 The end of the century , The level of productivity was low during this period , encryption 、 The decryption method is mainly based on paper 、 A pen or simple instrument , The ciphers proposed and used in this period are called classical ciphers . Classical cryptography is the primary stage of the development of cryptography . Although most classical passwords are simple , But because of its poor security , At present, there are few applications . Study the principles of classical cryptography , Help to understand 、 Construct and analyze modern ciphers . replace ( substitution) And replacement (permutation) Are two basic processing techniques used in classical cryptography , They are also widely used in modern cryptography .
2. implementation technique :
- Replace Replace clear text characters with other letters 、 Numbers or symbols
- substitution The letters of plaintext are the same , But it was disrupted
3. classification
- Replace the password
- Single table substitution code
- Multiple tables replace passwords
- Replace password
Two 、 Replace the password
1. Single table substitution code
(1). Shift code
Ek(P): Ci = (Pi+k) mod n, Dk(P): Pi = (Ci-k) mod n,
among Ek For encryption algorithms ,Pi In plain text ,Ci For the cipher ,k A key ,n Is the number of letters ,Dk For decryption algorithm .
If it is a substitution between English letters , It can also be written in the following form :
Ci = (Pi + k) mod 26 Pi = (Ci - k) mod 26, among k∈[0,25]
The Caesar code Ci = (Pi + 3) mod 26 It is a shift substitution cipher .
(2). Affine code
Ek(P) = (aPi + b) mod m
(3). Replace the password
Means that each letter is composed of the other one alphabet ( The mapping from plaintext letters to ciphertext letters ) Encryption of letters in
How to decipher : Exhaustive key method 、 Statistical analysis ( Use the laws of language )
2. Multiple tables replace passwords
(1). Virginia code
The Virginia code consists of some Caesar codes with different offsets , The offset of each plaintext letter is determined by a given key . Such as clear text "abcd"( The key is plan), Clear text letter a The offset of is p Number of digits 15.a The offset 15 Bit followed by p,p It is the ciphertext letter corresponding to the plaintext letter .
Ci = (Pi + ki) mod 26
The Virginia code is also seen as based on a two-dimensional password table , The plaintext letter and the corresponding key letter are the number of rows and columns respectively , The corresponding letter found in the table is the ciphertext letter

give an example :
Plaintext :howareyou
secret key :mine
| Plaintext (P) | H | O | W | A | R | E | Y | O | U |
| secret key (k) | M | I | N | E | M | I | N | E | M |
| Ciphertext (C) | T | W | J | E | D | M | L | S | G |
Deciphering skills :
- The result of object substitution is the same if the interval is an integer multiple of the key length
- The substitution at the position where the interval is an integral multiple of the key length is a single table substitution
(2). One secret at a time
Using a random set of non repeating characters as the output ciphertext . Once the transformed input ciphertext is used , This input ciphertext is no longer used in any other message ( So it's disposable ). The length of the input ciphertext is equal to the length of the plaintext of the original message .
Here are the main steps .
1. Take each plaintext letter as a number in increasing order ,A=0,B=1 wait .
2. Do the same for each letter in the input plaintext .
3. Add each letter in the plaintext to the corresponding letter in the key .
4. If the sum obtained is greater than 26, Then subtract 26 (mod 26)
5. Convert and to letters , To get the ciphertext .
3、 ... and 、 Replace password
The replacement password is ⼀ Through ⼀ Set rules to change the order of characters in a string from ⽽ Implementation of cryptographic algorithms for encryption .
And the difference between substitution password :
Substitution password is to replace plaintext letters with different ciphertext letters , The generated ciphertext may contain letters that are not contained in the plaintext , The replacement password is just to disturb the position and order of the plaintext letters
There are many kinds of replacement passwords , Give an example of : Write the ciphertext line by line in the table , Read in column by column order , Such as clear text :howareyouImfinethankyouandyouhaha, Then ciphertext :hfuoiawnnaedrtyehoyauonhukaiyhmoa.
| H | O | W | A | R | E | Y | O | U | I | M |
| F | I | N | E | T | H | A | N | K | Y | O |
| U | A | N | D | Y | O | U | H | A | H | A |
边栏推荐
- Caldera installation and simple use
- JVM常用指令
- 426 binary tree (513. find the value in the lower left corner of the tree, 112. sum of paths, 106. construct a binary tree from the middle order and post order traversal sequence, 654. maximum binary
- JVM class loading mechanism
- Maxcompute SQL 的查询结果条数受限1W
- Fractional Order PID control
- 第 299 场周赛 第四题 6103. 从树中删除边的最小分数
- 426-二叉树(513.找树左下角的值、112. 路径总和、106.从中序与后序遍历序列构造二叉树、654. 最大二叉树)
- 2022 le fichier CISP - Pte (i) contient:
- Partial function of Scala
猜你喜欢

JVM整体结构解析

Cloud-Native Database Systems at Alibaba: Opportunities and Challenges

快速实现Thread Mesh组网详解

thrift

Inter thread wait and wake-up mechanism, singleton mode, blocking queue, timer

Fractional Order PID control

JVM的垃圾回收机制

IDEA中关于Postfix Completion代码模板的一些设置

426 binary tree (513. find the value in the lower left corner of the tree, 112. sum of paths, 106. construct a binary tree from the middle order and post order traversal sequence, 654. maximum binary

2022 le fichier CISP - Pte (i) contient:
随机推荐
日期 数据库日期 字符串 之间互相转换
TiDB 基本功能
G1和ZGC垃圾收集器
面试官:大量请求 Redis 不存在的数据,从而打倒数据库,你有什么方案?
使用CSDN 开发云搭建导航网站
2022 CISP-PTE(二)SQL注入
JVM object composition and storage
Distribution gaussienne, régression linéaire, régression logistique
Meaning of 0.0.0.0:x
【毕业季】毕业是人生旅途的新开始,你准备好了吗
Centos7.9安装mysql 5.7,并设置开机启动
One year's experience of technical personnel in Entrepreneurship
matlab GUI界面仿真直流电机和交流电机转速仿真
An Empirical Evaluation of In-Memory Multi-Version Concurrency Control
技术人员创业一年心得
OPPO面试整理,真正的八股文,狂虐面试官
SQL injection bypass (I)
Caldera安装及简单使用
Partial function of Scala
Configuration of vscode korofileheader