Name: Pankaj Gulhane
Roll: 03329007
---------------------------------------------------------------------


Interfaces
	Diffe-hellman 
	dhp.o
	It will give only private key for a given problem.


	Run these scripts 
	It takes input from test
	
	./runDigest.pl
	./runSign.pl

	results can be stored in resultDig.res, resultSign.res resp.
	
Conclusion:
	After observing results we can see that in RSA type alogs,
	takes more time while signing whereas very less time in
	verification as, in RSA we have private key much larger than
	public key, so varification takes less time than signing,
	In DSA the case is reverse, public key is much larger than
	private key. so DSA type algos,works quicker,at the time of
	signing. and as public key is huge it takes longer time for
	verification.

	

Answers

3.1) Transmission error in C1															    
     Here the encryption is succesful and hence all Ci are right 
     Transmission error

     Decryption process
     Here 
	  P(i+1)=Ci XOR f(C(i+1), Key);		Ci=IV for i=0
     As we can see here 
     1.) every Ci affects only two decryption Pi, P(i+1)
     2.) No plain text, take part in decryption. so there is no
     cascading.
     
     So error at receiving end is limited to 2 blocks only.

		 
		  C1+						C2+
		    |						  |
		    +---->------------------+ 			  |
		    |			    | 			  |
		    V			    | 			  |
		    |			    | 			  |
       +------------+---------------+	    | 	   +--------------+-------------+
K      |                            |	    | 	K  |                            |
----->-+     DECRYPTION             |	    |  ----+     DECRYPTION             |
       |                            |	    | 	   |                            |
       +------------+---------------+	    | 	   +--------------+-------------+
		    |			    V 			  |
		    |			    | 			  |
		    |			    | 			  V
		    |			    | 			  |
	IV	    |			    +-------------->------+
      ------->------+ 						  |
		    |						  |
		    |						  V P2
		    V P1


							  
3.2) Error in Cipher text block, due to Error in plain text
     
     Encryption processB
     
	C(i+1)= f(P(i+1) XOR Ci, Key);
     As we can see here
     1.) Every Ci affect generation of next Ci
     2.) So if one Ci is in error all following Cis will be in error
     3.) So if there is an error in plain text P1 then it will affect
     generation of C1 and which in turn will affect generation of
     other following Cis

     Decryption process.
     Now at the time of encoding there was an error in plain text P1
     and hence there was error in all cipher block.
     But at the time of encryption errornous plain text was just
     another string for encryption block. It generated cipher
     corresponding to that text, So at the time of decryption it will
     get back that errornous plain text having only P1 in error.


		  P1+						P2+
		    |						  |
		    |			     			  V
		    |			     			  |
	IV	    |						  |
      ------->------+ 						  |
		    |						  |
		    |						  |			  
		    |			    +-------------->------|
		    V			    | 			  |
		    |			    | 			  |
       +------------+---------------+	    | 	   +--------------+-------------+
K      |                            |	    | 	K  |                            |
----->-+     EnCRYPTION             |	    |  ----+     ENCRYPTION             |
       |                            |	    | 	   |                            |
       +------------+---------------+	    | 	   +--------------+-------------+
		    |			    A			  |
		    |			    | 			  |
		    |			    | 			  V
		    |			    | 			  |
		    +-------------->--------+
                    | 						  |
		    |						  |
		    |						  V C2
		    V C1



3.3)  Error occurs in the i th transmitted byte in CFB mode,

      Decryption
      Here Ci contribute s bits in generation of next Cipher
      value. which are shifted by s bits in every phase. so every Ci
      affect all those following Cis where 's' bits where used from
      Ci. 
      Life of 's' bits =  IVsize/s stages

      So if Ci is corrupt then it will affect all decrypted plain text
      which were generated in life time of those corrupted s bits. 
      So 
	 Pi...P(i+IVsize/s);
	 will be in error.


     So if IV is 64 bits and s is 8 bits then there will be atmost(<
     for boundry condition) 9 affected stages.
		     						   
		     						   
		     			     			   
								   
	  	     			    +------------->-------------+	   
       +------------+---------------+	    | 	   +--------------+-----V-------+
       |                            |	    | 	   |           <-----           |
       |     IV                     |	    |      |     IV                     |
       |           64-s   |s bits   |	    | 	   |         64-s | s bits      |
       +------------+---------------+	    | 	   +--------------+-------------+
		    |			    |			  |
		    |			    |			  |			  
		    |			    |			  |
		    v			    | 			  |
		    |			    | 			  |
       +------------+---------------+	    | 	   +--------------+-------------+
K      |                            |	    | 	K  |                            |
----->-+     EnCRYPTION             |	    |  ----+     ENCRYPTION             |
       |                            |	    | 	   |                            |
       +------------+---------------+	    | 	   +--------------+-------------+
		    |			    A			  |
		    |			    | 			  |
		    V			    | 			  |
		    |			    | 			  |
       +------------+---------------+	    | 	   +--------------+-------------+
       |                            |	    | 	   |                            |
       |     Select S bits          |	    |      |     Select s bits          |
       |        s|64-s              |	    | 	   |                            |
       +---------+--+---------------+	    | 	   +--------------+-------------+
		    |			    A			  |
		    |			    | 			  |
		P1  /s			    | 			  V
	--------->--+		s	    | 			  |
		    +---------/----<--------C1			  / s
                    | 						  + <----C2
		    |						  |
		    |						  V P2
		    V P1
