当前位置:网站首页>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 |
边栏推荐
- JVM整体结构解析
- Cloud-Native Database Systems at Alibaba: Opportunities and Challenges
- Inter thread wait and wake-up mechanism, singleton mode, blocking queue, timer
- Fast realization of Bluetooth communication between MCU and mobile phone
- HTAP 快速上手指南
- 乐观事务和悲观事务
- 面试官:请你介绍一下缓存穿透、缓存空值、缓存雪崩、缓存击穿的,通俗易懂
- Unrecognized VM option ‘‘
- 从5秒优化到1秒,系统飞起来了...
- Tar: /usr/local: cannot find tar in the Archive: due to the previous error, it will exit in the last error state
猜你喜欢

面试官:用分库分表如何做到永不迁移数据和避免热点问题?

POI 替换docx中的文字和图片

Idea one click log generation

JVM类加载机制

观测电机转速转矩

Modeling competition - optical transport network modeling and value evaluation

面试官:请你介绍一下缓存穿透、缓存空值、缓存雪崩、缓存击穿的,通俗易懂
[email protected][2389:1: columnNameTypeOrConstraint : ( ( tableConstraint ) | ( columnNameT"/>NoViableAltException([email protected][2389:1: columnNameTypeOrConstraint : ( ( tableConstraint ) | ( columnNameT

JVM garbage collection mechanism

JVM对象组成和存储
随机推荐
multiprocessing.pool详解
解决 Win10 Wsl2 IP 变化问题
Partial function of Scala
古典密码体制--代换和置换
Proxy-Reflect使用详解
TiDB的事务概览
Transaction overview of tidb
The fourth question of the 299th weekly match 6103 Minimum fraction of edges removed from the tree
Compatibility comparison between tidb and MySQL
多线程带来的的风险——线程安全
On gpu: historical development and structure
2022 le fichier CISP - Pte (i) contient:
可扩展哈希
Quick realization of Bluetooth ibeacn function
下载cuda和cudnn
Scala之偏函数Partial Function
IDEA一键生成Log日志
Unrecognized VM option ‘‘
An Empirical Evaluation of In-Memory Multi-Version Concurrency Control
Optimistic and pessimistic affairs