In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
ELGamal is an asymmetric encryption algorithm, similar to RSA
ELGamal cryptosystem is a public key cryptosystem proposed by T.ElGamal in 1985. Its security is based on the difficulty of solving the discrete logarithm problem, and it is a promising public key cryptography after RSA. The DSA (Digital Signature Algorithm) algorithm of American DSS (Digital Signature Standard) is evolved from the ElGamal algorithm. At present, DSA algorithm is also widely used.
1. Algorithm for generating public key
The system provides a large prime p and a primitive element g on GF (p). Optional for each user A
XA ∈ [0,1,2,... , pmur1]
Calculate YA = gXA mod p
Among them, XA is the user's private key, and YA becomes the user's public key. YA is made public, XA is kept secret, and A himself holds it.
2. Encryption algorithm
If A wants to communicate with B in secret, let the plaintext be m ∈ [0,1,2,... , pmur1] can follow the following steps:
(1) A finds the public key of B YB = gXB mod p
(2) A randomly selected random number x ∈ [0,1,2,. , pmur1], A calculates C1 = (g) x mod p
(3) A calculation: K = (YB) x mod p = (gx) XB mod p, C2 = (Khamm) mod p
(4) A sends (C1 # C2) as ciphertext to B
3. Decryption algorithm
B after receiving the ciphertext, the decryption method is as follows:
(1) B is calculated with its own key XB: K = (YB) x mod p = (gx) XB mod p = (C1) XB mod p
(2) B calculation: Kmuri 1 mod p
(3) find m = (K-1*C2) mod p
Examples are as follows:
Let p = 11 and g = 7, on GF (11), there are 71m 71m 72m 72m 73m 74m 74m 10m 76m 4m 77m 6m 78m 9m 79m 8710m 1, so 7 is the primitive element of GF (11).
Let A's private key XA = 3, public key YA = 2. B's private key XB = 5, public key YB = 10. Suppose A wants to send the information m = 7 to BLI A to take the random number x = 5 Magi A to calculate C1 = g5 mod 11 = 10 mod K = (YB) 5 mod 11 = 10 C 2 = Karmm mod 11 = 70 mod 11 = 4. A sends (10 mod 4) as ciphertext to B Magee B and calculates K = (C1) XB mod p = 105 mod 11 = 10 Magi 1 = 10 (according to K * K Mel 1 = 1 mod 11), then m = K ray 1 * C 2 = 40 mae 11 = 7.
Algorithm implementation: https://github.com/ljheee/ELGamalCipher
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.