Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the common encryption algorithms in the web front end

Shulou Source: shulou.com Published: 2022-06-02 18:35:17 11月16日 Update

This article mainly introduces "what are the common encryption algorithms in the front end of web". In the daily operation, I believe that many people have doubts about the common encryption algorithms in the front end of web. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "what are the common encryption algorithms in the front end of web?" Next, please follow the editor to study!

Today, with more and more attention to information security, all kinds of front-end encryption become more and more important. Usually in the interaction with the server, in order to ensure the security of data transmission and avoid being captured and tampered with data, in addition to the application of https, it is also necessary to encrypt and decrypt the transmitted data.

At present, common encryption algorithms can be divided into three categories.

Symmetric encryption algorithm: AES,...

Asymmetric encryption algorithm: RSA,...

Hash algorithm: MD5,...

Symmetric encryption algorithm

Symmetric encryption (also known as private key encryption) refers to encryption algorithms that use the same key for encryption and decryption. It requires the sender and receiver to agree on a key before communicating securely. The security of the symmetric algorithm depends on the key, and the disclosure of the key means that anyone can decrypt the message they send or receive, so the confidentiality of the key is very important to the security of the communication.

Characteristics.

Advantages: the algorithm is open, the amount of calculation is small, the encryption speed is fast and the encryption efficiency is high.

Disadvantages: before data transmission, the sender and receiver must agree on the key, and then both parties keep the key. If one party's key is disclosed, the encrypted information will not be secure.

Usage scenarios: local data encryption, https communication, network transmission, etc.

AES

AES: the Advanced encryption Standard (AdvancedEncryptionStandard) is the most common symmetric encryption algorithm (WeChat Mini Programs uses this encryption algorithm for encrypted transmissions).

Key: a password used to encrypt plaintext. The key is generated by negotiation between the receiver and the sender, but it can not be transmitted directly on the network, otherwise it will lead to the leakage of the key, usually encrypting the key through an asymmetric encryption algorithm, and then transmitting it to each other through the network, or discuss the key directly face to face. The key must not be disclosed, otherwise the attacker will restore the ciphertext and steal the data.

When AES encryption is needed in a project, you can use the open source js library: crypto-js

VarCryptojs=require ('crypto-js')

Vardata= {id:1,text:'HelloWorld'}

/ / encrypted into ciphertext

Varciphertext=Cryptojs.AES.encrypt (jsON.stringify (data), 'secret_key_123'). ToString ()

/ / decrypt to get the plaintext

Varbytes=Cryptojs.AES.decrypt (ciphertext,'secret_key_123')

VardecryptedData=jsON.parse (bytes.toString (Cryptojs.enc.Utf8))

At this point, the study of "what are the common encryption algorithms in the front end of web" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Encryption algorithm key symmetry common security data transmission front end learning security receiver network communication important information ciphertext plaintext more network transmission Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information Shulou Tech Info Microsoft Docker