当前位置:网站首页>Quickly understand the commonly used symmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry
Quickly understand the commonly used symmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry
2022-06-22 14:12:00 【51CTO】
interviewer : Tell me about your common encryption algorithms ?
Encryption algorithms are usually divided into two types : Symmetric encryption and Asymmetric encryption . among , Symmetric encryption algorithm uses the same key for encryption and decryption ; Asymmetric encryption algorithm uses different keys for encryption and decryption , It is divided into public key and private key . Besides , There is also a class called Message digest algorithm , It is an irreversible algorithm for summarizing data .
This time we will learn about symmetric encryption algorithm .
Symmetric encryption algorithm
Symmetric encryption algorithm uses the same key for encryption and decryption , Or use two keys that can be simply calculated from each other . In most symmetric encryption algorithms , The encryption and decryption keys are the same .
It requires both parties to communicate securely before , Agree on a key . The security of symmetric algorithm depends on the key , Leaking the key means that anyone can decrypt the information they send , This is also one of the main disadvantages of symmetric encryption algorithm .
The common symmetric encryption algorithms are :DES Algorithm 、3DES Algorithm 、AES Algorithm .
DES Algorithm
DES Algorithm (Data Encryption Standard) Is a common block encryption algorithm .
interviewer : What is a block encryption algorithm ?
Block encryption algorithm is to divide plaintext into fixed length groups , Each group is encrypted with the same key and algorithm , Output is also a ciphertext of fixed length .
from IBM The company in 1972 Developed in ,1976 In, it was determined as the federal data processing standard by the National Standards Bureau of the federal government of the United States (FIPS), Then it spread widely in the world .
stay DES In the algorithm, , The fixed length of the key is 64 position . Clear text press 64 Bit to group , Ciphertext group is formed by permutation or exchange of the plaintext group and key bit by bit , Then assemble the ciphertext group into ciphertext .
Each eighth bit of the key is set to parity bit , That is the first. 8、16、24、32、40、48、56、64 position , Therefore, the length of the key actually participating in the encryption is 56 position .
We use it Java Write an example :
The operation results are as follows :
DES Now it's not a secure encryption method , Mainly because the key it uses is too short , Easily broken by violence .
3DES Algorithm
3DES Algorithm (Triple Data Encryption Algorithm) yes DES An upgraded version of the algorithm , It is equivalent to three times of plaintext DES encryption .
Because of the enhancement of computer operation ,DES Because the key length of the algorithm is too low, it is easy to be broken by violence ;3DES The algorithm provides a relatively simple method , By adding DES To avoid similar attacks , Instead of designing a new block cipher algorithm .
stay DES In the algorithm, , The fixed length of the key is 192 position . When encrypting and decrypting , The key will be divided into 3 individual 64 A key .
interviewer :3DES What is the process of algorithm encryption and decryption ?
The encryption process is as follows :
- Use the first key to encrypt plaintext .
- Decrypt the result of the previous step with the second key .
- Use the third key to encrypt the result of the previous step .
The decryption process is as follows :
- Decrypt plaintext using a third key .
- Use the second key to encrypt the result of the previous step .
- Decrypt the result of the previous step with the first key .
We use it Java Write an example :
The operation results are as follows :
although 3DES The security of the algorithm has been improved , But because of the use of 3 Time DES Algorithm , Encryption and decryption are slow .
AES Algorithm
AES(Advanced Encryption Standard, Advanced encryption standard ) Mainly to replace DES Encryption algorithm , Although it appears 3DES Encryption method of , But because its encryption time is DES Algorithm 3 More than double , The number of key bits still cannot meet the security requirements .
1997 year 1 month 2 Number , National institute of standards and technology (NIST) Announced the hope to solicit advanced encryption standards , To replace DES. Many cryptographers all over the world have submitted their own algorithms . Through the selection process , Advanced encryption standard was established by the National Institute of standards and technology in 2001 year 11 month 26 Published on FIPS PUB 197, And in 2002 year 5 month 26 Day becomes the effective standard .
This algorithm is a Belgian cryptographer Joan Daemen and Vincent Rijmen Designed by , Combine the names of the two authors , With Rijndael The selection process of Advanced Encryption Standard for name contribution .
interviewer :AES Is the key length of the algorithm fixed ?
AES The key length of the algorithm is fixed , The length of the key can be used 128 position 、192 Bit or 256 position .
AES The algorithm is also a block encryption algorithm , Its grouping length can only be 128 position . The grouped plaintext group and key use several different methods to perform permutation and replacement operations to form a ciphertext group , Then assemble the ciphertext group into ciphertext .
We use it Java Write an example :
The operation results are as follows :
AES The algorithm is the most widely used symmetric encryption algorithm at present .
summary
Symmetric encryption algorithm uses the same key for encryption and decryption , The common symmetric encryption algorithms are :DES Algorithm 、3DES Algorithm 、AES Algorithm .
Due to low security 、 The efficiency of encryption and decryption is low ,DES Algorithm and 3DES Algorithms are not recommended ,AES The algorithm is the most widely used symmetric encryption algorithm at present .
边栏推荐
- SQL Server 常用函数
- Stm32f1 and stm32subeide programming example - Optical intermittent sensor drive
- Istio服务网格中的流量复制
- My suggestions on SAP ABAP transformation
- openGauss内核分析之查询重写
- 别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
- Oracle cursor
- 12306 ticket grabbing tutorial
- Technology practice | scene oriented audio and video call experience Optimization
- transformers VIT图像模型向量获取
猜你喜欢

Query rewriting for opengauss kernel analysis

Neuron+ekuiper realizes data collection, cleaning and anti control of industrial Internet of things

程序员要不要选择软件人才外包公司?

Leetcode math problems

防火墙基础之策略部署

12306 ticket grabbing tutorial

JS advanced programming version 4: learning iterators

融云:让银行轻松上“云”

《Kubernetes监控篇:Grafana通过自动化方式添加datasource和dashboard》
![[Nacos cloud native] the first step of reading the source code is to start Nacos locally](/img/f8/d9b848593cf7380a6c99ee0a8158f8.png)
[Nacos cloud native] the first step of reading the source code is to start Nacos locally
随机推荐
Record of problems encountered in dual network card binding
Chapter 1 overview of naturallanguageprocessing and deep learning
Consolidation of common functions of numpy Library
Installing and using protobuf-c
Is polardbx PG or MySQL?
ThoughtWorks.QRCode和ZXing.Net 二维码,网址可以直接跳转
Neuron+eKuiper 实现工业物联网数据采集、清理与反控
融云:让银行轻松上“云”
"Dare not doubt the code, but have to doubt the code" a network request timeout analysis
Understand the quality assurance of open source software (OSS)
uniapp app 端截屏且保存到本地
一文搞懂开放源码软件(OSS)质量保证
SQL functions -- converting a one to many relationship to a one to one relationship
Performance of recommender algorithms on top-N recommendation tasks
Istio服务网格中的流量复制
php两个时间戳相隔多少天
安装和使用protobuf-c
Z-Score和deltf/f有什么区别?
想知道股票开户优惠链接,如何得知?网上开户安全么?
Interpretation of the paper -- scalable collaborative filtering with jointly derived neighborhood interpolation weights