Question

4. Supppose Alice and Bob are using the prime p = 1451 and the base g = 2 for an ElGamal cryptosystem. (a) Alice chooses a =

all infor given
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The given below program will help you to find the calculations :

(ab) % MOD = ((a % MOD)b) % MOD

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int power(int a,int b)
{
    if(b==1)
        return a;
    long int subAns = power(a,b/2)%1451;
    if(b&1)
        return (((subAns*subAns)%1451)*a)%1451;
    return (subAns*subAns)%1451;
}
int main()
{
        int ans = (284*power(500,512))%1451;
        cout<<ans;
        return 0;
}

Step1: Key Creation:

Chooses private key 1 ≤ a ≤ p − 1.

Computes A = g^a(mod p).

Publishes the public key A.

So we have p = 1451.

g = 2 and a = 753.

On calculating this using the above program , we got A = 995 . So private Key for Alice will be 995.

Part B.

i) Chooses plaintext m.

ii) Chooses random ephemeral key k.

iii) Uses BOB’s public key b to compute c1 = g^k(mod p) and c2 = m*b^k (mod p).

iv) Sends ciphertext (c1, c2) to BOB.

For C1 = gk mod p

2512 mod 1451 .

we got C1 = 1185

and C2 = 284*500512 mod 1451 = 1411 .

So , the Cipher Text that will be sent to bob ( 1185 , 1411) .

Step 3.

i ) Calcuate (C1a)-1 x C2 (mod p )

ii) C1 = 332 , C2 = 869 , a = 451 , p = 1451

iii) 869*(332451)-1 mod 1451 . is the required expression.

iv) First Calculate ,  (332451)-1 mod 1451 , ............ eq (i)

it can be written as A * 332451 mod 1451 = 1

v) So, the value of A for which the LHS = RHS will satisfy is the required mod for eqn i.

So for A = 1088 it is satisfied .

vii) Now , calculate 869*1088 mod 1451 which 871.

So the Message will be 871 .

below the is code for finding A.

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int power(int a,int b)
{
    if(b==1)
        return a;
    long int subAns = power(a,b/2)%1451;
    if(b&1)
        return (((subAns*subAns)%1451)*a)%1451;
    return (subAns*subAns)%1451;
}
int main()
{
        for(int i = 1 ; i<=2000 ; i++){

        int ans = (i*power(332,451))%1451;

        if(ans==1)
        {

                cout<<i ;
                break ; 
        }

}
        
        return 0;
}
Add a comment
Know the answer?
Add Answer to:
all infor given 4. Supppose Alice and Bob are using the prime p = 1451 and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT