Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common encryption algorithms in big data's development?

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "what are the common encryption algorithms in the development of big data". The content is simple and clear. I hope it can help you solve your doubts. Here, let the editor lead you to study and learn the article "what are the common encryption algorithms in the development of big data?"

When it comes to encryption algorithms, developers are basically no stranger. We usually come into contact with a variety of encryption algorithms, which are simply divided into symmetric encryption algorithm, asymmetric encryption algorithm and hash algorithm. What is the difference between algorithms? We can understand the difference between the three algorithms this way:

Symmetric encryption algorithm: the encryption algorithm is consistent with the decryption algorithm's secret key key. Asymmetric encryption algorithm: the secret keys of the encryption algorithm and the decryption algorithm are not consistent. Hash algorithm: no secret key, currently unable to reverse decryption. (except for violent cracking)

Why do we need encryption? In our daily life, login passwords or all kinds of private information need to be encrypted and saved to prevent information disclosure. Then let's take a look at what kind of algorithms are available for these three types of algorithms:

Symmetric encryption algorithm: at present, the mainstream algorithms are DES algorithm, 3DES algorithm, AES algorithm asymmetric encryption algorithm: at present, the mainstream algorithm is RSA algorithm hash algorithm: at present, it is mainly based on MD5 and SHA-1 algorithm.

This article focuses on these six algorithms for specific explanation, perhaps the most familiar with these algorithms is the MD5 algorithm. Why are you familiar with it? One of the most common scenarios of MD5 algorithm is user registration, the password is encrypted by MD5, and the password can not be decrypted in reverse can improve the security. Next, let's start with the first algorithm: MD5 algorithm.

MD5 encryption

MD5 is actually a hashing algorithm, which essentially produces a summary of a piece of information to prevent it from being tampered with. Strictly speaking, MD5 is not an encryption algorithm but a digest algorithm. No matter how long a string is, MD5 outputs a string of 128bytes in length, which is 32 characters in hexadecimal. We have a direct MD5 algorithm:

This algorithm is the most basic MD5 encryption, which successfully converts the encrypted string to pure lowercase. We can take a look at the effect:

You can see that the effect of MD5 encryption has been solved, but although MD5 cannot be decrypted in reverse, it can continue to use MD5 encryption to try to crack it violently, so we usually use MD5 encryption with different encryption algorithms. We design an encryption algorithm as follows:

Sort the required parameters of the interface with the current timestamp according to the ASCII order of key=value and assemble the string around an encryption key secret to form a cost secret string waitSign encrypts the string to be encrypted by MD5 and converts it to pure lowercase

Now we can implement this MD5 encryption combined with a specific algorithm in the code:

We directly encapsulate the designed algorithm into a public method, which we call directly in the interface.

CreateSign (obj, secret)

Then the required parameters are assembled into json format combined with the current timestamp, and the parameters are passed as the first parameter and the secret key secret as the second parameter. Let's take a look at the API call code:

We can take a look at the new effects:

We combine the current timestamp with the new algorithm, and we can limit the timestamp to be valid within one minute. It can effectively ensure the security of the interface. After talking about MD5 encryption, we will then build another encryption algorithm, SHA-1 algorithm.

SHA-1 algorithm

SHA-1 algorithm is as popular as MD5 message digest algorithm, but SHA-1 is more secure than MD5. SHA-1 produces a 160-bit message digest, 40-bit characters in hexadecimal. Let's take a look at the implementation:

You can see that we converted the original password with SHA-1 encryption. However, although the security of SHA-1 is higher than that of MD5, direct and simple SHA-1 encryption may also be cracked by violence, so we can use the algorithm just designed to encrypt SHA-1. I won't say much about it. You can try it yourself. Next, let's look at symmetric encryption.

DES algorithm

DES encryption algorithm is a block cipher that encrypts data with 64 bits as groups. its key length is 56 bits and the same algorithm is used for encryption and decryption. The DES encryption algorithm keeps the key secret and exposes algorithms, including encryption and decryption algorithms. In this way, only those who have the same key as the sender can interpret the ciphertext data encrypted by the DES encryption algorithm. Therefore, deciphering the DES encryption algorithm is actually the encoding of the search key. The number of operations of brute force cracking DES algorithm is only 2 ^ 56.

Let's take a look at how to implement the DES encryption algorithm:

Here I only use cbc mode encryption to demonstrate, and those who are interested in other algorithm modes of DES encryption can study on their own. We can take a look at the encryption effect:

Because the DES algorithm is symmetric, you can use the same algorithm for reverse decryption. Let's take a look at how the algorithm is implemented:

You can see that we successfully decrypted the microprimitive string from the encrypted string encrypted by des-cbc. But we also said that the DES algorithm can be cracked by brute force, so the 3DES algorithm is actually the optimization of the DES algorithm.

3DES algorithm

In fact, the 3DES algorithm is based on the DES encryption algorithm, using three different keys for three different encryption. So the strength of the key will be higher after encryption. Let's take a look at the implementation of 3DES:

You can see that we have successfully used 3DES to encrypt and decrypt the password. There is still one mainstream symmetric encryption algorithm: AES algorithm.

AES algorithm

AES encryption algorithm is an advanced encryption standard in cryptography. The minimum key length is 128,192,256 bits, and the packet length is 128bits. The algorithm should be easy to implement in all kinds of hardware and software. AES itself is produced to replace the DES algorithm, and AES has better security, higher efficiency and flexibility.

As you can see, I chose AES encryption with a secret key length of 128 bits and an algorithm mode of CBC mode. We can look at the effect of the algorithm:

So far, we have implemented all three symmetrical encryption algorithms. Next, let's talk about asymmetric encryption. Unlike symmetric encryption algorithms, asymmetric encryption algorithms require two keys: public key and private key. The public key and the private key are a pair. If the data is encrypted with the public key, it can be decrypted only with the corresponding private key; if the data is encrypted with the private key, it can be decrypted only with the corresponding public key. Because encryption and decryption use two different keys, this algorithm is called asymmetric encryption algorithm. Next let's take a look at asymmetric encryption: the RSA algorithm.

RSA algorithm

The RSA algorithm usually forms a pair of RSA keys, and the user keeps the private key; the other is the public key, which can be made public. To improve the security, the RSA key is at least 512 bits long, and 1024 bits are generally recommended. This makes the computation of encryption very large. In order to reduce the amount of computation, the combination of traditional encryption method and public key encryption method is often adopted when transmitting information, that is, the information is encrypted by improved DES or AES conversation key, and then the conversation key and information summary are encrypted by RSA key. After receiving the message, the other party can decrypt it with different keys and check the summary of the information. So far, there is no reliable way to attack the RSA algorithm.

As you can see, we use the secret key length of 1024 bits to generate public and private keys. Then encrypt with the public key and decrypt with the private key. Next, let's take a look at the running effect:

After seeing such a long list of encryption, did you immediately give up the idea of trying to crack it? RSA encryption algorithm is the most influential public key encryption algorithm at present, and is generally regarded as one of the best public key schemes at present. RSA is the first algorithm that can be used for both encryption and digital signature.

Before we sign with the private key and verify with the public key. True is returned for successful verification, and false is returned for failed verification. We can take a look at the effect:

These are all the contents of the article "what are the common encryption algorithms in big data's development?" Thank you for your reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report