DH
Diffie-Hellman algorithm (D-H algorithm), key agreement protocol. It is an idea put forward by Diffie and Hellman, founders of public key cryptosystem. Simply put, it allows two users to exchange information on public media to generate a "consistent" and shared key. In other words, Party A produces a pair of keys (public key and private key) and Party B produces a pair of keys (public key and private key) according to Party A's public key. Taking this as the baseline, as the basis of data transmission secrecy, both sides use the same symmetric encryption algorithm to construct a local key to encrypt data. In this way, after the exchange of the local key algorithm, both parties disclose their own public keys, encrypt data using the other party's public key and the private key just generated, and decrypt the data using the other party's public key and their own private key. It is not only the two sides of A and B, but also can be extended to multi-party sharing data communication, thus completing the secure communication of network interactive data. The algorithm originates from the Chinese congruence theorem, the Chinese remainder theorem.

Process analysis:

1. Party A constructs the key pair, publishes the public key to Party B and keeps the private key; both parties agree on the data encryption algorithm; Party B constructs the key pair through Party A's public key, publishes the public key to Party A, and keeps the private key.
2. Party A uses private key, Party B public key and agreed data encryption algorithm to construct local key, then encrypts data through local key and sends it to Party B after encryption. Party B uses private key, Party A public key and agreed data encryption algorithm to construct local key, and then decrypts data through local key.
3. Party B uses private key, Party A public key and agreed data encryption algorithm to construct local key, then encrypts data through local key and sends it to Party A after encryption. Party A uses private key, Party B public key and agreed data encryption algorithm to construct local key, and then decrypts data through local key.

As I said, both parties can encrypt the data sent to the other party after obtaining the public key of the other party, and decrypt the received data at the same time, so as to achieve the purpose of data secure communication!