当前位置:网站首页>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 .
边栏推荐
- VCIP2021:利用解码信息进行超分辨率
- 《Kubernetes监控篇:Grafana通过自动化方式添加datasource和dashboard》
- 30岁之前一定要明白的道理
- "N'osez pas douter du Code, vous devez douter du Code" notez une analyse de délai de demande réseau
- “不敢去懷疑代碼,又不得不懷疑代碼”記一次網絡請求超時分析
- Talk about row storage and column storage of database
- Flink状态管理
- Rongyun: let the bank go to the "cloud" easily
- Stephencovey's tips for efficient work for young people
- 一文搞懂开放源码软件(OSS)质量保证
猜你喜欢

Nine good programming habits for 10 years

Talk about row storage and column storage of database

12306 ticket grabbing tutorial
![[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

Shan Zhiguang, chairman of BSN Development Alliance: DDC can provide the underlying support for the development of China's meta universe industry

"Dare not doubt the code, but have to doubt the code" a network request timeout analysis

Tasks and responsibilities of the test team and basic concepts of testing

LDA study notes

transformers VIT图像模型向量获取

CVE-2022-22965复现
随机推荐
HMS core news industry solution: let technology add humanistic temperature
Performance of recommender algorithms on top-N recommendation tasks
VR全景拍摄,打破传统宣传雁过不留痕的僵局
Flink status management
How do I open an account on my mobile phone? Is it safe to open an account online?
After several years of writing at CSDN, I published "the first book". Thank you!
Stop using system Currenttimemillis() takes too long to count. It's too low. Stopwatch is easy to use!
Instanceinforeplicator class of Eureka (service registration auxiliary class)
Offline physical stores combined with VR panorama make virtual shopping more realistic
Temporary recommendation on graphs via long- and short term preference fusion
Traffic replication in istio Service Grid
Andrdoid delay operation
Double hands of daily practice of Li Kou 2day9
Cve-2022-22965 reappearance
Neuron+eKuiper 实现工业物联网数据采集、清理与反控
Common writing methods and excellent examples of acknowledgments in graduation thesis writing
What does Huawei's minutes on patents say? (including Huawei's top ten inventions)
BSN发展联盟理事长单志广:DDC可为中国元宇宙产业发展提供底层支撑
Ppt data collection methods and analysis skills
How MySQL enables multiple auto incrementing columns in a table