当前位置:网站首页>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 .
边栏推荐
猜你喜欢

3dMax建模笔记(一):介绍3dMax和创建第一个模型Hello world

Traffic replication in istio Service Grid

STM32F1与STM32CubeIDE编程实例-光断续传感器驱动

Rigid demand of robot direction → personal thinking ←

Nine good programming habits for 10 years

CVE-2022-22965複現

"N'osez pas douter du Code, vous devez douter du Code" notez une analyse de délai de demande réseau

Leetcode math problems

线下实体店结合VR全景,让虚拟购物更加真实

Understand the quality assurance of open source software (OSS)
随机推荐
uniapp app 端截屏且保存到本地
简简单单的科研秘籍
快速了解常用的对称加密算法,再也不用担心面试官的刨根问底
Andrdoid delay operation
Stephencovey's tips for efficient work for young people
VR全景拍摄,打破传统宣传雁过不留痕的僵局
Transformers vit image model vector acquisition
什么是Bout?
Rigid demand of robot direction → personal thinking ←
30岁之前一定要明白的道理
Record of problems encountered in dual network card binding
HW is around the corner. Can't you read the danger message?
Common writing methods and excellent examples of acknowledgments in graduation thesis writing
Istio服务网格中的流量复制
Processing statement on price selection of several manufacturers
Getting started with go web programming: validators
How to add a mask to a VR panoramic work? What is the function?
A simple scientific research secret
"N'osez pas douter du Code, vous devez douter du Code" notez une analyse de délai de demande réseau
STM32F1与STM32CubeIDE编程实例-光断续传感器驱动