Professional Documents
Culture Documents
CNS Unit III
CNS Unit III
EIGamal Algorithm:-
Thus, functions as a one-time key, used to encrypt and decrypt the message.
For example, let us start with the prime field GF(19); that is, q = 19. It has
primitive roots {2, 3, 10, 13, 14, 15 }. We choose α = 10.
Alice generates a key pair as follows:
95
Cryptography and Network Security
RABIN CRYPTOSYSTEM
Rabin Cryptosystem is an public-key cryptosystem invented by Michael Rabin, is a variation of the RSA.
RSA is based on the exponentiation congruence; Robin is based on quadratic congruence.
The public key in the Rabin is n, private key is the tuple(p,q). Everyone can encrypt a message using n, only
Bob can decrypt the message using p and q.
Decryption of the message is infeasible It uses asymmetric key encryption for communicating between two
parties and encrypting the message.
The security of Rabin cryptosystem is related to the difficulty of factorization. It has the advantage over the
others that the problem on which it banks has proved to be hard as integer factorization.
It has the disadvantage also, that each output of the Rabin function can be generated by any of four possible
inputs. if each output is a cipher text, extra complexity is required on decryption to identify which of the
four possible inputs was the true plaintext.
96
Cryptography and Network Security
Decryption
1. Accept C from sender.
2. Compute:
a1 = C(p+1)/4 mod p
a2= - C(p+1)/4 mod p
b1= C(q+1)/4 mod q
b2= - C(q+1)/4 mod q
3. Calculate four Plain text by using Chinese Remainder Algorithm:
M1 =Chainese_Remainder(a1,b1,p,q)
M2 =Chainese_Remainder(a1,b2,p,q)
M3 =Chainese_Remainder(a2,b1,p,q)
M4 =Chainese_Remainder(a2,b2,p,q)
4. Choose one of the above (M1 ,M 2 ,M3 and M4 ) is the appropriate plaintext.
The Rabin cryptosystem is not deterministic: Decryption creates four equally probable plain texts
Example:
1. Bob selects p=23 and q=7, note both are congruent to 3 mod 4
2.Bob calculates n=pxq=161
3. Bob announces n publickly; he keeps p and q private
4. Allice want to send plain text P=24. Note that 161and 24 are relatively prime; 24 is in Z161*
She calculates C=242 mod 161 =93 mod 161, and sends the ciphertext 93 to Bob
5. Bob receives 93 and calculates four values:
a. a1=+(93(23+1)/4 mod 23=1 mod 23
b. a2=-(93(23+1)/4 mod 23=22 mod 23
c. b1=+(93(7+1)/4 mod 7=4 mod 7
d. b2=-(93(7+1)/4 mod 7=3 mod 7
6. Bob takes four possible answers, (a1,b1), (a1,b2), (a2,b1),(a2,b2) and uses Chinese Remainder Theorem to
find 4 possible plain texts: 116,24,137 and 45.
Case 1:
By using (a1=1,b1=4) combinations with modulo (p=23,q=7), Let X is plain text:
X = 1 mod 23
97
Cryptography and Network Security
X= 4 mod 7
By using Chinese Remainder Theorem:
M=23x7=161, M1=M/23=161/23=7, M2=M/7=161/7=23
M1-1=7-1 mod 23 = 723-2 mod 23 = 721 mod 23=10
M2-1=23-1 mod 7 = 237-2 mod 7 = 235 mod 7=4
X= (a1 x M1xM -1 -1
1 +a2xM2xM 2) mod M
=( 1 x 7 x 10 + 4 x 23 x 4) mod 161 = 438 mod 161=116
Case 2:
By using (a1=1,b2=3) combinations with modulo (p=23,q=7), Let X is plain text:
X = 1 mod 23
X= 3 mod 7
By using Chinese Remainder Theorem:
M=23x7=161, M1=M/23=161/23=7, M2=M/7=161/7=23
M1-1=7-1 mod 23 = 723-2 mod 23 = 721 mod 23=10
M2-1=23-1 mod 7 = 237-2 mod 7 = 235 mod 7=4
X= (a1 x M1xM -1 -1
1 +a2xM2xM 2) mod M
=( 1 x 7 x 10 + 3 x 23 x 4) mod 161 = 346 mod 161=24
Case 3:
By using (a2=22,b1=4) combinations with modulo (p=23,q=7), Let X is plain text:
X = 22 mod 23
X= 4 mod 7
By using Chinese Remainder Theorem:
M=23x7=161, M1=M/23=161/23=7, M2=M/7=161/7=23
M1-1=7-1 mod 23 = 723-2 mod 23 = 721 mod 23=10
M2-1=23-1 mod 7 = 237-2 mod 7 = 235 mod 7=4
X= (a1 x M1xM -1 -1
1 +a2xM2xM 2) mod M
=( 22 x 7 x 10 + 4 x 23 x 4) mod 161 = (1540+368) mod 161=137
Case 4:
By using (a2=22,b2=3) combinations with modulo (p=23,q=7), Let X is plain text:
X = 22 mod 23
X= 4 mod 7
By using Chinese Remainder Theorem:
M=23x7=161, M1=M/23=161/23=7, M2=M/7=161/7=23
M1-1=7-1 mod 23 = 723-2 mod 23 = 721 mod 23=10
M2-1=23-1 mod 7 = 237-2 mod 7 = 235 mod 7=4
X= (a1 x M1xM -1 -1
1 +a2xM2xM 2) mod M
=( 22 x 7 x 10 + 3 x 23 x 4) mod 161 = (1540+276) mod 161=45
So, Finally from four cases: we got four plain text messages
Case 1: 116
Case 2: 24
Case 3: 137
Case 4: 45.
Only second answer(24) is Alice plain text, Bob needs to make a decision based on the situation
98